Skip to contentSkip to conversation

FSL_ESDHC: Make the base address configurable at runtime

PATCH New Marek Vasut 3 participants 5 messages Nov 14, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 FSL_ESDHC: Make the base address configurable at runtime

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.

---
 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(-)
arch/arm/cpu/armv7/mx5/soc.c +1 -1
index 7c7a565..4a73491 100644
@@ -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
arch/powerpc/cpu/mpc83xx/cpu.c +1 -1
index 6635109..4739edd 100644
@@ -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
arch/powerpc/cpu/mpc85xx/cpu.c +1 -1
index fc5d951..7bc9147 100644
@@ -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
board/freescale/mpc837xemds/mpc837xemds.c +1 -1
index 51dd692..41dce43 100644
@@ -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
 
board/freescale/mpc837xerdb/mpc837xerdb.c +1 -1
index d636796..8c3cf7b 100644
@@ -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
 
board/freescale/mpc8569mds/mpc8569mds.c +1 -1
index 743e712..31e8f1f 100644
@@ -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)
drivers/mmc/fsl_esdhc.c +2 -2
index a368fe6..a078bce 100644
@@ -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);
 }
 
include/fsl_esdhc.h +2 -2
index 477bbd7..e78d25c 100644
@@ -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 */
 
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 1/1 FSL_ESDHC: Make the base address configurable at runtime

Quoted 5 lines · On Sunday 14 November 2010 17:01:02 Marek Vasut wrote:

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.

Just discussed this with Stefano, I guess this one will be a no-go, nevermind.

Quoted 128 lines
---
 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(-)
arch/arm/cpu/armv7/mx5/soc.c +1 -1
index 7c7a565..4a73491 100644
@@ -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
(quoted diff) +0 -0

b/arch/powerpc/cpu/mpc83xx/cpu.c index 6635109..4739edd 100644

arch/powerpc/cpu/mpc83xx/cpu.c +1 -1
@@ -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
(quoted diff) +0 -0

b/arch/powerpc/cpu/mpc85xx/cpu.c index fc5d951..7bc9147 100644

arch/powerpc/cpu/mpc85xx/cpu.c +1 -1
@@ -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
(quoted diff) +0 -0

b/board/freescale/mpc837xemds/mpc837xemds.c index 51dd692..41dce43 100644

board/freescale/mpc837xemds/mpc837xemds.c +1 -1
@@ -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
 
(quoted diff) +0 -0

b/board/freescale/mpc837xerdb/mpc837xerdb.c index d636796..8c3cf7b 100644

board/freescale/mpc837xerdb/mpc837xerdb.c +1 -1
@@ -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
 
(quoted diff) +0 -0

b/board/freescale/mpc8569mds/mpc8569mds.c index 743e712..31e8f1f 100644

board/freescale/mpc8569mds/mpc8569mds.c +1 -1
@@ -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)
drivers/mmc/fsl_esdhc.c +2 -2
index a368fe6..a078bce 100644
@@ -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);
 }
 
include/fsl_esdhc.h +2 -3
index 477bbd7..e78d25c 100644
@@ -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 */
#2 lore raw

PATCH 1/1 FSL_ESDHC: Make the base address configurable at runtime

Dear Marek Vasut,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 5 lines · On Sunday 14 November 2010 17:01:02 Marek Vasut wrote:

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.

Just discussed this with Stefano, I guess this one will be a no-go, nevermind.

Does that mean we shall wait for a resubmit?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The reasonable man adapts himself to the world; the unreasonable  one
persists  in  trying  to  adapt  the  world to himself. Therefore all
progress depends on the unreasonable man."      - George Bernard Shaw
#3 lore raw

PATCH 1/1 FSL_ESDHC: Make the base address configurable at runtime

Quoted 10 lines · On Sunday 14 November 2010 17:59:09 Wolfgang Denk wrote:

Dear Marek Vasut,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines · On Sunday 14 November 2010 17:01:02 Marek Vasut wrote:

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.

Quoted 4 lines
Quoted 2 lines

Just discussed this with Stefano, I guess this one will be a no-go, nevermind.

Does that mean we shall wait for a resubmit?

Hi Wolfgang,

it means Stefano explained to me he already tried pushing in such a patch and the patch was rejected. Therefore, I assume you should ignore this patch.

Cheers

Quoted 5 lines

Best regards,

Wolfgang Denk

#4 lore raw

PATCH 1/1 FSL_ESDHC: Make the base address configurable at runtime

Quoted 4 lines · Marek Vasut

Hi Wolfgang,

it means Stefano explained to me he already tried pushing in such a patch and the patch was rejected. Therefore, I assume you should ignore this patch.

To complete the explanation: there is already a way to make address configurable and we do not need to change fsl_esdhc_mmc_init.

The fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg) was added to the driver when I pushed the MX51 stuff, allowing us to set up the base address, Not only, the struct fsl_esdhc_cfg could be extended in the future, if we will need it (but not at the moment, as I know).

This way is already used by the mx51evk (both SDHC controller are supported) and by the vision2 (only one SDHC controller is supported).

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================