[U-Boot] [PATCH] [NAND] Add board_nand_init_tail to give board module a chance to init after NAND chip is scaned.

Wolfgang Denk wd at denx.de
Fri Aug 8 11:27:56 CEST 2008


In message <1516faed0808071906g118e3bf1ted560f41ad4dec12 at mail.gmail.com> you wrote:
> 
> diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
> index e44470e..f795d2e 100644
> --- a/drivers/mtd/nand/nand.c
> +++ b/drivers/mtd/nand/nand.c
> @@ -41,6 +41,10 @@ static const char default_nand_name[] = "nand";
> 
>  extern int board_nand_init(struct nand_chip *nand);
> 
> +int __board_nand_init_tail(struct nand_chip *nand) { return 0; }
> +int inline board_nand_init_tail (struct nand_chip *) __attribute__
> +	((weak, alias("__board_nand_init_tail")));
> +

I don't like the "_tail" name. Maybe board_nand_init2() or so would be
better?

>  static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
>  			   ulong base_addr)
>  {
> @@ -48,7 +52,7 @@ static void nand_init_chip(struct mtd_info *mtd,
> struct nand_chip *nand,
> 
>  	nand->IO_ADDR_R = nand->IO_ADDR_W = (void  __iomem *)base_addr;
>  	if (board_nand_init(nand) == 0) {
> -		if (nand_scan(mtd, 1) == 0) {
> +		if ((nand_scan(mtd, 1) == 0) && (board_nand_init_tail(nand) == 0)) {
>  			if (!mtd->name)
>  				mtd->name = (char *)default_nand_name;
>  		} else

The logic is becoming pretty intricate. Maybe you can rewrite this to
be more readable?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The rule on staying alive as a program manager is to give 'em a  num-
ber or give 'em a date, but never give 'em both at once.



More information about the U-Boot mailing list