From: Balaji T K <balaj...@ti.com> add dra mmc pbias support and ldo1 power on
Signed-off-by: Balaji T K <balaj...@ti.com> Signed-off-by: Lokesh Vutla <lokeshvu...@ti.com> --- Changes since V2: * Addressed comments from lpo...@mm-sol.com * Rebased on top of http://patchwork.ozlabs.org/patch/244103/ arch/arm/include/asm/arch-omap5/omap.h | 2 +- drivers/mmc/omap_hsmmc.c | 26 ++++++++++++++------------ drivers/power/palmas.c | 25 ++++++++++++++++++++++++- include/configs/omap5_common.h | 4 ++++ include/configs/omap5_uevm.h | 5 ----- include/palmas.h | 8 +++++++- 6 files changed, 50 insertions(+), 20 deletions(-) diff --git a/arch/arm/include/asm/arch-omap5/omap.h b/arch/arm/include/asm/arch-omap5/omap.h index 8105c14..1076494 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 1f9bd7e..b94ed5d 100644 --- a/drivers/power/palmas.c +++ b/drivers/power/palmas.c @@ -37,7 +37,7 @@ void palmas_init_settings(void) #endif } -int palmas_mmc1_poweron_ldo(void) +int palmas_mmc1_poweron_ldo9(void) { u8 val = 0; @@ -56,6 +56,29 @@ int palmas_mmc1_poweron_ldo(void) 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 = RSC_MODE_SLEEP | RSC_MODE_ACTIVE; + + if (palmas_i2c_write_u8(TPS659038_CHIP_P1, LDO1_CTRL, val)) { + printf("tps659038: could not turn on LDO1\n"); + return 1; + } + + return 0; +} + /* * On some hardware the SD card socket and LDO9_IN are powered by an * external 3.3 V regulator, while the output of LDO9 delivers VDDS_SDCARD 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 7becb97..2355801 100644 --- a/include/palmas.h +++ b/include/palmas.h @@ -30,9 +30,14 @@ #define PALMAS_CHIP_P1 0x48 /* Page 1 */ #define PALMAS_CHIP_P2 0x49 /* Page 2 */ #define PALMAS_CHIP_P3 0x4a /* Page 3 */ +#define TPS659038_CHIP_P1 0x58 /* Page 1 */ /* Page 1 registers (0x1XY translates to page 1, reg addr 0xXY): */ +/* LDO1_CTRL */ +#define LDO1_CTRL 0x50 +#define LDO1_VOLTAGE 0x51 + /* LDO9_CTRL */ #define LDO9_CTRL 0x60 #define LDO9_VOLTAGE 0x61 @@ -119,7 +124,8 @@ 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); int palmas_mmc1_set_ldo9(u8 vsel); int palmas_audio_power(u8 on); int palmas_enable_bb_charge(u8 bb_fields); -- 1.7.9.5 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot