From patchwork Wed May 15 09:40:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 16917 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f200.google.com (mail-gh0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6414C2396C for ; Wed, 15 May 2013 09:42:42 +0000 (UTC) Received: by mail-gh0-f200.google.com with SMTP id 10sf1929458ghy.7 for ; Wed, 15 May 2013 02:42:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-beenthere:x-received:received-spf:x-received :x-forwarded-to:x-forwarded-for:delivered-to:x-received:received-spf :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe :content-type; bh=1js6VhT+IF7u0ePMu0HUekx4/6AFeb7llfpcTZIHPLg=; b=EU/qGD8mmQZvt24TBO4WWbCqNKp4RiM6TiKyErPuL5oZ1s49wtpl/4gg48tfccp6su Cug0tQy2HK5t5TaZEQ6aUqkKkFeEX/edbKgZeYf+h51mhbw8Pl5fJd0shKqq6JtHoojK xsiFYl5zy6oPHG668mofhP9JQnqnlzgR82a5nAFZRPsIgP6e+ISfYShNksmqJ/PsfiDi F91+0PBIQt0hzqxDnxSN90sOkrX1ktzkHwShw64XHO3ELviXXIW6evPzZdbEuhtHpY0y DIN1n1zysoqhsVCQiB5Sw8201Y49vOkisxMztXhuZJAO5TCqn4pfQt3dI+FdF0zU5sj3 uBAA== X-Received: by 10.224.217.195 with SMTP id hn3mr23015426qab.5.1368610925875; Wed, 15 May 2013 02:42:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.196 with SMTP id 4ls642052qeg.96.gmail; Wed, 15 May 2013 02:42:05 -0700 (PDT) X-Received: by 10.52.110.133 with SMTP id ia5mr20546035vdb.129.1368610925755; Wed, 15 May 2013 02:42:05 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id r5si1000914vdw.124.2013.05.15.02.42.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 May 2013 02:42:05 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id gf12so1634047vcb.1 for ; Wed, 15 May 2013 02:42:05 -0700 (PDT) X-Received: by 10.52.36.115 with SMTP id p19mr3309953vdj.8.1368610925571; Wed, 15 May 2013 02:42:05 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.217.15 with SMTP id hk15csp11003vcb; Wed, 15 May 2013 02:42:04 -0700 (PDT) X-Received: by 10.180.160.200 with SMTP id xm8mr13166514wib.23.1368610924505; Wed, 15 May 2013 02:42:04 -0700 (PDT) Received: from eu1sys200aog125.obsmtp.com (eu1sys200aog125.obsmtp.com [207.126.144.159]) by mx.google.com with SMTP id c5si2543529eep.157.2013.05.15.02.41.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 15 May 2013 02:42:04 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.159 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.159; Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob125.postini.com ([207.126.147.11]) with SMTP ID DSNKUZNYRuwBXPeYjApVS7x95UfJgw+d+AeK@postini.com; Wed, 15 May 2013 09:41:56 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id C891B9B; Wed, 15 May 2013 09:39:37 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 0F29961; Wed, 15 May 2013 09:40:35 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 93616A8065; Wed, 15 May 2013 11:40:30 +0200 (CEST) Received: from steludxu1397.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.279.5; Wed, 15 May 2013 11:40:34 +0200 From: Ulf Hansson To: , Russell King Cc: , Chris Ball , Linus Walleij , Ulf Hansson Subject: [PATCH 2/4] mmc: mmci: Support signal voltage switch for UHS cards Date: Wed, 15 May 2013 11:40:20 +0200 Message-ID: <1368610823-14113-3-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1368610823-14113-1-git-send-email-ulf.hansson@stericsson.com> References: <1368610823-14113-1-git-send-email-ulf.hansson@stericsson.com> MIME-Version: 1.0 X-Gm-Message-State: ALoCoQla4p21YvgkT8Iz4CYeRVbEb8hfrC2Vl/w9SML/jrCVq9xaZGVemwzyWfjHvJ9gSLFujX5X X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Ulf Hansson Add .start_signal_voltage_switch callback to be able to support UHS cards. The voltage switch requires the optional vqmmc regulator to exist since the actual voltage switch will be performed directly on it. Signed-off-by: Ulf Hansson --- drivers/mmc/host/mmci.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 2983c15..8d4ceb8 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -1253,6 +1253,39 @@ static int mmci_get_cd(struct mmc_host *mmc) return status; } +static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) +{ + int ret = 0; + + if (!IS_ERR(mmc->supply.vqmmc)) { + + pm_runtime_get_sync(mmc_dev(mmc)); + + switch (ios->signal_voltage) { + case MMC_SIGNAL_VOLTAGE_330: + ret = regulator_set_voltage(mmc->supply.vqmmc, + 2700000, 3600000); + break; + case MMC_SIGNAL_VOLTAGE_180: + ret = regulator_set_voltage(mmc->supply.vqmmc, + 1700000, 1950000); + break; + case MMC_SIGNAL_VOLTAGE_120: + ret = regulator_set_voltage(mmc->supply.vqmmc, + 1100000, 1300000); + break; + } + + if (ret) + dev_warn(mmc_dev(mmc), "Voltage switch failed\n"); + + pm_runtime_mark_last_busy(mmc_dev(mmc)); + pm_runtime_put_autosuspend(mmc_dev(mmc)); + } + + return ret; +} + static irqreturn_t mmci_cd_irq(int irq, void *dev_id) { struct mmci_host *host = dev_id; @@ -1269,6 +1302,7 @@ static const struct mmc_host_ops mmci_ops = { .set_ios = mmci_set_ios, .get_ro = mmci_get_ro, .get_cd = mmci_get_cd, + .start_signal_voltage_switch = mmci_sig_volt_switch, }; #ifdef CONFIG_OF