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: 111166 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4920072qge; Mon, 28 Aug 2017 07:30:42 -0700 (PDT) X-Received: by 10.98.90.5 with SMTP id o5mr790001pfb.208.1503930642654; Mon, 28 Aug 2017 07:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503930642; cv=none; d=google.com; s=arc-20160816; b=iskwb449dt5B/hMKE0/we+JuHX1abUmUbgnKUg8wvjvo4TbOhyQuLZVW67l55ZCJzk yEEAHkiKujR6YkaEfflxYuLJm0ZwhYB1dLCyRa2uo0x7+OkiTSmZbnMgJuzuY2FnFZLg tj52CYM1/VTpzsReRARecwH4a6d0GwPvv5XO1BByuZxNm+85/ePO1WXs/LP/IbJ5XnNV 4BspwWgsBM9zt2qQBLBenGMyA/aHCixeM3xpCkKHdLiw7eMT/Ge88Mmmv0IhRQN1d7H5 8molE1pu+cpGcVljG4Nm26iTo/6GFLq21Y2S5EmbIaDHLAoDoeiS9jF52shRm77rBDfx dGTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ksyyXJ/22hu6pzpP+Caz322UE6/84a/mLXI8vEx1/rc=; b=BtaJQOvZnQE0MgNlFq6y7QtDLYt7GfO1kUigcn6fjOXw4pQYB7HWhXm+JX9fqOWnCM w4cUgslUDZK2nHradEg+96rdUJ4Je65C3PnA6qQ9RinhL3yP49I8ZC2C1Q1rA8NREDdY QgtICgxjko0rLNLDKbaIzjOXeS0DPaNIRexIL8GQU1rvcgXbbXVMiBaAKIcj+McqQWIL izlpvEnsXhAPovO6ZciYUOYcMGbrFRgyA2UsRSVBnWKCVxCVSPyDWLFQqL3Z2PB6ZjVY e8hcb6ihomrSjVpr7O1K2bPOqAz0KiNRsayFEiBtIvGdu1BUoDWv6BGaRAg04LEibz5E JWmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=SY21UD4D; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si361113pgc.797.2017.08.28.07.30.42; Mon, 28 Aug 2017 07:30:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=SY21UD4D; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751823AbdH1Oal (ORCPT + 6 others); Mon, 28 Aug 2017 10:30:41 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:38264 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751304AbdH1O3b (ORCPT ); Mon, 28 Aug 2017 10:29:31 -0400 Received: by mail-wr0-f176.google.com with SMTP id 40so1692420wrv.5 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=eU55HJW3XXw67ScXR5KonbDTIWEtsrA5jiJDy3+UbVPiwwQn18DnguIO8BXx95V3fL hNF65u9mTSGkehTbOGtwad8p/0Ut3U8hAcbMGiRa8vT9ywFtFxv8Y0aW1QLI9HAIEPdG s1tYgfy4hdy6P9N5D6sK3SgdPGiV3Y98r3mxuZfInpAYALzZBUvyoIJ07UIi5EGzoQLi jNX5SuWI1n1Qi3jVseCa4eQXj1NEzet3xT+uYw/C2pkijMuFdmV6EYKwPBrn+eu1aji+ ap0WnyfH3WICd5MVtJwZWfhO2DSrdAbgqbPvJfNo+M3nr8idGrmT08mU0QDE9YAHPpoI lwHw== X-Gm-Message-State: AHYfb5g+qNYwdgQih8sWS9NImzR6iZO6+nnpQ1WUgssZtaVDHK/aqg5c pI0n2H1lZi59nqW5 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 Cc: Jerome Brunet , linux-mmc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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(+) -- 2.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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)