[U-Boot] [PATCH 8/8] 83xx: Add eSDHC support on 8379 EMDS board

Andy Fleming afleming at freescale.com
Fri Jan 30 22:45:44 CET 2009


Signed-off-by: Andy Fleming <afleming at freescale.com>
---
 board/freescale/mpc837xemds/mpc837xemds.c |   19 +++++++++++++++++++
 cpu/mpc83xx/cpu.c                         |   14 ++++++++++++++
 include/asm-ppc/immap_83xx.h              |    2 ++
 include/configs/MPC837XEMDS.h             |   15 +++++++++++++++
 4 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c
index 156d808..299dfab 100644
--- a/board/freescale/mpc837xemds/mpc837xemds.c
+++ b/board/freescale/mpc837xemds/mpc837xemds.c
@@ -23,6 +23,7 @@
 
 int board_early_init_f(void)
 {
+	struct immap __iomem *im = (struct immap __iomem *)CONFIG_SYS_IMMR;
 	u8 *bcsr = (u8 *)CONFIG_SYS_BCSR;
 
 	/* Enable flash write */
@@ -30,6 +31,24 @@ int board_early_init_f(void)
 	/* Clear all of the interrupt of BCSR */
 	bcsr[0xe] = 0xff;
 
+#ifdef CONFIG_MMC
+       bcsr[0xc] |= 0x4c;
+
+#define SICRL_USB_B_MASK       0x30000000
+#define SICRL_USB_B_SD         0x20000000
+#define SICRH_GPIO2_E_MASK     0x00000c00
+#define SICRH_GPIO2_E_SD       0x00000800
+#define SICRH_SPI_MASK         0x00000003
+#define SICRH_SPI_SD           0x00000001
+
+       im->sysconf.sicrl &= ~SICRL_USB_B_MASK;
+       im->sysconf.sicrl |= SICRL_USB_B_SD;
+
+       im->sysconf.sicrh &= ~(SICRH_GPIO2_E_MASK | SICRH_SPI_MASK);
+       im->sysconf.sicrh |= SICRH_GPIO2_E_SD | SICRH_SPI_SD;
+
+#endif
+
 #ifdef CONFIG_FSL_SERDES
 	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	u32 spridr = in_be32(&immr->sysconf.spridr);
diff --git a/cpu/mpc83xx/cpu.c b/cpu/mpc83xx/cpu.c
index 587fca3..9e0a05d 100644
--- a/cpu/mpc83xx/cpu.c
+++ b/cpu/mpc83xx/cpu.c
@@ -34,6 +34,7 @@
 #include <libfdt.h>
 #include <tsec.h>
 #include <netdev.h>
+#include <fsl_esdhc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -385,3 +386,16 @@ int cpu_eth_init(bd_t *bis)
 #endif
 	return 0;
 }
+
+/*
+ * Initializes on-chip MMC controllers.
+ * to override, implement board_mmc_init()
+ */
+int cpu_mmc_init(bd_t *bis)
+{
+#ifdef CONFIG_FSL_ESDHC
+	return fsl_esdhc_mmc_init(bis);
+#else
+	return 0;
+#endif
+}
diff --git a/include/asm-ppc/immap_83xx.h b/include/asm-ppc/immap_83xx.h
index 77c09db..7b847f8 100644
--- a/include/asm-ppc/immap_83xx.h
+++ b/include/asm-ppc/immap_83xx.h
@@ -895,4 +895,6 @@ typedef struct immap {
 } immap_t;
 #endif
 
+#define CONFIG_SYS_MPC83xx_ESDHC_OFFSET	(0x2e000)
+#define CONFIG_SYS_MPC83xx_ESDHC_ADDR	(CONFIG_SYS_IMMR + CONFIG_SYS_MPC83xx_ESDHC_OFFSET)
 #endif				/* __IMMAP_83xx__ */
diff --git a/include/configs/MPC837XEMDS.h b/include/configs/MPC837XEMDS.h
index 0dd6ef5..da50c14 100644
--- a/include/configs/MPC837XEMDS.h
+++ b/include/configs/MPC837XEMDS.h
@@ -319,6 +319,9 @@
 #define CONFIG_OF_BOARD_SETUP	1
 #define CONFIG_OF_STDOUT_VIA_ALIAS	1
 
+#define CONFIG_SYS_64BIT_STRTOUL		1
+#define CONFIG_SYS_64BIT_VSPRINTF		1
+
 /* I2C */
 #define CONFIG_HARD_I2C		/* I2C with hardware support */
 #undef CONFIG_SOFT_I2C		/* I2C bit-banged */
@@ -502,6 +505,18 @@ extern int board_pci_host_broken(void);
 
 #undef CONFIG_WATCHDOG		/* watchdog disabled */
 
+#define CONFIG_MMC     1
+
+#ifdef CONFIG_MMC
+#define CONFIG_FSL_ESDHC
+#define CFG_FSL_ESDHC_ADDR	CONFIG_SYS_MPC83xx_ESDHC_ADDR
+#define CONFIG_CMD_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
+#define CONFIG_DOS_PARTITION
+#endif
+
 /*
  * Miscellaneous configurable options
  */
-- 
1.5.4.GIT



More information about the U-Boot mailing list