From b4b060066f158a461780dfb06a042bb6351a2b3c Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Wed, 23 Nov 2016 13:25:28 +0530 Subject: ARM: OMAP4+: Add support for getting pbias info from board Palmas driver assumes it is always TPS659xx regulator on all DRA7xx based boards to enable mmc regulator. This is not true always like in case of DRA71x-evm. So get this information based on the board. Signed-off-by: Lokesh Vutla Signed-off-by: Vignesh R Signed-off-by: Nishanth Menon Reviewed-by: Tom Rini [trini: Delete omap4_vmmc_pbias_config from omap_hsmmc.c] Signed-off-by: Tom Rini --- arch/arm/include/asm/omap_mmc.h | 2 +- arch/arm/mach-omap2/omap4/hwinit.c | 13 +++++++++++++ arch/arm/mach-omap2/omap5/hwinit.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) (limited to 'arch/arm') diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h index b69d0731e1..f2bf645b33 100644 --- a/arch/arm/include/asm/omap_mmc.h +++ b/arch/arm/include/asm/omap_mmc.h @@ -167,5 +167,5 @@ struct hsmmc { int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio, int wp_gpio); - +void vmmc_pbias_config(uint voltage); #endif /* OMAP_MMC_H_ */ diff --git a/arch/arm/mach-omap2/omap4/hwinit.c b/arch/arm/mach-omap2/omap4/hwinit.c index 7c6638ca80..67ab1ccd75 100644 --- a/arch/arm/mach-omap2/omap4/hwinit.c +++ b/arch/arm/mach-omap2/omap4/hwinit.c @@ -12,6 +12,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ #include +#include #include #include #include @@ -175,3 +176,15 @@ void v7_outer_cache_disable(void) omap_smc1(OMAP4_SERVICE_PL310_CONTROL_REG_SET, 0); } #endif /* !CONFIG_SYS_L2CACHE_OFF */ + +void vmmc_pbias_config(uint voltage) +{ + u32 value = 0; + + value = readl((*ctrl)->control_pbiaslite); + value &= ~(MMC1_PBIASLITE_PWRDNZ | MMC1_PWRDNZ); + writel(value, (*ctrl)->control_pbiaslite); + value = readl((*ctrl)->control_pbiaslite); + value |= MMC1_PBIASLITE_VMODE | MMC1_PBIASLITE_PWRDNZ | MMC1_PWRDNZ; + writel(value, (*ctrl)->control_pbiaslite); +} diff --git a/arch/arm/mach-omap2/omap5/hwinit.c b/arch/arm/mach-omap2/omap5/hwinit.c index e3ac8bbe95..839d79d102 100644 --- a/arch/arm/mach-omap2/omap5/hwinit.c +++ b/arch/arm/mach-omap2/omap5/hwinit.c @@ -13,6 +13,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ #include +#include #include #include #include @@ -451,3 +452,36 @@ void v7_arch_cp15_set_acr(u32 acr, u32 cpu_midr, u32 cpu_rev_comb, #endif omap_smc1(OMAP5_SERVICE_ACR_SET, acr); } + +#if defined(CONFIG_PALMAS_POWER) +void vmmc_pbias_config(uint voltage) +{ + u32 value = 0; + struct vcores_data const *vcores = *omap_vcores; + + value = readl((*ctrl)->control_pbias); + value &= ~SDCARD_PWRDNZ; + writel(value, (*ctrl)->control_pbias); + udelay(10); /* wait 10 us */ + value &= ~SDCARD_BIAS_PWRDNZ; + writel(value, (*ctrl)->control_pbias); + + if (vcores->core.pmic->i2c_slave_addr == 0x60) { + if (voltage == LDO_VOLT_3V0) + voltage = 0x19; + else if (voltage == LDO_VOLT_1V8) + voltage = 0xa; + lp873x_mmc1_poweron_ldo(voltage); + } else { + palmas_mmc1_poweron_ldo(voltage); + } + + value = readl((*ctrl)->control_pbias); + value |= SDCARD_BIAS_PWRDNZ; + writel(value, (*ctrl)->control_pbias); + udelay(150); /* wait 150 us */ + value |= SDCARD_PWRDNZ; + writel(value, (*ctrl)->control_pbias); + udelay(150); /* wait 150 us */ +} +#endif -- cgit v1.2.1