[U-Boot] [PATCH 1/2] mtd: denali: use CONFIG_SYS_NAND_SELF_INIT

Masahiro YAMADA yamada.m at jp.panasonic.com
Wed Nov 12 16:06:55 CET 2014


Hi Scott,


2014-11-12 12:06 GMT+09:00 Scott Wood <scottwood at freescale.com>:
> On Tue, 2014-11-11 at 22:05 +0900, Masahiro Yamada wrote:
>> +     /*
>> +      * If CONFIG_SYS_NAND_SELF_INIT is defined, each driver is responsible
>> +      * for instantiating struct nand_chip, while drivers/mtd/nand/nand.c
>> +      * still provides a "struct mtd_info nand_info" instance.
>> +      */
>> +     denali->mtd = nand_info;
>
> &nand_info[0] would be clearer.

OK, I will fix it.



>> +     /*
>> +      * In the future, these base addresses should be taken from
>> +      * Device Tree or platform data.
>> +      */
>> +     denali->flash_reg = (void  __iomem *)CONFIG_SYS_NAND_REGS_BASE;
>> +     denali->flash_mem = (void  __iomem *)CONFIG_SYS_NAND_DATA_BASE;
>> +
>> +     return denali_init(denali);
>>  }
>>
>> -int board_nand_init(struct nand_chip *chip)
>> +void board_nand_init(void)
>>  {
>> -     return denali_nand_init(chip);
>> +     __board_nand_init();
>>  }
>
> Why do you need this wrapper rather than putting the contents of
> __board_nand_init() here?

I'd like to return -ENOMEM rather than
printing "No memory" without return code.

"int __board_nand_init(void)" is a function where I write my best code
and "void board_nand_init(void)" is a wrapper to adjust it into a frame work.


> Also, you might want to print an error if denali_init() returns an
> error, rather than just discarding it (or, make sure denali_init()
> prints for error conditions, and have it return void).  I realize that
> the existing self-init drivers aren't perfect in this regard. :-)

I will print an error message in v2.



-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list