[U-Boot] [PATCH v2 3/5] at91: atmel_nand: Update driver to support Programmable Multibit ECC controller

Josh Wu josh.wu at atmel.com
Wed Aug 22 05:26:50 CEST 2012


Hi, Scott

On 8/22/2012 4:39 AM, Scott Wood wrote:
> On 08/21/2012 05:37 AM, Josh Wu wrote:
>> Hi, Andreas
>>
>> On 8/17/2012 5:24 PM, Andreas Bießmann wrote:
>>> can you please add some README entry describing these new config
>>> parameters?
>>> Namely CONFIG_ATMEL_NAND_HW_PMECC, CONFIG_PMECC_CAP,
>>> CONFIG_PMECC_SECTOR_SIZE (can't this be derived from some already
>>> available NAND information?) and CONFIG_PMECC_INDEX_TABLE_OFFSET.
>> OK, I will add a README file to explain all the parameters.
>> this CONFIG_PMECC_SECTOR_SIZE means how many bytes to generate out PMECC
>> code. It only can be 512 and 1024.
>> So for a nand chip whose page size is 2048, if CONFIG_PMECC_SECTOR_SIZE
>> is set as 512, then PMECC will generate PMECC code for each 512 bytes.
>>
>> I think it cannot be derived from nand information.

I think I am not make me clear in previous email. let me try again :)

For the PMECC hardware, it support to read/write one data page of nand 
in one step. The size of the data page should be multiple(max is 8) of 
PMECC sector. The PMECC sector can only be 512 or 1024.

So the PMECC can read/write max 8192 bytes (max data page size: 8 x 
1024) in one step. And generate the ecc bytes (8 x 4) for this page if 
the error correct capability is 2 bits.

But the internal thing is those ecc bytes is split into 8 parts and each 
part is for corresponding sector.

> So this is basically nand->ecc.size?

I don't think nand->ecc.size is the CONFIG_PMECC_SECTOR_SIZE. Since for 
my understanding, the ecc.size is the data bytes per ecc step. In my 
code, PMECC can read/write one page in one step.
So I set nand->ecc.size to the page size.

> While this can't be directly read
> from the chip, usually there's a convention for a given type of NAND
> chip on a given controller.  Do you really need to support both 512 and
> 1024 for any single chip?

hmm. So maybe I can set default PMECC sector size to 512 if nand flash 
page is smaller than 4096 (8x512) bytes. And set it to 1024 only when 
nand flash page is larger than 4096.
But in other side, if CONFIG_PMECC_SECTOR_SIZE is defined, then driver 
will use it.

>
> Why do you set nand->ecc.size to mtd->writesize if that isn't the actual
> ECC chunk size?

As mentioned in above, the ecc.size is the data bytes per ecc step. In 
PMECC code, PMECC can read/write one page in one step.
So I set nand->ecc.size to the page size not the actual inside ECC chunk 
size: CONFIG_PMECC_SECTOR_SIZE

> -Scott
>
>
Thanks.
Best Regards,
Josh Wu


More information about the U-Boot mailing list