From patchwork Thu Aug 25 14:48:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: balajitk@ti.com X-Patchwork-Id: 111582 X-Patchwork-Delegate: afleming@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id A6B59B6F69 for ; Fri, 26 Aug 2011 00:48:56 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5184428088; Thu, 25 Aug 2011 16:48:55 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yz1fWy4Q5IRi; Thu, 25 Aug 2011 16:48:54 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA3BF28083; Thu, 25 Aug 2011 16:48:52 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E683A28083 for ; Thu, 25 Aug 2011 16:48:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c8pchfZ6EJgn for ; Thu, 25 Aug 2011 16:48:49 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by theia.denx.de (Postfix) with ESMTPS id 4743728082 for ; Thu, 25 Aug 2011 16:48:47 +0200 (CEST) Received: from dbdp20.itg.ti.com ([172.24.170.38]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id p7PEmhLr005531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 25 Aug 2011 09:48:45 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p7PEmg2A016637 for ; Thu, 25 Aug 2011 20:18:42 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Thu, 25 Aug 2011 20:18:42 +0530 Received: from localhost.localdomain (a0393241pc.india.ti.com [172.24.136.78]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p7PEmgFm028181; Thu, 25 Aug 2011 20:18:42 +0530 (IST) From: Balaji T K To: Date: Thu, 25 Aug 2011 20:18:25 +0530 Message-ID: <1314283705-22366-1-git-send-email-balajitk@ti.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 Cc: Balaji T K Subject: [U-Boot] [PATCH 1/1] mmc: omap: config VMMC, MMC1_PBIAS X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Config VMMC voltage to 3V for MMC/SD card slot and PBIAS settings needed for OMAP4 Fixes MMC/SD detection on boot from eMMC. Signed-off-by: Balaji T K Signed-off-by: Aneesh V --- arch/arm/include/asm/arch-omap4/omap4.h | 1 + drivers/mmc/omap_hsmmc.c | 28 +++++++++++++++++++++++++--- drivers/power/twl6030.c | 7 +++++++ include/configs/omap4_sdp4430.h | 2 ++ include/twl6030.h | 3 +++ 5 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 9aad0e6..13fc8c9 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 6627905..95bb661 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,24 @@ 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) + +#if defined(CONFIG_OMAP44XX) && defined(CONFIG_TWL6030_POWER) +static void 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); +} +#endif + +unsigned char mmc_board_init(struct mmc *mmc) { #if defined(CONFIG_TWL4030_POWER) twl4030_power_mmc_init(); @@ -67,7 +85,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 +130,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 fef57b4..c5a0038 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_sdp4430.h b/include/configs/omap4_sdp4430.h index 5b3110c..50797ab 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 6ed68a0..a9fcadb 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);