aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBalaji T K <balajitk@ti.com>2011-09-09 11:03:08 +0200
committerJohn Rigby <john.rigby@linaro.org>2011-09-16 13:42:23 -0600
commit7e9f6df53db32b1d8567d9c0e4cca620019fb7a6 (patch)
tree7fb01cfc0bf78073e2f77d226186c9835f63df00
parent220001905b02413c35b51fc0ac9171bf25d79242 (diff)
mmc: omap: config VMMC, MMC1_PBIAS
Config VMMC voltage to 3V for MMC/SD card slot and PBIAS settings needed for OMAP4 Signed-off-by: Balaji T K <balajitk@ti.com> Signed-off-by: Aneesh V <aneesh@ti.com> Signed-off-by: Sebastien Jan <s-jan@ti.com>
-rw-r--r--arch/arm/include/asm/arch-omap4/omap4.h1
-rw-r--r--drivers/mmc/omap_hsmmc.c26
-rw-r--r--drivers/power/twl6030.c7
-rw-r--r--include/configs/omap4_panda.h2
-rw-r--r--include/configs/omap4_sdp4430.h2
-rw-r--r--include/twl6030.h3
6 files changed, 38 insertions, 3 deletions
diff --git a/arch/arm/include/asm/arch-omap4/omap4.h b/arch/arm/include/asm/arch-omap4/omap4.h
index 9aad0e618..13fc8c9d5 100644
--- a/arch/arm/include/asm/arch-omap4/omap4.h
+++ b/arch/arm/include/asm/arch-omap4/omap4.h
@@ -55,6 +55,7 @@
#define LPDDR2_IO_REGS_BASE 0x4A100638
#define CONTROL_EFUSE_2 0x4A100704
+#define CONTROL_PBIASLITE 0x4A100600
/* CONTROL_ID_CODE */
#define CONTROL_ID_CODE 0x4A002204
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 662790509..5270f79b3 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -28,6 +28,7 @@
#include <part.h>
#include <i2c.h>
#include <twl4030.h>
+#include <twl6030.h>
#include <asm/io.h>
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/sys_proto.h>
@@ -38,7 +39,22 @@
static int mmc_read_data(hsmmc_t *mmc_base, char *buf, unsigned int size);
static int mmc_write_data(hsmmc_t *mmc_base, const char *buf, unsigned int siz);
static struct mmc hsmmc_dev[2];
-unsigned char mmc_board_init(hsmmc_t *mmc_base)
+
+unsigned char omap4_vmmc_pbias_config(struct mmc *mmc)
+{
+ u32 value = 0;
+
+ value = readl(CONTROL_PBIASLITE);
+ value &= ~((1 << 22) | (1 << 26));
+ writel(value, CONTROL_PBIASLITE);
+ /* set VMMC to 3V */
+ twl6030_power_mmc_init();
+ value = readl(CONTROL_PBIASLITE);
+ value |= (1 << 21) | (1 << 22) | (1 << 26);
+ writel(value, CONTROL_PBIASLITE);
+}
+
+unsigned char mmc_board_init(struct mmc *mmc)
{
#if defined(CONFIG_TWL4030_POWER)
twl4030_power_mmc_init();
@@ -67,7 +83,11 @@ unsigned char mmc_board_init(hsmmc_t *mmc_base)
&prcm_base->iclken1_core);
#endif
-/* TODO add appropriate OMAP4 init - none currently necessary */
+#if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER)
+ /* PBIAS config needed for MMC1 only */
+ if (mmc->block_dev.dev == 0)
+ omap4_vmmc_pbias_config(mmc);
+#endif
return 0;
}
@@ -108,7 +128,7 @@ static int mmc_init_setup(struct mmc *mmc)
unsigned int dsor;
ulong start;
- mmc_board_init(mmc_base);
+ mmc_board_init(mmc);
writel(readl(&mmc_base->sysconfig) | MMC_SOFTRESET,
&mmc_base->sysconfig);
diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c
index fef57b433..c5a0038ca 100644
--- a/drivers/power/twl6030.c
+++ b/drivers/power/twl6030.c
@@ -182,6 +182,13 @@ void twl6030_init_battery_charging(void)
return;
}
+void twl6030_power_mmc_init()
+{
+ /* set voltage to 3.0 and turnon for APP */
+ twl6030_i2c_write_u8(TWL6030_CHIP_PM, 0x15, VMMC_CFG_VOLTATE);
+ twl6030_i2c_write_u8(TWL6030_CHIP_PM, 0x21, VMMC_CFG_STATE);
+}
+
void twl6030_usb_device_settings()
{
u8 data = 0;
diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h
index 762624aec..edd26585c 100644
--- a/include/configs/omap4_panda.h
+++ b/include/configs/omap4_panda.h
@@ -99,7 +99,9 @@
#define CONFIG_I2C_MULTI_BUS 1
/* TWL6030 */
+#ifndef CONFIG_SPL_BUILD
#define CONFIG_TWL6030_POWER 1
+#endif
/* MMC */
#define CONFIG_GENERIC_MMC 1
diff --git a/include/configs/omap4_sdp4430.h b/include/configs/omap4_sdp4430.h
index 1a5d7a66c..6a6a54504 100644
--- a/include/configs/omap4_sdp4430.h
+++ b/include/configs/omap4_sdp4430.h
@@ -98,8 +98,10 @@
#define CONFIG_I2C_MULTI_BUS 1
/* TWL6030 */
+#ifndef CONFIG_SPL_BUILD
#define CONFIG_TWL6030_POWER 1
#define CONFIG_CMD_BAT 1
+#endif
/* MMC */
#define CONFIG_GENERIC_MMC 1
diff --git a/include/twl6030.h b/include/twl6030.h
index 6ed68a0e1..a9fcadbfe 100644
--- a/include/twl6030.h
+++ b/include/twl6030.h
@@ -33,6 +33,8 @@
#define TWL6030_CHIP_PWM 0x49
/* Slave Address 0x48 */
+#define VMMC_CFG_STATE 0x9A
+#define VMMC_CFG_VOLTATE 0x9B
#define VUSB_CFG_STATE 0xA2
#define MISC1 0xE4
@@ -130,3 +132,4 @@ void twl6030_start_usb_charging(void);
void twl6030_stop_usb_charging(void);
int twl6030_get_battery_voltage(void);
int twl6030_get_battery_current(void);
+void twl6030_power_mmc_init(void);