[U-Boot] [PATCH V12 04/14] devkit8000/spl: init GPMC for dm9000 in SPL

Stefano Babic sbabic at denx.de
Wed Jan 4 09:25:08 CET 2012


From: Simon Schwarz <simonschwarzcor at googlemail.com>

Linux crashes if the GPMC isn't configured for the dm9000.

Signed-off-by: Simon Schwarz <simonschwarzcor at gmail.com>
CC: Tom Rini <tom.rini at gmail.com>
CC: Stefano Babic <sbabic at denx.de>
CC: Wolfgang Denk <wd at denx.de>
---
V2 changes:
nothing

V3 changes:
nothing

V4 changes:
noting

V5 changes:
nothing

V6 changes:
nothing

V7 changes:
FIX multiline comment style
	(http://article.gmane.org/gmane.comp.boot-loaders.u-boot/113500)

V8 changes:
REBASE on u-boot

V9 changes:
nothing

V10 changes:
use enable_gpmc_cs_config to config the GPMC for dm9000

 arch/arm/include/asm/omap_common.h  |    2 +
 board/timll/devkit8000/devkit8000.c |   39 +++++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 1ec651b..62200e5 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -87,6 +87,8 @@ u32 omap_boot_mode(void);
 /* SPL common function s*/
 void spl_parse_image_header(const struct image_header *header);
 void omap_rev_string(char *omap_rev_string);
+int spl_uboot_key(void);
+void spl_board_prepare_for_linux(void);
 
 /* NAND SPL functions */
 void spl_nand_load_image(void);
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index b06aab6..05de3c1 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -63,6 +63,24 @@ int board_init(void)
 	return 0;
 }
 
+static u32 gpmc_net_config[GPMC_MAX_REG] = {
+	NET_GPMC_CONFIG1,
+	NET_GPMC_CONFIG2,
+	NET_GPMC_CONFIG3,
+	NET_GPMC_CONFIG4,
+	NET_GPMC_CONFIG5,
+	NET_GPMC_CONFIG6,
+	NET_GPMC_CONFIG7,
+};
+
+
+/* Configure GPMC registers for DM9000 */
+static void gpmc_dm9000_config(void)
+{
+	enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[6],
+		CONFIG_DM9000_BASE, GPMC_SIZE_16M);
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -81,14 +99,7 @@ int misc_init_r(void)
 #endif
 
 #ifdef CONFIG_DRIVER_DM9000
-	/* Configure GPMC registers for DM9000 */
-	writel(NET_GPMC_CONFIG1, &gpmc_cfg->cs[6].config1);
-	writel(NET_GPMC_CONFIG2, &gpmc_cfg->cs[6].config2);
-	writel(NET_GPMC_CONFIG3, &gpmc_cfg->cs[6].config3);
-	writel(NET_GPMC_CONFIG4, &gpmc_cfg->cs[6].config4);
-	writel(NET_GPMC_CONFIG5, &gpmc_cfg->cs[6].config5);
-	writel(NET_GPMC_CONFIG6, &gpmc_cfg->cs[6].config6);
-	writel(NET_GPMC_CONFIG7, &gpmc_cfg->cs[6].config7);
+	gpmc_dm9000_config();
 
 	/* Use OMAP DIE_ID as MAC address */
 	if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
@@ -139,6 +150,18 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
+#ifdef CONFIG_SPL_OS_BOOT
+/*
+ * Do board specific preperation before SPL
+ * Linux boot
+ */
+void spl_board_prepare_for_linux(void)
+{
+	gpmc_dm9000_config();
+}
+
+#endif
+
 /*
  * Routine: get_board_mem_timings
  * Description: If we use SPL then there is no x-loader nor config header
-- 
1.7.5.4



More information about the U-Boot mailing list