diff options
author | Alexander Aring <a.aring@phytec.de> | 2011-12-21 08:50:30 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-12-21 12:48:08 +0100 |
commit | 659f150e90d8bfcf8aa4c51bd3ab552f42e288f0 (patch) | |
tree | 20f239795617794eaca566b321825d0b7da36283 /drivers/mci | |
parent | 8658e6a9528c7e65bf7a3732d815f662c9c8ed11 (diff) | |
download | barebox-659f150e90d8bfcf8aa4c51bd3ab552f42e288f0.tar.gz barebox-659f150e90d8bfcf8aa4c51bd3ab552f42e288f0.tar.xz |
omap_hsmmc: setup mmc voltage on twl6030
Support the setup of the mmc voltage, when booting OMAP4 with twl6030
from nand.
Signed-off-by: Alexander Aring <a.aring@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mci')
-rw-r--r-- | drivers/mci/Makefile | 1 | ||||
-rw-r--r-- | drivers/mci/omap_hsmmc.c | 17 | ||||
-rw-r--r-- | drivers/mci/twl6030.c | 29 |
3 files changed, 47 insertions, 0 deletions
diff --git a/drivers/mci/Makefile b/drivers/mci/Makefile index 0fc31af744..b7bb846291 100644 --- a/drivers/mci/Makefile +++ b/drivers/mci/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_MCI_S3C) += s3c.o obj-$(CONFIG_MCI_IMX) += imx.o obj-$(CONFIG_MCI_IMX_ESDHC) += imx-esdhc.o obj-$(CONFIG_MCI_OMAP_HSMMC) += omap_hsmmc.o +obj-$(CONFIG_I2C_TWL6030) += twl6030.o obj-$(CONFIG_MCI_PXA) += pxamci.o obj-$(CONFIG_MCI_ATMEL) += atmel_mci.o obj-$(CONFIG_MCI_SPI) += mci_spi.o diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c index d171c1dcf7..e671bbea73 100644 --- a/drivers/mci/omap_hsmmc.c +++ b/drivers/mci/omap_hsmmc.c @@ -33,6 +33,12 @@ #include <mach/omap_hsmmc.h> +#if defined(CONFIG_I2C_TWL6030) && \ + defined(CONFIG_MCI_OMAP_HSMMC) && \ + defined(CONFIG_ARCH_OMAP4) +#include <mach/omap4_twl6030_mmc.h> +#endif + struct hsmmc { unsigned char res1[0x10]; unsigned int sysconfig; /* 0x10 */ @@ -215,6 +221,17 @@ static int mmc_init_setup(struct mci_host *mci, struct device_d *dev) unsigned int dsor; uint64_t start; +/* + * Fix voltage for mmc, if booting from nand. + * It's necessary to do this here, because + * you need to set up this at probetime. + */ +#if defined(CONFIG_I2C_TWL6030) && \ + defined(CONFIG_MCI_OMAP_HSMMC) && \ + defined(CONFIG_ARCH_OMAP4) + set_up_mmc_voltage_omap4(); +#endif + writel(readl(&mmc_base->sysconfig) | MMC_SOFTRESET, &mmc_base->sysconfig); diff --git a/drivers/mci/twl6030.c b/drivers/mci/twl6030.c new file mode 100644 index 0000000000..4a875bd62b --- /dev/null +++ b/drivers/mci/twl6030.c @@ -0,0 +1,29 @@ +/* + * MCI pmic power. + */ + +#include <mfd/twl6030.h> +#include <mci/twl6030.h> +#include <asm/io.h> + +static int twl6030_mci_write(u8 address, u8 data) +{ + int ret; + struct twl6030 *twl6030 = twl6030_get(); + + ret = twl6030_reg_write(twl6030, address, data); + if (ret != 0) + printf("TWL6030:MCI:Write[0x%x] Error %d\n", address, ret); + + return ret; +} + +void twl6030_mci_power_init(void) +{ + twl6030_mci_write(TWL6030_PMCS_VMMC_CFG_VOLTAGE, + TWL6030_VMMC_VSEL_0 | TWL6030_VMMC_VSEL_2 | + TWL6030_VMMC_VSEL_4); + twl6030_mci_write(TWL6030_PMCS_VMMC_CFG_STATE, + TWL6030_VMMC_STATE0 | TWL6030_VMMC_GRP_APP); +} + |