[U-Boot] [PATCH 3/9] nand: add a hw specific subcommand to the nand command.

Heiko Schocher hs at denx.de
Sat Jul 16 12:06:44 CEST 2011


Actually this is needed for coming up davinci dm368 cam_enc_4xx
board support. There we need two different nand read/write
functions, because the RBL uses different nand read/write
functions than u-boot.

Another place where such a command is used is:
arch/arm/cpu/armv7/omap3/board.c: do_switch_ecc()

Maybe this should be fixed?

Signed-off-by: Heiko Schocher <hs at denx.de>
cc: Scott Wood <scottwood at freescale.com>
---
 README            |    2 ++
 common/cmd_nand.c |    8 ++++++++
 include/nand.h    |    3 +++
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/README b/README
index 1e2d4d3..647e10b 100644
--- a/README
+++ b/README
@@ -705,6 +705,8 @@ The following options need to be configured:
 		CONFIG_CMD_MII		* MII utility commands
 		CONFIG_CMD_MTDPARTS	* MTD partition support
 		CONFIG_CMD_NAND		* NAND support
+		CONFIG_CMD_NAND_HWFUNC	  add to the nand commando a hw specific
+					  subcommand.
 		CONFIG_CMD_NET		  bootp, tftpboot, rarpboot
 		CONFIG_CMD_PCA953X	* PCA953x I2C gpio commands
 		CONFIG_CMD_PCA953X_INFO	* PCA953x I2C gpio info command
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 8c56802..416d2c7 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -689,6 +689,10 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 		return 0;
 	}
 #endif
+#ifdef CONFIG_CMD_NAND_HWFUNC
+	if (strcmp(cmd, "hwfunc") == 0)
+		return nand_hwfunc(argc - 2, argv + 2);
+#endif
 
 usage:
 	return cmd_usage(cmdtp);
@@ -739,6 +743,10 @@ U_BOOT_CMD(
 	"nand env.oob set off|partition - set enviromnent offset\n"
 	"nand env.oob get - get environment offset"
 #endif
+#ifdef CONFIG_CMD_NAND_HWFUNC
+	"\n"
+	"nand hwfunc " CONFIG_CMD_NAND_HWFUNC "\n"
+#endif
 );
 
 static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
diff --git a/include/nand.h b/include/nand.h
index 8d94b5c..06b86f8 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -138,6 +138,9 @@ void board_nand_select_device(struct nand_chip *nand, int chip);
 
 __attribute__((noreturn)) void nand_boot(void);
 
+#ifdef CONFIG_CMD_NAND_HWFUNC
+int nand_hwfunc(int argc, char * const argv[]);
+#endif
 #endif
 
 #ifdef CONFIG_ENV_OFFSET_OOB
-- 
1.7.6



More information about the U-Boot mailing list