[U-Boot] [PATCH V4 09/12] mmc: omap_hsmmc: add mmc1 pbias, ldo1

Lokesh Vutla lokeshvutla at ti.com
Wed Jun 5 08:26:20 CEST 2013


From: Balaji T K <balajitk at ti.com>

add dra mmc pbias support and ldo1 power on

Signed-off-by: Balaji T K <balajitk at ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla at ti.com>
---
Changes since V3:
* Addressed comments from Tom

 arch/arm/include/asm/arch-omap5/omap.h |    2 +-
 drivers/mmc/omap_hsmmc.c               |   26 +++++++++++-----------
 drivers/power/palmas.c                 |   37 ++++++++++++++++++++++++++------
 include/configs/omap5_common.h         |    4 ++++
 include/configs/omap5_uevm.h           |    5 -----
 include/palmas.h                       |   12 +++++++++--
 6 files changed, 59 insertions(+), 27 deletions(-)

diff --git a/arch/arm/include/asm/arch-omap5/omap.h b/arch/arm/include/asm/arch-omap5/omap.h
index 9010666..abf6837 100644
--- a/arch/arm/include/asm/arch-omap5/omap.h
+++ b/arch/arm/include/asm/arch-omap5/omap.h
@@ -106,9 +106,9 @@
 /* CONTROL_EFUSE_2 */
 #define CONTROL_EFUSE_2_NMOS_PMOS_PTV_CODE_1		0x00ffc000
 
+#define SDCARD_BIAS_PWRDNZ				(1 << 27)
 #define SDCARD_PWRDNZ					(1 << 26)
 #define SDCARD_BIAS_HIZ_MODE				(1 << 25)
-#define SDCARD_BIAS_PWRDNZ				(1 << 22)
 #define SDCARD_PBIASLITE_VMODE				(1 << 21)
 
 #ifndef __ASSEMBLY__
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index afdfa88..3d3281e 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -113,23 +113,25 @@ static void omap5_pbias_config(struct mmc *mmc)
 	u32 value = 0;
 
 	value = readl((*ctrl)->control_pbias);
-	value &= ~(SDCARD_PWRDNZ | SDCARD_BIAS_PWRDNZ);
-	value |= SDCARD_BIAS_HIZ_MODE;
+	value &= ~SDCARD_PWRDNZ;
+	writel(value, (*ctrl)->control_pbias);
+	udelay(10); /* wait 10 us */
+	value &= ~SDCARD_BIAS_PWRDNZ;
 	writel(value, (*ctrl)->control_pbias);
 
-	palmas_mmc1_poweron_ldo();
+#if defined(CONFIG_DRA7XX)
+	tps659038_mmc1_poweron_ldo1();
+#else
+	palmas_mmc1_poweron_ldo9();
+#endif
 
 	value = readl((*ctrl)->control_pbias);
-	value &= ~SDCARD_BIAS_HIZ_MODE;
-	value |= SDCARD_PBIASLITE_VMODE | SDCARD_PWRDNZ | SDCARD_BIAS_PWRDNZ;
+	value |= SDCARD_BIAS_PWRDNZ;
 	writel(value, (*ctrl)->control_pbias);
-
-	value = readl((*ctrl)->control_pbias);
-	if (value & (1 << 23)) {
-		value &= ~(SDCARD_PWRDNZ | SDCARD_BIAS_PWRDNZ);
-		value |= SDCARD_BIAS_HIZ_MODE;
-		writel(value, (*ctrl)->control_pbias);
-	}
+	udelay(150); /* wait 150 us */
+	value |= SDCARD_PWRDNZ;
+	writel(value, (*ctrl)->control_pbias);
+	udelay(150); /* wait 150 us */
 }
 #endif
 
diff --git a/drivers/power/palmas.c b/drivers/power/palmas.c
index 09c832d..71c4bdc 100644
--- a/drivers/power/palmas.c
+++ b/drivers/power/palmas.c
@@ -28,23 +28,46 @@ void palmas_init_settings(void)
 	return;
 }
 
-int palmas_mmc1_poweron_ldo(void)
+int palmas_mmc1_poweron_ldo9(void)
 {
 	u8 val = 0;
 
 	/* set LDO9 TWL6035 to 3V */
-	val = 0x2b; /* (3 -.9)*28 +1 */
+	val = LDO_VOLT_3V0;
 
-	if (palmas_i2c_write_u8(0x48, LDO9_VOLTAGE, val)) {
-		printf("twl6035: could not set LDO9 voltage.\n");
+	if (palmas_i2c_write_u8(TWL603X_CHIP_P1, LDO9_VOLTAGE, val)) {
+		printf("twl603x: could not set LDO9 voltage.\n");
 		return 1;
 	}
 
 	/* TURN ON LDO9 */
-	val = LDO_ON | LDO_MODE_SLEEP | LDO_MODE_ACTIVE;
+	val = LDO_MODE_SLEEP | LDO_MODE_ACTIVE;
 
-	if (palmas_i2c_write_u8(0x48, LDO9_CTRL, val)) {
-		printf("twl6035: could not turn on LDO9.\n");
+	if (palmas_i2c_write_u8(TWL603X_CHIP_P1, LDO9_CTRL, val)) {
+		printf("twl603x: could not turn on LDO9.\n");
+		return 1;
+	}
+
+	return 0;
+}
+
+int tps659038_mmc1_poweron_ldo1(void)
+{
+	u8 val = 0;
+
+	/* set LDO1 to 3V */
+	val = LDO_VOLT_3V0;
+
+	if (palmas_i2c_write_u8(TPS659038_CHIP_P1, LDO1_VOLTAGE, val)) {
+		printf("tps659038: could not set LDO1 voltage\n");
+		return 1;
+	}
+
+	/* TURN ON LDO1 */
+	val = LDO_MODE_SLEEP | LDO_MODE_ACTIVE;
+
+	if (palmas_i2c_write_u8(TPS659038_CHIP_P1, LDO1_CTRL, val)) {
+		printf("tps659038: could not turn on LDO1\n");
 		return 1;
 	}
 
diff --git a/include/configs/omap5_common.h b/include/configs/omap5_common.h
index 83b91d1..ddf2ad4 100644
--- a/include/configs/omap5_common.h
+++ b/include/configs/omap5_common.h
@@ -238,6 +238,10 @@
 #define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
 #endif
 
+#ifndef CONFIG_SPL_BUILD
+#define CONFIG_PALMAS_POWER
+#endif
+
 /* Defines for SPL */
 #define CONFIG_SPL
 #define CONFIG_SPL_FRAMEWORK
diff --git a/include/configs/omap5_uevm.h b/include/configs/omap5_uevm.h
index ba81e30..f4a2d31 100644
--- a/include/configs/omap5_uevm.h
+++ b/include/configs/omap5_uevm.h
@@ -39,11 +39,6 @@
 #define CONFIG_SYS_NS16550_COM3		UART3_BASE
 #define CONFIG_BAUDRATE			115200
 
-/* TWL6035 */
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_PALMAS_POWER
-#endif
-
 /* MMC ENV related defines */
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV		1	/* SLOT2: eMMC(1) */
diff --git a/include/palmas.h b/include/palmas.h
index 3b18589..0361705 100644
--- a/include/palmas.h
+++ b/include/palmas.h
@@ -27,7 +27,12 @@
 #include <i2c.h>
 
 /* I2C chip addresses */
-#define PALMAS_CHIP_ADDR	0x48
+#define TWL603X_CHIP_P1		0x48	/* Page 1 */
+#define TPS659038_CHIP_P1	0x58	/* Page 1 */
+
+/* LDO1_CTRL */
+#define LDO1_CTRL		0x50
+#define LDO1_VOLTAGE		0x51
 
 /* 0x1XY translates to page 1, register address 0xXY */
 #define LDO9_CTRL		0x60
@@ -38,6 +43,8 @@
 #define LDO_MODE_SLEEP		(1 << 2)
 #define LDO_MODE_ACTIVE		(1 << 0)
 
+/* LDO Volatge */
+#define LDO_VOLT_3V0		0x2b
 /*
  * Functions to read and write from TPS659038/TWL6035/TWL6037
  * or other Palmas family of TI PMICs
@@ -53,6 +60,7 @@ static inline int palmas_i2c_read_u8(u8 chip_no, u8 reg, u8 *val)
 }
 
 void palmas_init_settings(void);
-int palmas_mmc1_poweron_ldo(void);
+int palmas_mmc1_poweron_ldo9(void);
+int tps659038_mmc1_poweron_ldo1(void);
 
 #endif /* PALMAS_H */
-- 
1.7.9.5



More information about the U-Boot mailing list