Skip to contentSkip to conversation

NAND or OneNAND flash autodection changes for OMAP3 specific files

PATCH New Manikandan Pillai 2 participants 2 messages Mar 23, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 NAND or OneNAND flash autodection changes for OMAP3 specific files

---
 cpu/arm_cortexa8/omap3/board.c    |   13 ++++
 cpu/arm_cortexa8/omap3/mem.c      |  139 +++++++++++++++++++++++++++++++++++-
 cpu/arm_cortexa8/omap3/sys_info.c |   27 +++++++-
 include/configs/omap3_evm.h       |    3 +-
 4 files changed, 174 insertions(+), 8 deletions(-)
cpu/arm_cortexa8/omap3/board.c +13 -0
index 7bb3e28..ba0eec6 100644
@@ -313,6 +313,19 @@ void abort(void)
 {
 }
 
+/******************************************************************************
+ * Routine: print_board_info
+ * Description: Displays cpu and memory information for the board
+ *****************************************************************************/
+void print_board_info(void)
+{
+	u32 btype;
+
+	btype = get_board_type();
+
+	display_board_info(btype);
+}
+
 #ifdef CONFIG_NAND_OMAP_GPMC
 /******************************************************************************
  * OMAP3 specific command to switch between NAND HW and SW ecc
cpu/arm_cortexa8/omap3/mem.c +135 -4

197 lines not on this page · raw message

cpu/arm_cortexa8/omap3/sys_info.c +24 -3
index 28a1020..86cc95f 100644
@@ -36,6 +36,14 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_csx_t *)GPMC_CONFIG_CS0_BASE;
 static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
 static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
 
+#if defined(CONFIG_CMD_NAND)
+extern u8 is_nand;
+#endif
+
+#if defined(CONFIG_CMD_ONENAND)
+extern u8 is_onenand;
+#endif
+
 /******************************************
  * get_cpu_type(void) - extract cpu info
  ******************************************/
@@ -208,9 +216,22 @@ void display_board_info(u32 btype)
 
 
 	printf("OMAP%s-%s rev %d, CPU-OPP2 L3-165MHz\n", cpu_s,
-	       sec_s, get_cpu_rev());
-	printf("%s + %s/%s\n", sysinfo.board_string,
-	       mem_s, sysinfo.nand_string);
+		sec_s, get_cpu_rev());
+#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
+		printf("%s + %s/", sysinfo.board_string,
+			mem_s);
+#if defined(CONFIG_CMD_NAND)
+	if (is_nand)
+		printf("%s\n", "NAND");
+#endif
+#if defined(CONFIG_CMD_ONENAND)
+	if (is_onenand)
+		printf("%s\n", "ONENAND");
+#endif
+#else
+		printf("%s + %s/%s\n", sysinfo.board_string,
+			mem_s, sysinfo.nand_string);
+#endif
 
 }
 
include/configs/omap3_evm.h +2 -1
index f484f14..37e7ad3 100644
@@ -106,6 +106,7 @@
 
 #define CONFIG_CMD_I2C		/* I2C serial bus support	*/
 #define CONFIG_CMD_MMC		/* MMC support			*/
+#define	CONFIG_CMD_ONENAND	/* ONENAND support		*/
 #define CONFIG_CMD_NAND		/* NAND support			*/
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_PING
@@ -271,7 +272,7 @@
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_FLASH_BASE
 #define CONFIG_SYS_ONENAND_BASE		ONENAND_MAP
 
-#define CONFIG_ENV_IS_IN_NAND		1
+#define	CONFIG_ENV_IS_RUNTIME_SEL	1
 #define ONENAND_ENV_OFFSET		0x260000 /* environment starts here */
 #define SMNAND_ENV_OFFSET		0x260000 /* environment starts here */
 
Signature · 1 line
1.5.6
#1 lore raw

PATCH 2/2 NAND or OneNAND flash autodection changes for OMAP3 specific files

Quoted 4 lines · Manikandan Pillai
cpu/arm_cortexa8/omap3/mem.c +0 -0
index 3cc22c4..6808eea 100644

[snip]

cpu/arm_cortexa8/omap3/mem.c unsigned int boot_flash_sec; · line 54

Quoted 9 lines
cpu/arm_cortexa8/omap3/mem.c +9 -0
+#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
+extern env_t *env_ptr;
+extern char *nand_env_name_spec;
+extern char *onenand_env_name_spec;
+extern env_t *nand_env_ptr;
+extern env_t *onenand_env_ptr;
+
+extern void onenand_init(void);
+extern int nand_scan_ident(struct mtd_info *mtd, int maxchips);

Platform code should not have this level of knowledge of common internals. There should be one function call that platform code can make to tell the rest of u-boot where the flash is.

Quoted 2 lines

#if defined(CONFIG_CMD_NAND)
+u32 is_nand;

This is not an acceptable global variable name.

Quoted 1 line

+extern nand_info_t nand_info[2];

And what if that is not the size of nand_info? At least use CONFIG_SYS_MAX_NAND_DEVICE.

cpu/arm_cortexa8/omap3/mem.c gpmc_csx_t *onenand_cs_base; · line 110

Quoted 6 lines
cpu/arm_cortexa8/omap3/mem.c +6 -0
+#if defined(CONFIG_ENV_IS_RUNTIME_SEL)
+char *env_name_spec;
+env_get_char_spec_p env_get_char_spec;
+env_init_p env_init;
+saveenv_p saveenv;
+env_relocate_spec_p env_relocate_spec;

So now the common internals are not just referenced in platform code, but they reside there?

-Scott