public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] FSL_ESDHC: Make the base address configurable at runtime
@ 2010-11-14 16:01 Marek Vasut
  2010-11-14 16:35 ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2010-11-14 16:01 UTC (permalink / raw)
  To: u-boot

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@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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] FSL_ESDHC: Make the base address configurable at runtime
  2010-11-14 16:01 [U-Boot] [PATCH] FSL_ESDHC: Make the base address configurable at runtime Marek Vasut
@ 2010-11-14 16:35 ` Marek Vasut
  2010-11-14 16:59   ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2010-11-14 16:35 UTC (permalink / raw)
  To: u-boot

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.
> 
> Signed-off-by: Marek Vasut <marek.vasut@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 */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] FSL_ESDHC: Make the base address configurable at runtime
  2010-11-14 16:35 ` Marek Vasut
@ 2010-11-14 16:59   ` Wolfgang Denk
  2010-11-14 17:01     ` Marek Vasut
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2010-11-14 16:59 UTC (permalink / raw)
  To: u-boot

Dear Marek Vasut,

In message <201011141735.30504.marek.vasut@gmail.com> you wrote:
> 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

-- 
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] FSL_ESDHC: Make the base address configurable at runtime
  2010-11-14 16:59   ` Wolfgang Denk
@ 2010-11-14 17:01     ` Marek Vasut
  2010-11-14 17:08       ` Stefano Babic
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Vasut @ 2010-11-14 17:01 UTC (permalink / raw)
  To: u-boot

On Sunday 14 November 2010 17:59:09 Wolfgang Denk wrote:
> Dear Marek Vasut,
> 
> In message <201011141735.30504.marek.vasut@gmail.com> you wrote:
> > 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?

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
> 
> 
> Best regards,
> 
> Wolfgang Denk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] FSL_ESDHC: Make the base address configurable at runtime
  2010-11-14 17:01     ` Marek Vasut
@ 2010-11-14 17:08       ` Stefano Babic
  0 siblings, 0 replies; 5+ messages in thread
From: Stefano Babic @ 2010-11-14 17:08 UTC (permalink / raw)
  To: u-boot

On 11/14/2010 06:01 PM, Marek Vasut wrote:

> 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

-- 
=====================================================================
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
=====================================================================

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-14 17:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-14 16:01 [U-Boot] [PATCH] FSL_ESDHC: Make the base address configurable at runtime Marek Vasut
2010-11-14 16:35 ` Marek Vasut
2010-11-14 16:59   ` Wolfgang Denk
2010-11-14 17:01     ` Marek Vasut
2010-11-14 17:08       ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox