[U-Boot] NAND crazy behavior - mtd->size changing without clear reason

Otavio Salvador otavio at ossystems.com.br
Thu Sep 26 01:52:11 CEST 2013


On Wed, Sep 25, 2013 at 8:07 PM, Scott Wood <scottwood at freescale.com> wrote:
> On Wed, 2013-09-25 at 09:26 -0300, Otavio Salvador wrote:
>> Hello,
>>
>> I am using a K9LBG08U0D-PCB0 NAND IC with the i.MX28EVK board.
>>
>> I tested it with 2013.04 and current imx tree tip. Both same results.
>>
>> I am having problems to use mtdparts with it as it thinks the NAND has
>> size as 0 when it gets there. /However/ it properly detects it
>> initially and the mtd->size variable is magically changes on the fly.
>>
>> I added following patch in my local tree to debug the issue:
>>
>> diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
>> index 4cf4c1c..03faf10 100644
>> --- a/drivers/mtd/nand/nand.c
>> +++ b/drivers/mtd/nand/nand.c
>> @@ -66,11 +66,14 @@ int nand_register(int devnum)
>>         add_mtd_device(mtd);
>>  #endif
>>
>> +       printf("%s (%d) mtd->size: %d\n", __FUNCTION__, __LINE__, mtd->size);
>>         total_nand_size += mtd->size / 1024;
>> +       printf("%s (%d) mtd->size: %d\n", __FUNCTION__, __LINE__, mtd->size);
>
> Pay attention to compiler warnings...  mtd->size is uint64_t.

Great but this does not explain the value changing, does it?

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750


More information about the U-Boot mailing list