9
0
Fork 0

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>
This commit is contained in:
Alexander Aring 2011-12-21 08:50:30 +01:00 committed by Sascha Hauer
parent 8658e6a952
commit 659f150e90
6 changed files with 108 additions and 0 deletions

View File

@ -26,4 +26,5 @@ obj-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
obj-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock_core.o omap3_clock.o
obj-$(CONFIG_OMAP_GPMC) += gpmc.o devices-gpmc-nand.o
obj-$(CONFIG_SHELL_NONE) += xload.o
obj-$(CONFIG_I2C_TWL6030) += omap4_twl6030_mmc.o
obj-y += gpio.o

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2011 Alexander Aring <a.aring@phytec.de>
*/
#ifndef __OMAP4_TWL6030_MMC_H__
#define __OMAP4_TWL6030_MMC_H__
/*
* Sets up voltage for mmc slot.
*/
void set_up_mmc_voltage_omap4(void);
/* __OMAP4_TWL6030_MMC_H__ */
#endif

View File

@ -0,0 +1,46 @@
/*
* Copyright (C) 2011 Alexander Aring <a.aring@phytec.de
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#include <common.h>
#include <io.h>
#include <mci/twl6030.h>
/* MMC voltage */
#define OMAP4_CONTROL_PBIASLITE 0x4A100600
#define OMAP4_MMC1_PBIASLITE_VMODE (1<<21)
#define OMAP4_MMC1_PBIASLITE_PWRDNZ (1<<22)
#define OMAP4_MMC1_PWRDNZ (1<<26)
void set_up_mmc_voltage_omap4(void)
{
u32 value;
value = readl(OMAP4_CONTROL_PBIASLITE);
value &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ | OMAP4_MMC1_PWRDNZ);
writel(value, OMAP4_CONTROL_PBIASLITE);
twl6030_mci_power_init();
value = readl(OMAP4_CONTROL_PBIASLITE);
value |= (OMAP4_MMC1_PBIASLITE_VMODE | OMAP4_MMC1_PBIASLITE_PWRDNZ |
OMAP4_MMC1_PWRDNZ);
writel(value, OMAP4_CONTROL_PBIASLITE);
}
EXPORT_SYMBOL(set_up_mmc_voltage_omap4);

View File

@ -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

View File

@ -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);

29
drivers/mci/twl6030.c Normal file
View File

@ -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);
}