From patchwork Thu Dec 13 13:22:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13528 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 0C89623E1F for ; Thu, 13 Dec 2012 13:22:27 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id A1B41A1948C for ; Thu, 13 Dec 2012 13:22:26 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so1912918iag.11 for ; Thu, 13 Dec 2012 05:22:26 -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=S3HZzSSrMXOQshMLduOut9cgwp24QUXDIJqXj1Swea8jz5OWAw5i0IEsTZK0TDzjel PMOgNqnEW1TtwygWe/Q2envBvzOOKs9YR5IMFyw9GNmB9pjTej8XR+Qf0OXw2BoO0WrD eCX5JfrnRKrrEPQB94H6NnLe8s1jTbyAQ3pfKBE+9RxGyAH2jZGq0Lu8QkHarHTEQLB9 vmmOyhtMpTqBV1YBHjqi6Sn8Iou/FygXo+b/4XDFw4H2XMj1FIkhg+R4hGTC0Kdd3xg8 BnMvRXCOgVhAEduxkVPly2eV4t3gdPjCEv9A8GBciI9aUfoXQm/JTQUlhej0k6dcw8Rr kpxg== Received: by 10.42.32.200 with SMTP id f8mr1350134icd.18.1355404946037; Thu, 13 Dec 2012 05:22:26 -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 n20csp9200igt; Thu, 13 Dec 2012 05:22:25 -0800 (PST) Received: by 10.180.95.169 with SMTP id dl9mr28969858wib.20.1355404944759; Thu, 13 Dec 2012 05:22:24 -0800 (PST) Received: from mail-we0-f170.google.com (mail-we0-f170.google.com [74.125.82.170]) by mx.google.com with ESMTPS id wk8si12004040wjc.41.2012.12.13.05.22.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 05:22:24 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.170 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.170; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.170 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-f170.google.com with SMTP id r1so1023674wey.1 for ; Thu, 13 Dec 2012 05:22:24 -0800 (PST) Received: by 10.194.86.40 with SMTP id m8mr8308995wjz.24.1355404944292; Thu, 13 Dec 2012 05:22:24 -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 g2sm2568128wiy.0.2012.12.13.05.22.21 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Dec 2012 05:22:22 -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 1/8] mmc: mmci: Move ios_handler functionality into the driver Date: Thu, 13 Dec 2012 13:22:03 +0000 Message-Id: <1355404930-5691-2-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355404930-5691-1-git-send-email-lee.jones@linaro.org> References: <1355404930-5691-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQk6ziwIffqVyTo24xlxQ4QVdMFrC1gLNzvIa3f3UGPEOwlvWBwoPZcXcMgv3PV7bNGpNBxa 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 */