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

Hong Xu hongxu.cn at gmail.com
Fri Aug 8 04:06:03 CEST 2008


Sometimes, board module needs to know some information about the NAND
chip e.g. page size to continue it's initialization. This short patch
give board module a chance to continue its initialization after the
NAND chip is scaned.

best regards,

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")));
+
 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



More information about the U-Boot mailing list