[U-Boot] [PATCH 26/28] SPEAr : smi_init moved to board_init

Vipin KUMAR vipin.kumar at st.com
Wed Jul 14 07:10:02 CEST 2010


From: Vipin KUMAR <vipin.kumar at st.com>

flash reading is required earlier than flash_init is called since the env_init
is called before flash_init. This makes the smi_init necessary before env_init
being called

This patch adds these changes

Signed-off-by: Vipin Kumar <vipin.kumar at st.com>
---
 board/spear/common/spr_misc.c           |    4 ++++
 board/spear/spear1300/spear1300.c       |    4 ++++
 drivers/mtd/st_smi.c                    |    4 ++--
 {drivers => include/linux}/mtd/st_smi.h |    2 ++
 4 files changed, 12 insertions(+), 2 deletions(-)
 rename {drivers => include/linux}/mtd/st_smi.h (99%)

diff --git a/board/spear/common/spr_misc.c b/board/spear/common/spr_misc.c
index 1148984..b1ee6b1 100644
--- a/board/spear/common/spr_misc.c
+++ b/board/spear/common/spr_misc.c
@@ -25,6 +25,7 @@
 #include <command.h>
 #include <i2c.h>
 #include <net.h>
+#include <linux/mtd/st_smi.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_emi.h>
@@ -164,6 +165,9 @@ int spear_board_init(ulong mach_type)
 		       sizeof(chip->version));
 	}
 
+#if defined(CONFIG_ST_SMI)
+	smi_init();
+#endif
 #ifdef CONFIG_SPEAR_EMI
 	spear_emi_init();
 #endif
diff --git a/board/spear/spear1300/spear1300.c b/board/spear/spear1300/spear1300.c
index 64fb880..6b904eb 100644
--- a/board/spear/spear1300/spear1300.c
+++ b/board/spear/spear1300/spear1300.c
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <netdev.h>
 #include <nand.h>
+#include <linux/mtd/st_smi.h>
 #include <linux/mtd/fsmc_nand.h>
 #include <asm/arch/hardware.h>
 
@@ -34,6 +35,9 @@ int board_init(void)
 	gd->bd->bi_arch_number = MACH_TYPE_SPEAR1300;
 	gd->bd->bi_boot_params = CONFIG_BOOT_PARAMS_ADDR;
 
+#if defined(CONFIG_ST_SMI)
+	smi_init();
+#endif
 	return 0;
 }
 
diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index 5193c1c..4766cf2 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -24,10 +24,10 @@
 #include <common.h>
 #include <flash.h>
 #include <linux/err.h>
+#include <linux/mtd/st_smi.h>
 
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
-#include "st_smi.h"
 
 #if !defined(CONFIG_SYS_NO_FLASH)
 
@@ -246,7 +246,7 @@ static int smi_write_enable(int bank)
  *
  * SMI initialization routine. Sets SMI control register1.
  */
-static void smi_init(void)
+void smi_init(void)
 {
 	/* Setting the fast mode values. SMI working at 166/4 = 41.5 MHz */
 	writel(HOLD1 | FAST_MODE | BANK_EN | DSEL_TIME | PRESCAL4,
diff --git a/drivers/mtd/st_smi.h b/include/linux/mtd/st_smi.h
similarity index 99%
rename from drivers/mtd/st_smi.h
rename to include/linux/mtd/st_smi.h
index afab546..04f81ea 100644
--- a/drivers/mtd/st_smi.h
+++ b/include/linux/mtd/st_smi.h
@@ -112,4 +112,6 @@ struct flash_dev {
 #define XFER_FINISH_TOUT	15	/* xfer finish timeout(in ms) */
 #define WMODE_TOUT		15	/* write enable timeout(in ms) */
 
+extern void smi_init(void);
+
 #endif
-- 
1.6.0.2



More information about the U-Boot mailing list