From patchwork Mon Apr 18 09:38:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Persson X-Patchwork-Id: 8869161 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2DB6DBF29F for ; Mon, 18 Apr 2016 09:39:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 60D0D2010C for ; Mon, 18 Apr 2016 09:39:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8088F20117 for ; Mon, 18 Apr 2016 09:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752348AbcDRJjX (ORCPT ); Mon, 18 Apr 2016 05:39:23 -0400 Received: from bastet.se.axis.com ([195.60.68.11]:45639 "EHLO bastet.se.axis.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751575AbcDRJjH (ORCPT ); Mon, 18 Apr 2016 05:39:07 -0400 Received: from localhost (localhost [127.0.0.1]) by bastet.se.axis.com (Postfix) with ESMTP id CD3951817B; Mon, 18 Apr 2016 11:39:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bastet.se.axis.com X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from bastet.se.axis.com ([IPv6:::ffff:127.0.0.1]) by localhost (bastet.se.axis.com [::ffff:127.0.0.1]) (amavisd-new, port 10024) with LMTP id jrCpzVnAmaNE; Mon, 18 Apr 2016 11:39:04 +0200 (CEST) Received: from boulder.se.axis.com (boulder.se.axis.com [10.0.2.104]) by bastet.se.axis.com (Postfix) with ESMTP id DDAB61813B; Mon, 18 Apr 2016 11:39:04 +0200 (CEST) Received: from boulder.se.axis.com (localhost [127.0.0.1]) by postfix.imss71 (Postfix) with ESMTP id C7A731446; Mon, 18 Apr 2016 11:39:04 +0200 (CEST) Received: from thoth.se.axis.com (thoth.se.axis.com [10.0.2.173]) by boulder.se.axis.com (Postfix) with ESMTP id BB1C116DD; Mon, 18 Apr 2016 11:39:04 +0200 (CEST) Received: from lnxlarper1.se.axis.com (lnxlarper1.se.axis.com [10.88.41.2]) by thoth.se.axis.com (Postfix) with ESMTP id B7CCC10D4; Mon, 18 Apr 2016 11:39:04 +0200 (CEST) Received: by lnxlarper1.se.axis.com (Postfix, from userid 20456) id B41E2800FD; Mon, 18 Apr 2016 11:39:04 +0200 (CEST) From: Lars Persson To: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org Cc: g.liakhovetski@gmx.de, ulf.hansson@linaro.org, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org, Phil Edworthy , Lars Persson Subject: [PATCH 2/3] mmc: usdhi6rol0: add support for UHS modes Date: Mon, 18 Apr 2016 11:38:25 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Guennadi Liakhovetski The mmc core will only enable UHS modes if the host supports the .start_signal_voltage_switch() operation. Add this method to the v08r07 driver even if there's actually nothing to do in it. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Phil Edworthy Signed-off-by: Lars Persson --- drivers/mmc/host/usdhi6rol0.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c index 807c06e..5dde31b 100644 --- a/drivers/mmc/host/usdhi6rol0.c +++ b/drivers/mmc/host/usdhi6rol0.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1147,12 +1148,43 @@ static void usdhi6_enable_sdio_irq(struct mmc_host *mmc, int enable) } } +static int usdhi6_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) +{ + int ret; + + if (IS_ERR(mmc->supply.vqmmc)) + return 0; + + 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; + default: + return 0; + } + + if (ret < 0) + dev_warn(mmc_dev(mmc), "Voltage switch failed: %d\n", ret); + + return ret; +} + static struct mmc_host_ops usdhi6_ops = { .request = usdhi6_request, .set_ios = usdhi6_set_ios, .get_cd = usdhi6_get_cd, .get_ro = usdhi6_get_ro, .enable_sdio_irq = usdhi6_enable_sdio_irq, + .start_signal_voltage_switch = usdhi6_sig_volt_switch, }; /* State machine handlers */