2013-03-02 14:21:08

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

On Sat, 2013-02-16 at 11:56 +0800, Huang Shijie wrote:
> On Tue, Feb 12, 2013 at 11:47 PM, Artem Bityutskiy <[email protected]> wrote:
> > On Mon, 2013-01-28 at 12:57 +0800, Huang Shijie wrote:
> >> + {"SmartMedia 256MiB 3,3V", {0, 0x71}, 512, 256, 0x4000 },
> >> + {"SmartMedia 256MiB 3,3V ROM", {0, 0x5b}, 512, 256, 0x4000,
> >> NAND_ROM},
> >
> > Sorry for a possibly stupid question, but what does it buy you adding
> > another "0" to all the entries? I see you add another table, which you
> > look up if the "traditional" table does not work. Why you need to add
> > these zeroes?
>
> The zeros are for the maf_id.
>
> The dev_id is the second byte of the 8-byte id data.

It does not really make me understand why we add these zeroes, they
still look useless to me... Would you please be a little more verbose
about your solution?

--
Best Regards,
Artem Bityutskiy


2013-03-04 05:57:37

by Huang Shijie

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

于 2013年03月02日 22:21, Artem Bityutskiy 写道:
> On Sat, 2013-02-16 at 11:56 +0800, Huang Shijie wrote:
>> On Tue, Feb 12, 2013 at 11:47 PM, Artem Bityutskiy<[email protected]> wrote:
>>> On Mon, 2013-01-28 at 12:57 +0800, Huang Shijie wrote:
>>>> + {"SmartMedia 256MiB 3,3V", {0, 0x71}, 512, 256, 0x4000 },
>>>> + {"SmartMedia 256MiB 3,3V ROM", {0, 0x5b}, 512, 256, 0x4000,
>>>> NAND_ROM},
>>> Sorry for a possibly stupid question, but what does it buy you adding
>>> another "0" to all the entries? I see you add another table, which you
>>> look up if the "traditional" table does not work. Why you need to add
>>> these zeroes?
>> The zeros are for the maf_id.
>>
>> The dev_id is the second byte of the 8-byte id data.
> It does not really make me understand why we add these zeroes, they
> still look useless to me... Would you please be a little more verbose
> about your solution?
>
the 8bytes id data read out by the READ ID command is in the following
order:
byte 0(Maker id): such as 0x98 stands for Toshiba, 0xec stands for
Samsung.
byte 1(device id):
byte 2(used to store the chip number,cell type information):
byte 3(used to store the page size, block size information)
byte 4(used to store the Plane information).
........................


The current code uses the @id to store the device id(byte 1).
But if we use the 8 bytes id data as the keyword, and expand the @id
field to 8byte array,
the device id is the second byte now. All the added zeros are for the
Maker id.
For example,
{"SmartMedia 256MiB 3,3V", {0, 0x71}, 512, 256, 0x4000 },

We really do not use the zeros. All the zeros are added for avoiding the
misunderstanding.
If we do not add the zero, it will looks like:

{"SmartMedia 256MiB 3,3V", {0x71}, 512, 256, 0x4000 },

The device id (0x71) becomes the first byte of 8byte id array, people will treat the 0x71 as the Maker code.


thanks
Huang Shijie

2013-03-04 07:50:29

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

On Mon, 2013-03-04 at 13:57 +0800, Huang Shijie wrote:
> The current code uses the @id to store the device id(byte 1).
> But if we use the 8 bytes id data as the keyword, and expand the @id
> field to 8byte array,
> the device id is the second byte now. All the added zeros are for the

I do not think you need to store the full array of ID's. Device ID's for
all the 4 of above chips are different, which is enough to distinguish
between them.

The only thing you need to add is the OOB size field to 'struct
nand_flash_dev'.

--
Best Regards,
Artem Bityutskiy

2013-03-04 08:07:52

by Huang Shijie

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

于 2013年03月04日 15:50, Artem Bityutskiy 写道:
> On Mon, 2013-03-04 at 13:57 +0800, Huang Shijie wrote:
>> The current code uses the @id to store the device id(byte 1).
>> But if we use the 8 bytes id data as the keyword, and expand the @id
>> field to 8byte array,
>> the device id is the second byte now. All the added zeros are for the
> I do not think you need to store the full array of ID's. Device ID's for
> all the 4 of above chips are different, which is enough to distinguish
> between them.
>
> The only thing you need to add is the OOB size field to 'struct
> nand_flash_dev'.
>
If i only add the oob size field. There will be two items with the same
Device ID in nand_flash_ids table,
one has oob_size, one does not have. such as:

{"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS},
{"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 640}, //OOB
size is 640.


How can i distinguish them? In which case, i choose the item with the
oob_size, and in which case, i choose
the item without the oobsize?

thanks
Huang Shijie





2013-03-04 08:23:36

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

On Mon, 2013-03-04 at 16:08 +0800, Huang Shijie wrote:
> 于 2013年03月04日 15:50, Artem Bityutskiy 写道:
> > On Mon, 2013-03-04 at 13:57 +0800, Huang Shijie wrote:
> >> The current code uses the @id to store the device id(byte 1).
> >> But if we use the 8 bytes id data as the keyword, and expand the @id
> >> field to 8byte array,
> >> the device id is the second byte now. All the added zeros are for the
> > I do not think you need to store the full array of ID's. Device ID's for
> > all the 4 of above chips are different, which is enough to distinguish
> > between them.
> >
> > The only thing you need to add is the OOB size field to 'struct
> > nand_flash_dev'.
> >
> If i only add the oob size field. There will be two items with the same
> Device ID in nand_flash_ids table,
> one has oob_size, one does not have. such as:
>
> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS},

Do you know what is this chip?

> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 640}, //OOB
> size is 640

So there are really 2 different chips with the same device id and
different OOB size? If you had 2 datasheets for me demonstrating this,
I'd be grateful.

--
Best Regards,
Artem Bityutskiy

2013-03-04 08:37:10

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

On Mon, 2013-03-04 at 16:08 +0800, Huang Shijie wrote:
> 于 2013年03月04日 15:50, Artem Bityutskiy 写道:
> > On Mon, 2013-03-04 at 13:57 +0800, Huang Shijie wrote:
> >> The current code uses the @id to store the device id(byte 1).
> >> But if we use the 8 bytes id data as the keyword, and expand the @id
> >> field to 8byte array,
> >> the device id is the second byte now. All the added zeros are for the
> > I do not think you need to store the full array of ID's. Device ID's for
> > all the 4 of above chips are different, which is enough to distinguish
> > between them.
> >
> > The only thing you need to add is the OOB size field to 'struct
> > nand_flash_dev'.
> >
> If i only add the oob size field. There will be two items with the same
> Device ID in nand_flash_ids table,
> one has oob_size, one does not have. such as:
>
> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS},

OK, I guess for this one:

{"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 0},

nand_decode_ext_id() will calculate the OOB size.

> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 640}, //OOB
> size is 640.

And for this one 'nand_decode_ext_id()' will calculate it too, but
_afterwards_ we change OOB size to 640.

Does this sound sane?

--
Best Regards,
Artem Bityutskiy

2013-03-04 08:40:26

by Huang Shijie

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

于 2013年03月04日 16:24, Artem Bityutskiy 写道:
> On Mon, 2013-03-04 at 16:08 +0800, Huang Shijie wrote:
>> 于 2013年03月04日 15:50, Artem Bityutskiy 写道:
>>> On Mon, 2013-03-04 at 13:57 +0800, Huang Shijie wrote:
>>>> The current code uses the @id to store the device id(byte 1).
>>>> But if we use the 8 bytes id data as the keyword, and expand the @id
>>>> field to 8byte array,
>>>> the device id is the second byte now. All the added zeros are for the
>>> I do not think you need to store the full array of ID's. Device ID's for
>>> all the 4 of above chips are different, which is enough to distinguish
>>> between them.
>>>
>>> The only thing you need to add is the OOB size field to 'struct
>>> nand_flash_dev'.
>>>
>> If i only add the oob size field. There will be two items with the same
>> Device ID in nand_flash_ids table,
>> one has oob_size, one does not have. such as:
>>
>> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS},
> Do you know what is this chip?
this maybe not just a nand chip, it may stands for a class of nand chips.
Toshiba may uses this device id, Micron may also uses it.

In other word, this item may stands for many nand chips.
>> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 640}, //OOB
>> size is 640
> So there are really 2 different chips with the same device id and
> different OOB size? If you had 2 datasheets for me demonstrating this,
> I'd be grateful.
Please see the http://www.linux-mtd.infradead.org/nand-data/nanddata.html
The ST's NAND08GW3B2C and Numonyx's NAND08GW3F2B share the same device
id but with the
different oob size.

thanks
Huang Shijie


2013-03-04 08:45:46

by Artem Bityutskiy

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

On Mon, 2013-03-04 at 16:40 +0800, Huang Shijie wrote:
> 于 2013年03月04日 16:24, Artem Bityutskiy 写道:
> > On Mon, 2013-03-04 at 16:08 +0800, Huang Shijie wrote:
> >> 于 2013年03月04日 15:50, Artem Bityutskiy 写道:
> >>> On Mon, 2013-03-04 at 13:57 +0800, Huang Shijie wrote:
> >>>> The current code uses the @id to store the device id(byte 1).
> >>>> But if we use the 8 bytes id data as the keyword, and expand the @id
> >>>> field to 8byte array,
> >>>> the device id is the second byte now. All the added zeros are for the
> >>> I do not think you need to store the full array of ID's. Device ID's for
> >>> all the 4 of above chips are different, which is enough to distinguish
> >>> between them.
> >>>
> >>> The only thing you need to add is the OOB size field to 'struct
> >>> nand_flash_dev'.
> >>>
> >> If i only add the oob size field. There will be two items with the same
> >> Device ID in nand_flash_ids table,
> >> one has oob_size, one does not have. such as:
> >>
> >> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS},
> > Do you know what is this chip?
> this maybe not just a nand chip, it may stands for a class of nand chips.
> Toshiba may uses this device id, Micron may also uses it.
>
> In other word, this item may stands for many nand chips.
> >> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 640}, //OOB
> >> size is 640
> > So there are really 2 different chips with the same device id and
> > different OOB size? If you had 2 datasheets for me demonstrating this,
> > I'd be grateful.
> Please see the http://www.linux-mtd.infradead.org/nand-data/nanddata.html
> The ST's NAND08GW3B2C and Numonyx's NAND08GW3F2B share the same device

Thanks, I forgot we have this great table. BTW, please, do not forget to
update it with information about these 4 chip you are adding,
irrespective of the solution we end up with.

--
Best Regards,
Artem Bityutskiy

2013-03-04 08:57:31

by Huang Shijie

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

于 2013年03月04日 16:37, Artem Bityutskiy 写道:
> On Mon, 2013-03-04 at 16:08 +0800, Huang Shijie wrote:
>> 于 2013年03月04日 15:50, Artem Bityutskiy 写道:
>>> On Mon, 2013-03-04 at 13:57 +0800, Huang Shijie wrote:
>>>> The current code uses the @id to store the device id(byte 1).
>>>> But if we use the 8 bytes id data as the keyword, and expand the @id
>>>> field to 8byte array,
>>>> the device id is the second byte now. All the added zeros are for the
>>> I do not think you need to store the full array of ID's. Device ID's for
>>> all the 4 of above chips are different, which is enough to distinguish
>>> between them.
>>>
>>> The only thing you need to add is the OOB size field to 'struct
>>> nand_flash_dev'.
>>>
>> If i only add the oob size field. There will be two items with the same
>> Device ID in nand_flash_ids table,
>> one has oob_size, one does not have. such as:
>>
>> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS},
> OK, I guess for this one:
>
> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 0},
>
> nand_decode_ext_id() will calculate the OOB size.
>
>> {"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 640}, //OOB
>> size is 640.
> And for this one 'nand_decode_ext_id()' will calculate it too, but
> _afterwards_ we change OOB size to 640.
>
> Does this sound sane?
>
I think not.

The problem is : we can not know which nand_flash_dev item we should use
when the same Device ID occurs.
When we meet a nand whose Device ID is 0xDE, the current code will
select the first one:
{"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 0}

Could you tell me how can we choose the seconde one? The second same
device-id item is
{"NAND 8GIB 3,3V 8-bit", 0xDE, 0, 8192, 0, LP_OPTIONS, 640}

thanks
Huang Shijie








2013-03-04 09:00:00

by Huang Shijie

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

于 2013年03月04日 16:46, Artem Bityutskiy 写道:
> Thanks, I forgot we have this great table. BTW, please, do not forget to
> update it with information about these 4 chip you are adding,
> irrespective of the solution we end up with.
I also want to update the table, but i do not know how to do it.

thanks
Huang Shijie

2013-03-04 19:27:51

by Brian Norris

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

On Mon, Mar 4, 2013 at 12:59 AM, Huang Shijie <[email protected]> wrote:
> ?? 2013??03??04?? 16:46, Artem Bityutskiy д??:
>
>> Thanks, I forgot we have this great table. BTW, please, do not forget to
>> update it with information about these 4 chip you are adding,
>> irrespective of the solution we end up with.
>
> I also want to update the table, but i do not know how to do it.

You can send patches against the mtd-www.git repo. It's just a CSV
text-file, so you'd add a few rows. I'll try to review / ack any
patches.

Brian

2013-08-08 18:38:36

by Brian Norris

[permalink] [raw]
Subject: Re: [PATCH V3 1/3] mtd: add new fields to nand_flash_dev{}

Hi Huang,

For some reason, I just noticed your question here. But I think it's
important to answer.

On 03/04/2013 12:59 AM, Huang Shijie wrote:
> 于 2013年03月04日 16:46, Artem Bityutskiy 写道:
>> Thanks, I forgot we have this great table. BTW, please, do not forget to
>> update it with information about these 4 chip you are adding,
>> irrespective of the solution we end up with.
> I also want to update the table, but i do not know how to do it.

You can submit a patch against mtd-www.git. See:

http://www.linux-mtd.infradead.org/faq/general.html#L_mtdwww

You just need to edit the CSV table under nand-data/nanddata.csv.

Brian