linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: linux-mtd@lists.infradead.org, dwmw2@infradead.org,
	matthieu.castet@parrot.com, dedekind1@gmail.com
Subject: Re: [PATCH 04/11] mtd: add data structures for Extended Parameter Page
Date: Mon, 22 Apr 2013 14:24:34 +0800	[thread overview]
Message-ID: <5174D7A2.2050203@freescale.com> (raw)
In-Reply-To: <CAN8TOE8k8gOWxTeBv3N41Jfsh1Zo-2GfUEAvq0vFsGMJ-rz2hA@mail.gmail.com>

于 2013年04月22日 12:24, Brian Norris 写道:
> On Mon, Mar 18, 2013 at 4:18 AM, Huang Shijie<b32955@freescale.com>  wrote:
>> Since the ONFI 2.1, the onfi spec adds the Extended Parameter Page
>> to store the ECC info.
>>
>> The onfi spec tells us that if the nand chip's recommended ECC codeword
>> size is not 512 bytes, then the @ecc_bits is 0xff. The host _SHOULD_ then
>> read the Extended ECC information that is part of the extended parameter
>> page to retrieve the ECC requirements for this device.
>>
>> This patch adds
>>      [1] the neccessary fields for nand_onfi_params{},
>>      [2] and adds the ext_ecc_info{} for Extended ECC information,
>>      [3] adds ext_section{} for extended sections,
>>      [4] and adds ext_param_page{} for the Extended Parameter Page.
>>
>> Signed-off-by: Huang Shijie<b32955@freescale.com>
>> ---
>>   include/linux/mtd/nand.h |   39 ++++++++++++++++++++++++++++++++++++++-
>>   1 files changed, 38 insertions(+), 1 deletions(-)
>>
>> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
>> index 9779e3e..94ae957 100644
>> --- a/include/linux/mtd/nand.h
>> +++ b/include/linux/mtd/nand.h
>> @@ -217,7 +217,10 @@ struct nand_onfi_params {
>>          __le16 revision;
>>          __le16 features;
>>          __le16 opt_cmd;
>> -       u8 reserved[22];
>> +       u8 reserved0[2];
>> +       __le16 ext_param_page_length; /* since onfi 2.1 */
>> +       u8 num_of_param_pages;        /* since onfi 2.1 */
>> +       u8 reserved1[17];
>>
>>          /* manufacturer information block */
>>          char manufacturer[12];
>> @@ -274,6 +277,40 @@ struct nand_onfi_params {
>>
>>   #define ONFI_CRC_BASE  0x4F4E
>>
>> +/* Extended ECC information Block Definition (since onfi 2.1) */
>> +struct ext_ecc_info {
> Should include NAND and/or ONFI in the name (e.g., onfi_ext_ecc_info)
>
>> +       u8 ecc_bits;
>> +       u8 codeword_size;
>> +       __le16 bb_per_lun;
>> +       __le16 block_endurance;
>> +       u8 reserved[2];
>> +} __attribute__((packed));
>> +
>> +#define SECTION_TYPE_0 0       /* Unused section. */
>> +#define SECTION_TYPE_1 1       /* for additional sections. */
>> +#define SECTION_TYPE_2 2       /* for ECC information. */
> Should prefix these with ONFI_
>
>> +struct ext_section {
> Also needs an ONFI prefix, e.g., onfi_ext_section
>
>> +       u8 type;
>> +       u8 length;
>> +} __attribute__((packed));
>> +
>> +#define EXT_SECTION_MAX 8
> Also should be prefixed ONFI_
>
>> +
>> +/* Extended Parameter Page Definition (since onfi 2.1) */
>> +struct ext_param_page {
> onfi_ext_param_page
>
>> +       __le16 crc;
>> +       u8 sig[4];             /* 'E' 'P' 'P' 'S' */
>> +       u8 reserved0[10];
>> +       struct ext_section sections[EXT_SECTION_MAX];
>> +
>> +       /*
>> +        * The actual size of the Extended Parameter Page is in
>> +        * @ext_param_page_length of nand_onfi_params{}.
>> +        * The followings are the unknown length sections.
> s/followings/following/
> s/unknown /variable-/
>
>> +        * So we do not add any fields below. Please see the onfi spec.
> s/onfi/ONFI/
>
>> +        */
>> +} __attribute__((packed));
>> +
>>   /**
>>    * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
>>    * @lock:               protection lock
>
thanks Brian.

I will fix it in next version.

Huang Shijie

  reply	other threads:[~2013-04-22  6:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18 11:18 [PATCH 00/11] mtd: add datasheet's ECC information to nand_chip{} Huang Shijie
2013-03-18 11:18 ` [PATCH 01/11] " Huang Shijie
2013-03-18 11:18 ` [PATCH 02/11] mtd: increase max OOB size to 744 Huang Shijie
2013-03-18 11:18 ` [PATCH 03/11] mtd: get the ECC info from the parameter page for ONFI nand Huang Shijie
2013-03-18 11:18 ` [PATCH 04/11] mtd: add data structures for Extended Parameter Page Huang Shijie
2013-04-22  4:24   ` Brian Norris
2013-04-22  6:24     ` Huang Shijie [this message]
2013-03-18 11:18 ` [PATCH 05/11] mtd: add a helper to get the supported features for ONFI nand Huang Shijie
2013-04-22  4:29   ` Brian Norris
2013-04-22  6:30     ` Huang Shijie
2013-03-18 11:18 ` [PATCH 06/11] mtd: get the ECC info from the Extended Parameter Page Huang Shijie
2013-03-18 11:18 ` [PATCH 07/11] mtd: replace the hardcode with the onfi_get_feature() Huang Shijie
2013-03-18 11:18 ` [PATCH 08/11] mtd: add a new field for ecc info in the nand_flash_dev{} Huang Shijie
2013-04-16 14:56   ` Artem Bityutskiy
2013-04-17  2:11     ` Huang Shijie
2013-03-18 11:18 ` [PATCH 09/11] mtd: parse out the ECC info for the full-id nand chips Huang Shijie
2013-03-18 11:18 ` [PATCH 10/11] mtd: add the ecc info for some " Huang Shijie
2013-04-22  3:30   ` Brian Norris
2013-03-18 11:18 ` [PATCH 11/11] mtd: gpmi: set the BCH's geometry with the ecc info Huang Shijie
2013-04-16 13:55 ` [PATCH 00/11] mtd: add datasheet's ECC information to nand_chip{} Artem Bityutskiy
2013-04-17  2:10   ` Huang Shijie
2013-04-17  3:56     ` Brian Norris
2013-04-22 21:35       ` Brian Norris
2013-04-23  2:34         ` Huang Shijie
2013-04-23  7:26           ` Brian Norris
2013-04-23  7:54             ` Huang Shijie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5174D7A2.2050203@freescale.com \
    --to=b32955@freescale.com \
    --cc=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=matthieu.castet@parrot.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).