From patchwork Mon Aug 28 14:29:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9925713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AE24960329 for ; Mon, 28 Aug 2017 14:41:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0FF827FE4 for ; Mon, 28 Aug 2017 14:41:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95C1528068; Mon, 28 Aug 2017 14:41:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 44716283C7 for ; Mon, 28 Aug 2017 14:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3/HQ/VCnEXG6kJgqF45JIH+R10y4WWt7sxIwiFt7cBM=; b=YX00+mSVF91ZD7yOGumIcJpM3q vaEvLrz5vdJFYolof3yejkSOBFeZ8juRm9rkc68Gi5Q0NXWSfDjyY/aVUbqYrqzQhClnHQ2pp71ey /7yoA/RyxUEH5iWJSRfM/5fZWjtuHH+AvzyM7Z8ljAl5ojcuwAXlxBa067Lt1GrPrYJDEOhxn1Tzu rK1mLUt0Is9UdHFwWERB74+bwFQ8qVwg7toqFbiMAgtQdGhXA5GGdnBju9vm8HfLRRlgghx1NOHA7 F6owWf6+OtoKj0CNCUHU2Pjj+3u1bqOzZX12B5Nau180N/w2TN7smXJKQK5h+YHpPehwA2+ijXlE6 wmdxGssw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dmLEK-0006sl-G3; Mon, 28 Aug 2017 14:41:32 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmLD9-0003nf-GD for linux-arm-kernel@bombadil.infradead.org; Mon, 28 Aug 2017 14:40:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VsZ/McWsB/9xx0U+i+XqQHXXKbmQkwpOPpzNBbZQ6+Y=; b=dfUKofgyqzbP+PHDncJCLyKmF VstxeyrdP4kQ1rO6Av9pHWZyjRTxdjStmSZ+fWBFGkvL7j3vXu55q+72uCVaApO0I9VVYfqnb2oM/ dlRF1JqTwtiNN6eGFA6ddmCv9pSuTPs4eumXDuyfVy3H/+waBOqSbfe2wongdE5e+hc1PH8oq447o QZ+Onvz70d5TQ4u0Aru0tJ7aM/BF/ZVLSUvETpn+55v1NmsTBL+GUELpLsg4yacdBZiZNKijHHbZx NpHfF3uok/Zi3UjVCgkrePT1QlfqZic5RLJV59yvQLiwCFmhmDr23iSpWyWHyNHO3iqzNiEVjdSDA Xnb9AlWdA==; Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dmL32-0004CU-M2 for linux-arm-kernel@lists.infradead.org; Mon, 28 Aug 2017 14:29:54 +0000 Received: by mail-wr0-x236.google.com with SMTP id z91so2237404wrc.1 for ; Mon, 28 Aug 2017 07:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VsZ/McWsB/9xx0U+i+XqQHXXKbmQkwpOPpzNBbZQ6+Y=; b=SY21UD4DUUqwiaLjp77cDkE5zY7zxF9b6zwj+vd8+fSmfFhhzXwNdyjqjpPZduBTTp BePAPyvSJNM5ea4PP5d368cixzGYyM9dgg55ptchlxankIUvmMuGkrzE0RTc+7GPUu53 V57F+ue2a0HVy76PEptX+6YceeUvw1w/F5AfMfoFvJRN7auu3Mmem1xw0+RMdbMIQGGr KQMxjcNyFY2WPiIxNoZ3ND/iFHfbVj5wtdopQya07fYuc5sXk+2NSKrTogK760Vn9ln4 rizUDf9A/MIxQPs7ngp7xM9DxTchJKZWyMSLdc6t726/hn7k2x+h6oxxlHM4BqKFGGuK x1TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VsZ/McWsB/9xx0U+i+XqQHXXKbmQkwpOPpzNBbZQ6+Y=; b=Iz61BaiZrSdsjB6p8u1A2FrIU6wi3tlu8BrXbs+xd9mwSrDyVwPHG7jxeLKWcRHC6U mNkAY2S0HfAHLfCfxvtGAUPaUOgbtG67yAbkc3uX4OWcidWUPaC8c/lhCIDiXSwLAEaH yzH71MtMx7dMQmoM7n5L/zN+iCpQlebiIsJYNA0SAV13jm1ACxLqEY4X1gfRRjipWBq8 TtDrM6JuoTwFLvGeRK5Q6O9ggFGIe/hQKm8HShuyhl7nM706Zcv7apLg3h7lAMj5ld3c PjTSsZgd20veggHBu3kTXS4HC2OZgEuwQlGOF+kOSFL05wq1a38pzN7A42XwadAPMn2e rLfQ== X-Gm-Message-State: AHYfb5j8ofqpccBCkujv4ablBVCDTA2pWDVv0NJN/W7YiZ75SbOncXna XTjNpwlCjKUlKTmq X-Received: by 10.223.155.154 with SMTP id d26mr656882wrc.212.1503930570378; Mon, 28 Aug 2017 07:29:30 -0700 (PDT) Received: from localhost.localdomain (uluru.liltaz.com. [163.172.81.188]) by smtp.googlemail.com with ESMTPSA id z39sm604792wrz.61.2017.08.28.07.29.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 07:29:29 -0700 (PDT) From: Jerome Brunet To: Ulf Hansson , Kevin Hilman , Carlo Caione Subject: [PATCH v3 11/13] mmc: meson-gx: implement voltage switch callback Date: Mon, 28 Aug 2017 16:29:13 +0200 Message-Id: <20170828142915.27020-12-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170828142915.27020-1-jbrunet@baylibre.com> References: <20170828142915.27020-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170828_152952_768652_36ED72EE X-CRM114-Status: GOOD ( 13.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Implement voltage switch callback (shamelessly copied from sunxi mmc driver). This allow, with the appropriate tuning function, to use SD ultra high speed modes. Reviewed-by: Kevin Hilman Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index 2fa18faa7f0f..0cffc705bfe3 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -1049,6 +1049,27 @@ static int meson_mmc_card_busy(struct mmc_host *mmc) return !(FIELD_GET(STATUS_DATI, regval) & 0xf); } +static int meson_mmc_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios) +{ + /* vqmmc regulator is available */ + if (!IS_ERR(mmc->supply.vqmmc)) { + /* + * The usual amlogic setup uses a GPIO to switch from one + * regulator to the other. While the voltage ramp up is + * pretty fast, care must be taken when switching from 3.3v + * to 1.8v. Please make sure the regulator framework is aware + * of your own regulator constraints + */ + return mmc_regulator_set_vqmmc(mmc, ios); + } + + /* no vqmmc regulator, assume fixed regulator at 3/3.3V */ + if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) + return 0; + + return -EINVAL; +} + static const struct mmc_host_ops meson_mmc_ops = { .request = meson_mmc_request, .set_ios = meson_mmc_set_ios, @@ -1057,6 +1078,7 @@ static const struct mmc_host_ops meson_mmc_ops = { .post_req = meson_mmc_post_req, .execute_tuning = meson_mmc_execute_tuning, .card_busy = meson_mmc_card_busy, + .start_signal_voltage_switch = meson_mmc_voltage_switch, }; static int meson_mmc_probe(struct platform_device *pdev)