[U-Boot] [PATCH v4 3/3] omap_hsmmc: Board-specific TWL4030 MMC power initializations

Paul Kocialkowski contact at paulk.fr
Sat Nov 8 22:29:24 CET 2014


Le samedi 08 novembre 2014 à 20:55 +0100, Paul Kocialkowski a écrit :
> Boards using the TWL4030 regulator may not all use the LDOs the same way
> (e.g. MMC2 power can be controlled by another LDO than VMMC2).
> This delegates TWL4030 MMC power initializations to board-specific functions,
> that may still call twl4030_power_mmc_init for the default behavior.
> 
> Signed-off-by: Paul Kocialkowski <contact at paulk.fr>
> ---
>  board/comelit/dig297/dig297.c          | 5 +++++
>  board/compulab/cm_t35/cm_t35.c         | 7 +++++++
>  board/corscience/tricorder/tricorder.c | 7 +++++++
>  board/isee/igep00x0/igep00x0.c         | 7 +++++++
>  board/logicpd/omap3som/omap3logic.c    | 7 +++++++
>  board/logicpd/zoom1/zoom1.c            | 5 +++++
>  board/matrix_vision/mvblx/mvblx.c      | 6 ++++++
>  board/nokia/rx51/rx51.c                | 6 ++++++
>  board/overo/overo.c                    | 7 +++++++
>  board/pandora/pandora.c                | 5 +++++
>  board/technexion/tao3530/tao3530.c     | 7 +++++++
>  board/ti/beagle/beagle.c               | 7 +++++++
>  board/ti/evm/evm.c                     | 7 +++++++
>  board/ti/sdp3430/sdp.c                 | 5 +++++
>  board/timll/devkit8000/devkit8000.c    | 7 +++++++
>  drivers/mmc/omap_hsmmc.c               | 7 +------
>  16 files changed, 96 insertions(+), 6 deletions(-)
> 
> diff --git a/board/comelit/dig297/dig297.c b/board/comelit/dig297/dig297.c
> index 2b826df..9d4c41b 100644
> --- a/board/comelit/dig297/dig297.c
> +++ b/board/comelit/dig297/dig297.c
> @@ -133,6 +133,11 @@ int board_mmc_init(bd_t *bis)
>  {
>  	return omap_mmc_init(0, 0, 0, -1, -1);
>  }
> +
> +void board_mmc_power_init(void)
> +{

I just figured, in the context of the SPL, board_mmc_init will be called
from omap3/board.c instead of the board file, so perhaps it would be
worth adding, in board_mmc_power_init: #ifdef CONFIG_SPL_BUILD and then
checking spl_boot_device to only enable the relevant LDO.

In addition (on v4), board_mmc_init may call omap_mmc_init with a
dev_index that is not used in the board's board_mmc_init, hence not
listed to be enabled on board_mmc_power_init, leaving the MMC device
potentially unpowered in that case. This is why we need to treat SPL
context separately.

This should never actually be a problem as spl_boot_device() will return
what the BootROM booted the SPL from, so it must have already enabled
the relevant LDO. However, I'm using peripheral booting on the Optimus
Black so I hardcode omap3_boot_device to MMC 1/2, so the LDOs are not
enabled at all in my case. And after all, we shouldn't rely on what the
BootROM did or didn't do.

While I'm not suggesting harcoding different behavior should happen on
upstream code, we can imagine that omap3's spl_boot_device could become
more flexible and return something else than what the BootROM booted the
SPL from, hence making that case a valid one.

What do you think?

> +	twl4030_power_mmc_init(0);
> +}
>  #endif
>  
>  #ifdef CONFIG_CMD_NET
> diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
> index 886c723..43463d5 100644
> --- a/board/compulab/cm_t35/cm_t35.c
> +++ b/board/compulab/cm_t35/cm_t35.c
> @@ -382,6 +382,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> +
>  #ifdef CONFIG_SYS_I2C_OMAP34XX
>  /*
>   * Routine: reset_net_chip
> diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c
> index 9e81bf3..0fddf45 100644
> --- a/board/corscience/tricorder/tricorder.c
> +++ b/board/corscience/tricorder/tricorder.c
> @@ -147,6 +147,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> +
>  /*
>   * Routine: get_board_mem_timings
>   * Description: If we use SPL then there is no x-loader nor config header
> diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
> index 7b87cc2..47522f8 100644
> --- a/board/isee/igep00x0/igep00x0.c
> +++ b/board/isee/igep00x0/igep00x0.c
> @@ -150,6 +150,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> +
>  void set_fdt(void)
>  {
>  	switch (gd->bd->bi_arch_number) {
> diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
> index 1fd9f2c..609edf1 100644
> --- a/board/logicpd/omap3som/omap3logic.c
> +++ b/board/logicpd/omap3som/omap3logic.c
> @@ -128,6 +128,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> +
>  #ifdef CONFIG_SMC911X
>  /* GPMC CS1 settings for Logic SOM LV/Torpedo LAN92xx Ethernet chip */
>  static const u32 gpmc_lan92xx_config[] = {
> diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
> index 9ef0026..d39203a 100644
> --- a/board/logicpd/zoom1/zoom1.c
> +++ b/board/logicpd/zoom1/zoom1.c
> @@ -109,6 +109,11 @@ int board_mmc_init(bd_t *bis)
>  {
>  	return omap_mmc_init(0, 0, 0, -1, -1);
>  }
> +
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
>  #endif
>  
>  #ifdef CONFIG_CMD_NET
> diff --git a/board/matrix_vision/mvblx/mvblx.c b/board/matrix_vision/mvblx/mvblx.c
> index a69359f..c9d615b 100644
> --- a/board/matrix_vision/mvblx/mvblx.c
> +++ b/board/matrix_vision/mvblx/mvblx.c
> @@ -94,6 +94,12 @@ int board_mmc_init(bd_t *bis)
>  	omap_mmc_init(1, 0, 0, -1, -1);
>  	return 0;
>  }
> +
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +	twl4030_power_mmc_init(1);
> +}
>  #endif
>  
>  #if defined(CONFIG_CMD_NET)
> diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
> index c2e07db..b6b8ad6 100644
> --- a/board/nokia/rx51/rx51.c
> +++ b/board/nokia/rx51/rx51.c
> @@ -659,3 +659,9 @@ int board_mmc_init(bd_t *bis)
>  	omap_mmc_init(1, 0, 0, -1, -1);
>  	return 0;
>  }
> +
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +	twl4030_power_mmc_init(1);
> +}
> diff --git a/board/overo/overo.c b/board/overo/overo.c
> index dfb8602..b7f85e7 100644
> --- a/board/overo/overo.c
> +++ b/board/overo/overo.c
> @@ -493,6 +493,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> +
>  #if defined(CONFIG_USB_EHCI) &&  !defined(CONFIG_SPL_BUILD)
>  static struct omap_usbhs_board_data usbhs_bdata = {
>  	.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
> diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
> index 146dcea..59b5a7e 100644
> --- a/board/pandora/pandora.c
> +++ b/board/pandora/pandora.c
> @@ -126,4 +126,9 @@ int board_mmc_init(bd_t *bis)
>  {
>  	return omap_mmc_init(0, 0, 0, -1, -1);
>  }
> +
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
>  #endif
> diff --git a/board/technexion/tao3530/tao3530.c b/board/technexion/tao3530/tao3530.c
> index 44a8240..744ff44 100644
> --- a/board/technexion/tao3530/tao3530.c
> +++ b/board/technexion/tao3530/tao3530.c
> @@ -188,6 +188,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> +
>  #if defined(CONFIG_USB_EHCI) && !defined(CONFIG_SPL_BUILD)
>  /* Call usb_stop() before starting the kernel */
>  void show_boot_progress(int val)
> diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
> index 4c5e381..7b37fbe 100644
> --- a/board/ti/beagle/beagle.c
> +++ b/board/ti/beagle/beagle.c
> @@ -534,6 +534,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> +
>  #if defined(CONFIG_USB_EHCI) && !defined(CONFIG_SPL_BUILD)
>  /* Call usb_stop() before starting the kernel */
>  void show_boot_progress(int val)
> diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
> index 81dd081..47c023d 100644
> --- a/board/ti/evm/evm.c
> +++ b/board/ti/evm/evm.c
> @@ -264,3 +264,10 @@ int board_mmc_init(bd_t *bis)
>  	return omap_mmc_init(0, 0, 0, -1, -1);
>  }
>  #endif
> +
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> diff --git a/board/ti/sdp3430/sdp.c b/board/ti/sdp3430/sdp.c
> index 957940d..7171363 100644
> --- a/board/ti/sdp3430/sdp.c
> +++ b/board/ti/sdp3430/sdp.c
> @@ -195,4 +195,9 @@ int board_mmc_init(bd_t *bis)
>  {
>  	return omap_mmc_init(0, 0, 0, -1, -1);
>  }
> +
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
>  #endif
> diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
> index bcbee73..b978044 100644
> --- a/board/timll/devkit8000/devkit8000.c
> +++ b/board/timll/devkit8000/devkit8000.c
> @@ -124,6 +124,13 @@ int board_mmc_init(bd_t *bis)
>  }
>  #endif
>  
> +#if defined(CONFIG_GENERIC_MMC)
> +void board_mmc_power_init(void)
> +{
> +	twl4030_power_mmc_init(0);
> +}
> +#endif
> +
>  #if defined(CONFIG_DRIVER_DM9000) & !defined(CONFIG_SPL_BUILD)
>  /*
>   * Routine: board_eth_init
> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
> index ae04939..3fc4698 100644
> --- a/drivers/mmc/omap_hsmmc.c
> +++ b/drivers/mmc/omap_hsmmc.c
> @@ -135,12 +135,7 @@ static unsigned char mmc_board_init(struct mmc *mmc)
>  	pbias_lite = readl(&t2_base->pbias_lite);
>  	pbias_lite &= ~(PBIASLITEPWRDNZ1 | PBIASLITEPWRDNZ0);
>  	writel(pbias_lite, &t2_base->pbias_lite);
> -#endif
> -#if defined(CONFIG_TWL4030_POWER)
> -	twl4030_power_mmc_init(0);
> -	twl4030_power_mmc_init(1);
> -#endif
> -#if defined(CONFIG_OMAP34XX)
> +
>  	writel(pbias_lite | PBIASLITEPWRDNZ1 |
>  		PBIASSPEEDCTRL0 | PBIASLITEPWRDNZ0,
>  		&t2_base->pbias_lite);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141108/b5e07526/attachment.pgp>


More information about the U-Boot mailing list