From patchwork Mon Feb 9 08:38:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikandan Pillai X-Patchwork-Id: 6179 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n198cqiX019405 for ; Mon, 9 Feb 2009 08:38:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750920AbZBIIiv (ORCPT ); Mon, 9 Feb 2009 03:38:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750869AbZBIIiv (ORCPT ); Mon, 9 Feb 2009 03:38:51 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:57381 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750741AbZBIIiu (ORCPT ); Mon, 9 Feb 2009 03:38:50 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n198cgUs013147; Mon, 9 Feb 2009 02:38:48 -0600 Received: from gitsvr01.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id n198cdg1014625; Mon, 9 Feb 2009 14:08:40 +0530 (IST) Received: from gitsvr01.india.ti.com (localhost [127.0.0.1]) by gitsvr01.india.ti.com (8.13.1/8.13.1) with ESMTP id n198cdX6012973; Mon, 9 Feb 2009 14:08:39 +0530 Received: (from a0393249@localhost) by gitsvr01.india.ti.com (8.13.1/8.13.1/Submit) id n198ccR6012936; Mon, 9 Feb 2009 14:08:38 +0530 From: Manikandan Pillai To: david-b@pacbell.net, linux-omap@vger.kernel.org Cc: Manikandan Pillai Subject: [PATCH 1/1] MMC/SD hot plug fix for TWL based boards Date: Mon, 9 Feb 2009 14:08:38 +0530 Message-Id: <1234168718-12881-1-git-send-email-mani.pillai@ti.com> X-Mailer: git-send-email 1.5.6 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org MMC hotplug was not functioning properly since the SYS_nIRQ MUX was setup as GPIO by default in the u-boot and was not being set properly in the Linux kernel. Signed-off-by: Manikandan Pillai --- arch/arm/mach-omap2/board-omap3evm.c | 32 +++++++++++++++++++++++++++++++- arch/arm/mach-omap2/mmc-twl4030.c | 2 -- drivers/mmc/host/omap_hsmmc.c | 5 ++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c index 6386c25..6e9a399 100644 --- a/arch/arm/mach-omap2/board-omap3evm.c +++ b/arch/arm/mach-omap2/board-omap3evm.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -50,6 +51,11 @@ #endif +#if defined(CONFIG_TWL4030_CORE) +static int omap3evm_twl_gpio_setup(struct device *dev, + unsigned gpio, unsigned ngpio); +#endif + static struct resource omap3evm_smc911x_resources[] = { [0] = { .start = OMAP3EVM_ETHR_START, @@ -102,6 +108,9 @@ static struct twl4030_gpio_platform_data omap3evm_gpio_data = { .gpio_base = OMAP_MAX_GPIO_LINES, .irq_base = TWL4030_GPIO_IRQ_BASE, .irq_end = TWL4030_GPIO_IRQ_END, + .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13) + | BIT(16) | BIT(17), + .setup = omap3evm_twl_gpio_setup, }; static struct twl4030_usb_data omap3evm_usb_data = { @@ -463,6 +472,27 @@ static void omap_init_pr785(void) } #endif +#if defined(CONFIG_TWL4030_CORE) +static int omap3evm_twl_gpio_setup(struct device *dev, + unsigned gpio, unsigned ngpio) +{ + /* gpio + 0 is "mmc0_cd" (input/IRQ) */ + mmc[0].gpio_cd = gpio + 0; + twl4030_mmc_init(mmc); + + return 0; +} + +static void omap_init_twl4030(void) +{ + if (cpu_is_omap343x()) { + omap_cfg_reg(AF26_34XX_GPIO0); + omap_cfg_reg(L8_34XX_GPIO63); + } +} +#endif + + static void __init omap3_evm_init(void) { omap3_evm_i2c_init(); @@ -476,7 +506,7 @@ static void __init omap3_evm_init(void) omap_serial_init(); #if defined(CONFIG_TWL4030_CORE) - twl4030_mmc_init(mmc); + omap_init_twl4030(); #endif #if defined(CONFIG_OMAP3EVM_PR785) omap_init_pr785(); diff --git a/arch/arm/mach-omap2/mmc-twl4030.c b/arch/arm/mach-omap2/mmc-twl4030.c index 88ae1bf..00a200f 100644 --- a/arch/arm/mach-omap2/mmc-twl4030.c +++ b/arch/arm/mach-omap2/mmc-twl4030.c @@ -125,7 +125,6 @@ int twl_mmc_set_voltage(struct hsmmc_controller *c, int vdd) else dev_grp_val = LDO_CLR; /* Power down */ -#if defined(CONFIG_TWL4030_CORE) ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, dev_grp_val, c->hsmmc_dev_grp); if (ret) @@ -133,7 +132,6 @@ int twl_mmc_set_voltage(struct hsmmc_controller *c, int vdd) ret = twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, vmmc, c->hsmmc_dedicated); -#endif return ret; } diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index db37490..2f16072 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -518,6 +518,9 @@ static void mmc_omap_detect(struct work_struct *work) struct mmc_omap_host *host = container_of(work, struct mmc_omap_host, mmc_carddetect_work); + struct omap_mmc_slot_data *slot = &mmc_slot(host); + host->carddetect = slot->card_detect(slot->card_detect_irq); + sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); if (host->carddetect) { mmc_detect_change(host->mmc, (HZ * 200) / 1000); @@ -947,7 +950,7 @@ static int __init omap_mmc_probe(struct platform_device *pdev) goto err1; } - host->dbclk = clk_get(&pdev->dev, "mmchsdb_fck"); + host->dbclk = clk_get(&pdev->dev, "mmchs_fck"); /* * MMC can still work without debounce clock. */