diff mbox

[U-Boot,v4,2/3] twl4030: device-index-specific MMC power initializations, common ramp-up delay

Message ID 1415476547-17896-3-git-send-email-contact@paulk.fr
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Paul Kocialkowski Nov. 8, 2014, 7:55 p.m. UTC
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(-)

Comments

Tom Rini Nov. 10, 2014, 6:46 p.m. UTC | #1
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>
Tom Rini Dec. 5, 2014, 2:52 p.m. UTC | #2
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!
diff mbox

Patch

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