[U-Boot] [PATCH] FSL_ESDHC: Make the base address configurable at runtime

Marek Vasut marek.vasut at gmail.com
Sun Nov 14 17:01:02 CET 2010


This allows -after reimplementation of board_mmc_init() function- to set up the
base address of the eSDHC controller at runtime. This is useful on iMX515 board
I have, where there are two controllers and on different revisions of the board,
only one of them is used. The board revision can be detected on runtime.

Signed-off-by: Marek Vasut <marek.vasut at gmail.com>
---
 arch/arm/cpu/armv7/mx5/soc.c              |    2 +-
 arch/powerpc/cpu/mpc83xx/cpu.c            |    2 +-
 arch/powerpc/cpu/mpc85xx/cpu.c            |    2 +-
 board/freescale/mpc837xemds/mpc837xemds.c |    2 +-
 board/freescale/mpc837xerdb/mpc837xerdb.c |    2 +-
 board/freescale/mpc8569mds/mpc8569mds.c   |    2 +-
 drivers/mmc/fsl_esdhc.c                   |    4 ++--
 include/fsl_esdhc.h                       |    4 ++--
 8 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c
index 7c7a565..4a73491 100644
--- a/arch/arm/cpu/armv7/mx5/soc.c
+++ b/arch/arm/cpu/armv7/mx5/soc.c
@@ -107,7 +107,7 @@ int cpu_eth_init(bd_t *bis)
 int cpu_mmc_init(bd_t *bis)
 {
 #ifdef CONFIG_FSL_ESDHC
-	return fsl_esdhc_mmc_init(bis);
+	return fsl_esdhc_mmc_init(bis, CONFIG_SYS_FSL_ESDHC_ADDR);
 #else
 	return 0;
 #endif
diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
index 6635109..4739edd 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu.c
@@ -234,7 +234,7 @@ int cpu_eth_init(bd_t *bis)
 int cpu_mmc_init(bd_t *bis)
 {
 #ifdef CONFIG_FSL_ESDHC
-	return fsl_esdhc_mmc_init(bis);
+	return fsl_esdhc_mmc_init(bis, CONFIG_SYS_FSL_ESDHC_ADDR);
 #else
 	return 0;
 #endif
diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index fc5d951..7bc9147 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -269,7 +269,7 @@ reset_85xx_watchdog(void)
 int cpu_mmc_init(bd_t *bis)
 {
 #ifdef CONFIG_FSL_ESDHC
-	return fsl_esdhc_mmc_init(bis);
+	return fsl_esdhc_mmc_init(bis, CONFIG_SYS_FSL_ESDHC_ADDR);
 #else
 	return 0;
 #endif
diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c
index 51dd692..41dce43 100644
--- a/board/freescale/mpc837xemds/mpc837xemds.c
+++ b/board/freescale/mpc837xemds/mpc837xemds.c
@@ -79,7 +79,7 @@ int board_mmc_init(bd_t *bd)
 	clrsetbits_be32(&im->sysconf.sicrh, SICRH_GPIO2_E | SICRH_SPI,
 			SICRH_GPIO2_E_SD | SICRH_SPI_SD);
 
-	return fsl_esdhc_mmc_init(bd);
+	return fsl_esdhc_mmc_init(bd, CONFIG_SYS_FSL_ESDHC_ADDR);
 }
 #endif
 
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index d636796..8c3cf7b 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -179,7 +179,7 @@ int board_mmc_init(bd_t *bd)
 	clrsetbits_be32(&im->sysconf.sicrl, SICRL_USB_B, SICRL_USB_B_SD);
 	clrsetbits_be32(&im->sysconf.sicrh, SICRH_SPI, SICRH_SPI_SD);
 
-	return fsl_esdhc_mmc_init(bd);
+	return fsl_esdhc_mmc_init(bd, CONFIG_SYS_FSL_ESDHC_ADDR);
 }
 #endif
 
diff --git a/board/freescale/mpc8569mds/mpc8569mds.c b/board/freescale/mpc8569mds/mpc8569mds.c
index 743e712..31e8f1f 100644
--- a/board/freescale/mpc8569mds/mpc8569mds.c
+++ b/board/freescale/mpc8569mds/mpc8569mds.c
@@ -485,7 +485,7 @@ int board_mmc_init(bd_t *bd)
 	/* Mux I2C2 (and optionally UART0) signals to eSDHC. */
 	setbits_8(&bcsr[6], bcsr6);
 
-	return fsl_esdhc_mmc_init(bd);
+	return fsl_esdhc_mmc_init(bd, CONFIG_SYS_FSL_ESDHC_ADDR);
 }
 
 static void fdt_board_fixup_esdhc(void *blob, bd_t *bd)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index a368fe6..a078bce 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -484,13 +484,13 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)
 	return 0;
 }
 
-int fsl_esdhc_mmc_init(bd_t *bis)
+int fsl_esdhc_mmc_init(bd_t *bis, uint32_t base)
 {
 	struct fsl_esdhc_cfg *cfg;
 
 	cfg = malloc(sizeof(struct fsl_esdhc_cfg));
 	memset(cfg, 0, sizeof(struct fsl_esdhc_cfg));
-	cfg->esdhc_base = CONFIG_SYS_FSL_ESDHC_ADDR;
+	cfg->esdhc_base = base;
 	return fsl_esdhc_initialize(bis, cfg);
 }
 
diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h
index 477bbd7..e78d25c 100644
--- a/include/fsl_esdhc.h
+++ b/include/fsl_esdhc.h
@@ -173,11 +173,11 @@ struct fsl_esdhc_cfg {
 #endif
 
 #ifdef CONFIG_FSL_ESDHC
-int fsl_esdhc_mmc_init(bd_t *bis);
+int fsl_esdhc_mmc_init(bd_t *bis, uint32_t base);
 int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg);
 void fdt_fixup_esdhc(void *blob, bd_t *bd);
 #else
-static inline int fsl_esdhc_mmc_init(bd_t *bis) { return -ENOSYS; }
+static inline int fsl_esdhc_mmc_init(bd_t *bis, uint32_t base) { return -ENOSYS; }
 static inline void fdt_fixup_esdhc(void *blob, bd_t *bd) {}
 #endif /* CONFIG_FSL_ESDHC */
 
-- 
1.7.2.3



More information about the U-Boot mailing list