From patchwork Mon Dec 10 08:55:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13438 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 940A223E1A for ; Mon, 10 Dec 2012 08:56:28 +0000 (UTC) Received: from mail-ia0-f172.google.com (mail-ia0-f172.google.com [209.85.210.172]) by fiordland.canonical.com (Postfix) with ESMTP id 4CCD7A183C8 for ; Mon, 10 Dec 2012 08:56:28 +0000 (UTC) Received: by mail-ia0-f172.google.com with SMTP id z13so3672905iaz.3 for ; Mon, 10 Dec 2012 00:56:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=CDrZWPv2FFa4gfm5ICv07gH86DAgKeaBPjUPp9iW//o=; b=Ym6W0Gc2Ek0KTQOq3goVwp27tUcUdf3IIPQIG3aP5cx4M0XHkskuCy/5GCGLQwxLKc pWXG5BTWiR4qld2uEz7B+4s2X0f36DdAbzfy9n6jLRc8kRLzn6Q5X+XigJtISnLOW/Ue lZKi02TcvrjKcaMXn1JVfa66MW9iCesPe+GgyLv/sNKPiBnsu/f2ha7qeq9GOO3HDrdm lHh+3BDZcBNpWC7Xupa2220Qv6DU1OSSRkCe81iqFHFCcWpJAtFomigtdXUnEKCkhQvt oDguzge+O73xth7/OYE9Ij6sV04jT/EFG3sZXrVem/ZN3LuuURETj2OsGTpo/nFJXdJo 2H7g== Received: by 10.50.173.34 with SMTP id bh2mr5787928igc.70.1355129787775; Mon, 10 Dec 2012 00:56:27 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp54752igt; Mon, 10 Dec 2012 00:56:27 -0800 (PST) Received: by 10.180.99.227 with SMTP id et3mr9355099wib.6.1355129786837; Mon, 10 Dec 2012 00:56:26 -0800 (PST) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by mx.google.com with ESMTPS id n47si3889977weo.135.2012.12.10.00.56.26 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 00:56:26 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.172; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f172.google.com with SMTP id r3so1427913wey.17 for ; Mon, 10 Dec 2012 00:56:26 -0800 (PST) Received: by 10.216.56.68 with SMTP id l46mr2025354wec.108.1355129786022; Mon, 10 Dec 2012 00:56:26 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id fv2sm9173114wib.4.2012.12.10.00.56.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 00:56:25 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, linus.walleij@stericsson.com, ulf.hansson@linaro.org, Lee Jones , Chris Ball , Russell King Subject: [PATCH 05/12] mmc: mmci: Move ios_handler functionality into the driver Date: Mon, 10 Dec 2012 08:55:54 +0000 Message-Id: <1355129761-8088-6-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355129761-8088-1-git-send-email-lee.jones@linaro.org> References: <1355129761-8088-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQk6cCXvZ1CBlTAtclEm49EVT4+4vdjan9m6v32d422rVF91P121aGuEcb0UII2PNDLNDToU There are currently two instances of the ios_handler being used. Both of which mearly toy with some regulator settings. Now there is a GPIO regulator API, we can use that instead, and lessen the per platform burden. By doing this, we also become more Device Tree compatible. Cc: Chris Ball Cc: Russell King Acked-by: Ulf Hansson Signed-off-by: Lee Jones --- drivers/mmc/host/mmci.c | 22 ++++++++++++++++++++++ drivers/mmc/host/mmci.h | 1 + 2 files changed, 23 insertions(+) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index edc3e9b..d45c931 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1091,6 +1091,16 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) case MMC_POWER_OFF: if (host->vcc) ret = mmc_regulator_set_ocr(mmc, host->vcc, 0); + + if (host->vqmmc) { + if (regulator_is_enabled(host->vqmmc)) { + ret = regulator_disable(host->vqmmc); + if (ret < 0) + dev_warn(mmc_dev(mmc), + "unable to disable vmmc-ios\n"); + } + } + break; case MMC_POWER_UP: if (host->vcc) { @@ -1115,6 +1125,14 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) break; case MMC_POWER_ON: + if (host->vqmmc) + if (!regulator_is_enabled(host->vqmmc)) { + ret = regulator_enable(host->vqmmc); + if (ret < 0) + dev_warn(mmc_dev(mmc), + "unable to enable vmmc-ios\n"); + } + pwr |= MCI_PWR_ON; break; } @@ -1379,6 +1397,10 @@ static int __devinit mmci_probe(struct amba_device *dev, "(using regulator instead)\n"); } } + + host->vqmmc = regulator_get(&dev->dev, "vqmmc"); + if (IS_ERR(host->vqmmc)) + host->vqmmc = NULL; #endif /* Fall back to platform data if no regulator is found */ if (host->vcc == NULL) diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index d437ccf..b87d9e2 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h @@ -194,6 +194,7 @@ struct mmci_host { struct sg_mapping_iter sg_miter; unsigned int size; struct regulator *vcc; + struct regulator *vqmmc; #ifdef CONFIG_DMA_ENGINE /* DMA stuff */