Skip to content
  • Peng Fan's avatar
    mtd: nand: mxs support oobsize bigger than 512 · 63b29d80
    Peng Fan authored
    
    
    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.
    
       |                          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.
    
    Signed-off-by: default avatarPeng Fan <Peng.Fan@freescale.com>
    Reviewed-by: default avatarMarek Vasut <marex@denx.de>
    Tested-By: default avatarTim Harvey <tharvey@gateworks.com>
    63b29d80