From patchwork Thu Dec 2 11:35:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 374221 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB2BZpID023230 for ; Thu, 2 Dec 2010 11:35:52 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757358Ab0LBLfv (ORCPT ); Thu, 2 Dec 2010 06:35:51 -0500 Received: from eu1sys200aog119.obsmtp.com ([207.126.144.147]:59037 "EHLO eu1sys200aog119.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756515Ab0LBLfu (ORCPT ); Thu, 2 Dec 2010 06:35:50 -0500 Received: from source ([138.198.100.35]) (using TLSv1) by eu1sys200aob119.postini.com ([207.126.147.11]) with SMTP ID DSNKTPeEkE8uJigSvo5V5SvYuk8QYGY51mRP@postini.com; Thu, 02 Dec 2010 11:35:49 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id E38C1181; Thu, 2 Dec 2010 11:35:41 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id F242FD15; Thu, 2 Dec 2010 11:35:40 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id C1DE1A809D; Thu, 2 Dec 2010 12:35:05 +0100 (CET) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.2.254.0; Thu, 2 Dec 2010 12:35:09 +0100 From: Linus Walleij To: , Cc: Linus Walleij Subject: [PATCH] mmci: supply per-instance regulator name Date: Thu, 2 Dec 2010 12:35:07 +0100 Message-ID: <1291289707-5529-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Dec 2010 11:35:52 +0000 (UTC) diff --git a/arch/arm/mach-u300/mmc.c b/arch/arm/mach-u300/mmc.c index de1ac9a..82e4843 100644 --- a/arch/arm/mach-u300/mmc.c +++ b/arch/arm/mach-u300/mmc.c @@ -102,6 +102,7 @@ int __devinit mmc_init(struct amba_device *adev) * we have a regulator we can control instead. */ /* Nominally 2.85V on our platform */ + mmci_card->mmc0_plat_data.vcard = "vmmc"; mmci_card->mmc0_plat_data.f_max = 24000000; mmci_card->mmc0_plat_data.status = mmc_status; mmci_card->mmc0_plat_data.gpio_wp = -1; diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c index be5e8cc..6f8d828 100644 --- a/arch/arm/mach-ux500/board-mop500-sdi.c +++ b/arch/arm/mach-ux500/board-mop500-sdi.c @@ -87,6 +87,7 @@ static u32 mop500_sdi0_vdd_handler(struct device *dev, unsigned int vdd, } static struct mmci_platform_data mop500_sdi0_data = { + .vcard = "V-MMC-SD", .vdd_handler = mop500_sdi0_vdd_handler, .ocr_mask = MMC_VDD_29_30, .f_max = 100000000, @@ -117,6 +118,7 @@ void mop500_sdi_tc35892_init(void) */ static struct mmci_platform_data mop500_sdi2_data = { + /* This is always on so needs no vcard regulator */ .ocr_mask = MMC_VDD_165_195, .f_max = 100000000, .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, @@ -129,6 +131,7 @@ static struct mmci_platform_data mop500_sdi2_data = { */ static struct mmci_platform_data mop500_sdi4_data = { + .vcard = "V-eMMC1", .ocr_mask = MMC_VDD_29_30, .f_max = 100000000, .capabilities = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 3709ab3..23e6ebd 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -844,14 +844,22 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) mmc->f_max = min(host->mclk, fmax); dev_dbg(mmc_dev(mmc), "clocking block at %u Hz\n", mmc->f_max); -#ifdef CONFIG_REGULATOR - /* If we're using the regulator framework, try to fetch a regulator */ - host->vcc = regulator_get(&dev->dev, "vmmc"); - if (IS_ERR(host->vcc)) - host->vcc = NULL; - else { - int mask = mmc_regulator_get_ocrmask(host->vcc); + /* Use a host regulator for card power if one is supplied */ + if (plat->vcard) { + int mask; + + /* + * If getting the regulators fails, or if the + * regulator framework is disabled (yields a NULL + * regulator) we leave this. + */ + host->vcc = regulator_get(&dev->dev, plat->vcard); + if (IS_ERR(host->vcc)) + host->vcc = NULL; + if (host->vcc == NULL) + goto no_regulator; + mask = mmc_regulator_get_ocrmask(host->vcc); if (mask < 0) dev_err(&dev->dev, "error getting OCR mask (%d)\n", mask); @@ -863,8 +871,9 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) "(using regulator instead)\n"); } } -#endif + /* Fall back to platform data if no regulator is found */ +no_regulator: if (host->vcc == NULL) mmc->ocr_avail = plat->ocr_mask; mmc->caps = plat->capabilities; diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index f4ee9ac..614c2b6 100644 --- a/include/linux/amba/mmci.h +++ b/include/linux/amba/mmci.h @@ -9,6 +9,7 @@ /** * struct mmci_platform_data - platform configuration for the MMCI * (also known as PL180) block. + * @vcard: name of regulator for card * @f_max: the maximum operational frequency for this host in this * platform configuration. When this is specified it takes precedence * over the module parameter for the same frequency. @@ -29,6 +30,7 @@ * this platform, signify anything MMC_CAP_* from mmc/host.h */ struct mmci_platform_data { + char *vcard; unsigned int f_max; unsigned int ocr_mask; u32 (*vdd_handler)(struct device *, unsigned int vdd,