[U-Boot] [PATCH resend V2 1/3] mtd: nand: mxs support oobsize bigger than 512

Peng Fan b51431 at freescale.com
Sat Aug 1 03:15:00 CEST 2015


On Fri, Jul 31, 2015 at 12:07:50PM -0500, Scott Wood wrote:
>On Tue, 2015-07-21 at 16:15 +0800, Peng Fan wrote:
>> If ecc chunk data size is 512 and oobsize is bigger than 512, there is
>> a chance that block_mark_bit_offset conflicts with bch ecc area.
>> 
>> The following graph is modified from kernel gpmi-nand.c driver with
>> each data block 512 bytes. We can see that Block Mark conflicts with
>> ecc area from bch view. We can enlarge the ecc chunk size to avoid
>> this problem to those oobsize which is larger than 512.
>
>Enlarge it by how much?  What does the layout look like in that case?

Enlarge it to 1024 bytes.
In normal case the Block Mark bit should locates at the data part, but
not at the ECC area.
You can take the following as an example.

   |                          P                                    |
   |<------------------------------------------------------------->|
   |                                                               |
   |                                          (Block Mark)         |
   |                      P'                         |           | |   |
   |<----------------------------------------------->|     D     | | O'|
   |                                                 |<--------->| |<->|
   V                                                 V           V V   V
   +---+---------------------------+-+---------------------------+-+---+
   | M |   data                    |E|   data             data   |E|   |
   +---+---------------------------+-+---------------------------+-+---+
                                                    ^                  ^
                                                    |         O        |
                                                    |<---------------->|


>
>> 
>>    |                          P                                        |
>>    |<----------------------------------------------------------------->|
>>    |                                                                   |
>>    |                                                (Block Mark)       |
>>    |                      P'                             |           | |   |
>>    |<--------------------------------------------------->|     D     | | O'|
>>    |                                                     |<--------->| |<->|
>>    V                                                     V           V V   V
>>    +---+--------------+-+--------------+-+--------------+-+----------+-+---+
>>    | M |   data       |E|   data       |E|   data       |E|   data   |E|   |
>>    +---+--------------+-+--------------+-+--------------+-+----------+-+---+
>>                                                         ^                  ^
>>                                                         |         O        |
>>                                                         |<---------------->|
>> 
>>        P : the page size for BCH module.
>>        E : The ECC strength.
>>        G : the length of Galois Field.
>>        N : The chunk count of per page.
>>        M : the metasize of per page.
>>        C : the ecc chunk size, aka the "data" above.
>>        P': the nand chip's page size.
>>        O : the nand chip's oob size.
>>        O': the free oob.
>
>"D" is in the diagram but not the key.  "G", "N", and "C" are in the key but 
>not the diagram.
C is ecc chunk data size, same the data area. Here it is 512 bytes. 
N is chunk count. for exmaple page size is 2048 bytes, ecc chunk data size is 512 bytes, then N is 2048/512.
G is the Galois Field, its value is 13 or 14. The should be got from reference mannual.
D is in the digram , but not the key. I think it is enougth to show why this patch is done.

I put the digram here to show that Block Mark may conflicts with ECC area,
and this is wrong, we need to find a way to avoid this. And the way is
to enlarge the ecc chunk data size from 512 to 1024 bytes.

I did not put the formula here. The keys is same to keys in kernel gpmi-nand.c.

      The formula for P is :     

                  E * G * N
             P = ------------ + P' + M
                      8

The position of block mark moves forward in the ECC-based view of page, and the delta is:                                           

                   E * G * (N - 1)
             D = (---------------- + M)
                          8 

I think there is no need to put the formula in commit msg. Also, to explain D is not relevant to this patch.

>
>What is "the metasize of per page"?

10 bytes.

Peng.

>
>-Scott
>

-- 


More information about the U-Boot mailing list