[U-Boot] [PATCH v4 0/3] mmc: Board-specific MMC power initializations

Changelog:
v4: * Switch board_mmc_power_init to void since there is no return value check * Add dev_index to twl4030_power_mmc_init, common ramp-up delay * twl4030_power_mmc_init call with the relevant dev_index on boards * No check against CONFIG_TWL4030_POWER (an obvious linker error is better than a strange runtime error)
v3: Changes to make v2 apply on master
v2: Implement board_mmc_power_init instead of define

Some devices may use non-standard combinations of regulators to power MMC: this allows these devices to provide a board-specific MMC power init function to set everything up in their own way.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- drivers/mmc/mmc.c | 7 +++++++ include/mmc.h | 1 + 2 files changed, 8 insertions(+)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 44a4feb..8436bc7 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -1277,6 +1277,11 @@ block_dev_desc_t *mmc_get_dev(int dev) } #endif
+/* board-specific MMC power initializations. */ +__weak void board_mmc_power_init(void) +{ +} + int mmc_start_init(struct mmc *mmc) { int err; @@ -1293,6 +1298,8 @@ int mmc_start_init(struct mmc *mmc) if (mmc->has_init) return 0;
+ board_mmc_power_init(); + /* made sure it's not NULL earlier */ err = mmc->cfg->ops->init(mmc);
diff --git a/include/mmc.h b/include/mmc.h index d74a190..adffc35 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -385,6 +385,7 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode); int mmc_legacy_init(int verbose); #endif
+void board_mmc_power_init(void); int board_mmc_init(bd_t *bis); int cpu_mmc_init(bd_t *bis); int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr);

On Sat, Nov 08, 2014 at 08:55:45PM +0100, Paul Kocialkowski wrote:
Some devices may use non-standard combinations of regulators to power MMC: this allows these devices to provide a board-specific MMC power init function to set everything up in their own way.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Reviewed-by: Tom Rini trini@ti.com

On Sat, Nov 08, 2014 at 08:55:45PM +0100, Paul Kocialkowski wrote:
Some devices may use non-standard combinations of regulators to power MMC: this allows these devices to provide a board-specific MMC power init function to set everything up in their own way.
Signed-off-by: Paul Kocialkowski contact@paulk.fr Reviewed-by: Tom Rini trini@ti.com
Applied to u-boot-ti/master, thanks!

Not every device has multiple MMC slots available, so it makes sense to enable only the required LDOs for the available slots. Generic code in omap_hsmmc will enable both VMMC1 and VMMC2, in doubt.
Signed-off-by: Paul Kocialkowski contact@paulk.fr --- drivers/mmc/omap_hsmmc.c | 4 ++-- drivers/power/twl4030.c | 28 +++++++++++++++++----------- include/twl4030.h | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index ffb5284..ae04939 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -137,8 +137,8 @@ static unsigned char mmc_board_init(struct mmc *mmc) writel(pbias_lite, &t2_base->pbias_lite); #endif #if defined(CONFIG_TWL4030_POWER) - twl4030_power_mmc_init(); - mdelay(100); /* ramp-up delay from Linux code */ + twl4030_power_mmc_init(0); + twl4030_power_mmc_init(1); #endif #if defined(CONFIG_OMAP34XX) writel(pbias_lite | PBIASLITEPWRDNZ1 | diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c index e578ae6..7f1fdd1 100644 --- a/drivers/power/twl4030.c +++ b/drivers/power/twl4030.c @@ -91,17 +91,23 @@ void twl4030_power_init(void) TWL4030_PM_RECEIVER_DEV_GRP_P1); }
-void twl4030_power_mmc_init(void) +void twl4030_power_mmc_init(int dev_index) { - /* Set VMMC1 to 3.15 Volts */ - twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VMMC1_DEDICATED, - TWL4030_PM_RECEIVER_VMMC1_VSEL_32, - TWL4030_PM_RECEIVER_VMMC1_DEV_GRP, - TWL4030_PM_RECEIVER_DEV_GRP_P1); + if (dev_index == 0) { + /* Set VMMC1 to 3.15 Volts */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VMMC1_DEDICATED, + TWL4030_PM_RECEIVER_VMMC1_VSEL_32, + TWL4030_PM_RECEIVER_VMMC1_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1);
- /* Set VMMC2 to 3.15 Volts */ - twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VMMC2_DEDICATED, - TWL4030_PM_RECEIVER_VMMC2_VSEL_32, - TWL4030_PM_RECEIVER_VMMC2_DEV_GRP, - TWL4030_PM_RECEIVER_DEV_GRP_P1); + mdelay(100); /* ramp-up delay from Linux code */ + } else if (dev_index == 1) { + /* Set VMMC2 to 3.15 Volts */ + twl4030_pmrecv_vsel_cfg(TWL4030_PM_RECEIVER_VMMC2_DEDICATED, + TWL4030_PM_RECEIVER_VMMC2_VSEL_32, + TWL4030_PM_RECEIVER_VMMC2_DEV_GRP, + TWL4030_PM_RECEIVER_DEV_GRP_P1); + + mdelay(100); /* ramp-up delay from Linux code */ + } } diff --git a/include/twl4030.h b/include/twl4030.h index f33cd1e..50f8da8 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -651,7 +651,7 @@ void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val, /* For initializing power device */ void twl4030_power_init(void); /* For initializing mmc power */ -void twl4030_power_mmc_init(void); +void twl4030_power_mmc_init(int dev_index);
/* * LED

On Sat, Nov 08, 2014 at 08:55:46PM +0100, Paul Kocialkowski wrote:
Not every device has multiple MMC slots available, so it makes sense to enable only the required LDOs for the available slots. Generic code in omap_hsmmc will enable both VMMC1 and VMMC2, in doubt.
Signed-off-by: Paul Kocialkowski contact@paulk.fr
Reviewed-by: Tom Rini trini@ti.com

On Sat, Nov 08, 2014 at 08:55:46PM +0100, Paul Kocialkowski wrote:
Not every device has multiple MMC slots available, so it makes sense to enable only the required LDOs for the available slots. Generic code in omap_hsmmc will enable both VMMC1 and VMMC2, in doubt.
Signed-off-by: Paul Kocialkowski contact@paulk.fr Reviewed-by: Tom Rini trini@ti.com
Applied to u-boot-ti/master, thanks!

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@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) +{ + 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);

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

On Sat, Nov 08, 2014 at 10:29:24PM +0100, Paul Kocialkowski wrote:
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@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.
If we get to this point we can do the same thing we do for board_mmc_init which is have one in say arch/arm/cpu/armv7/omap-common/boot-common.c that checks spl_boot_device()

Le lundi 10 novembre 2014 à 13:46 -0500, Tom Rini a écrit :
On Sat, Nov 08, 2014 at 10:29:24PM +0100, Paul Kocialkowski wrote:
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@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.
If we get to this point we can do the same thing we do for board_mmc_init which is have one in say arch/arm/cpu/armv7/omap-common/boot-common.c that checks spl_boot_device()
That wouldn't work for my use case, on the Optimus Black, where regulators are used in a non-standard way. The whole point of this to me is to not have platform-common code to handle MMC regulators, because the way those are wired to MMC devices is not the same for each platform, but is instead board-specific.
Is there any objection to making a v5 that takes the SPL context in account on each of those boards?
Thanks

On Tue, Nov 11, 2014 at 12:57:45PM +0100, Paul Kocialkowski wrote:
Le lundi 10 novembre 2014 à 13:46 -0500, Tom Rini a écrit :
On Sat, Nov 08, 2014 at 10:29:24PM +0100, Paul Kocialkowski wrote:
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@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.
If we get to this point we can do the same thing we do for board_mmc_init which is have one in say arch/arm/cpu/armv7/omap-common/boot-common.c that checks spl_boot_device()
That wouldn't work for my use case, on the Optimus Black, where regulators are used in a non-standard way. The whole point of this to me is to not have platform-common code to handle MMC regulators, because the way those are wired to MMC devices is not the same for each platform, but is instead board-specific.
Is there any objection to making a v5 that takes the SPL context in account on each of those boards?
Oh that's right, hmm. I think the answer is that for the SPL case where we _need_ to do something different, the board can already provide that and do it, with v4. The general case is that ROM will have done what needs doing for MMCSD load and in your case you can always go and turn it on in the board code.

Le mardi 11 novembre 2014 à 07:33 -0500, Tom Rini a écrit :
On Tue, Nov 11, 2014 at 12:57:45PM +0100, Paul Kocialkowski wrote:
Le lundi 10 novembre 2014 à 13:46 -0500, Tom Rini a écrit :
On Sat, Nov 08, 2014 at 10:29:24PM +0100, Paul Kocialkowski wrote:
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@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.
If we get to this point we can do the same thing we do for board_mmc_init which is have one in say arch/arm/cpu/armv7/omap-common/boot-common.c that checks spl_boot_device()
That wouldn't work for my use case, on the Optimus Black, where regulators are used in a non-standard way. The whole point of this to me is to not have platform-common code to handle MMC regulators, because the way those are wired to MMC devices is not the same for each platform, but is instead board-specific.
Is there any objection to making a v5 that takes the SPL context in account on each of those boards?
Oh that's right, hmm. I think the answer is that for the SPL case where we _need_ to do something different, the board can already provide that and do it, with v4. The general case is that ROM will have done what needs doing for MMCSD load and in your case you can always go and turn it on in the board code.
That should indeed cover most use cases. So let's let boards enable all the regulators they may need for MMC in board_mmc_power_init.
I'm good with v4 then!

On Sat, Nov 08, 2014 at 08:55:47PM +0100, Paul Kocialkowski wrote:
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@paulk.fr
Reviewed-by: Tom Rini trini@ti.com

On Sat, Nov 08, 2014 at 08:55:47PM +0100, Paul Kocialkowski wrote:
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@paulk.fr Reviewed-by: Tom Rini trini@ti.com
Applied to u-boot-ti/master, thanks!
participants (2)
-
Paul Kocialkowski
-
Tom Rini