From patchwork Mon Aug 21 16:02:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 110569 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp4244833obb; Mon, 21 Aug 2017 09:05:02 -0700 (PDT) X-Received: by 10.98.202.69 with SMTP id n66mr2506428pfg.197.1503331502736; Mon, 21 Aug 2017 09:05:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503331502; cv=none; d=google.com; s=arc-20160816; b=rrTNrnQjnMcn/1hglyu52kLS126l0pu29y8aIAqgkRqChtbIonzXmB5q2Ameo6F6Bw ZZb2jS7BLgDzwKvRQMXQ6rLD0f2FElE6xdrVZOKnzSrI6Yc3+aZ+HG50kU6/DUFmB8hf 9cgoBtRqQeTYlP6QVNZutvjZEXNW9gHht2HsTeC3f8k9C73HapMpXgY10Uy5EcAbqoeY qutiT8VnyRPNsoLsxPeDoKTvBZlsPIdw662sr5imyILbqVg3AvaQ+tN52dlUgDH7iC92 panvMIwm0OZ2R2QITsBj2OBzgc3Fag0mP09ygBFNI1yFO2cr5vbLKzE/Mb7NcrGmXcah DURQ== 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=GuyOubelvJA7rWpAisvKFUWKQSlHIpAuJJBzrfBNATs=; b=i6ARvGSDZUFR+Ji1nG3H4ghGXZ8Ct9djCEnVDVqiS+IVKDsIo8BC/Ptthg+Sk54xVN J8DQbBfYqpQPge73udOrjO+A//Qg8GUAy26jtZq1KCeFl+FRV1UzzD4xBcTV0Yey0IeM 9/K4luCsz5E8bLGH9KS9B6m6h5H7fQsYDBMFKp+OgF4vnkb8yUtlel24EVCghNKjVqUe tUhYARbitgdKQufYYkXdxAywRrkLXLL/cCSGT3QOOul7YWwIPliBzu7JuR0s9eija62T EO0+dIBTKJ7FdatOsKu28vhyfLnOTmobBMFfEQy4ewPfELtMciNSbjAALg7qNkOFt7+1 lwJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=ZjlwlA5E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 g5si8269652plj.654.2017.08.21.09.05.02; Mon, 21 Aug 2017 09:05:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=ZjlwlA5E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932231AbdHUQEA (ORCPT + 26 others); Mon, 21 Aug 2017 12:04:00 -0400 Received: from mail-wr0-f178.google.com ([209.85.128.178]:36737 "EHLO mail-wr0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754476AbdHUQDV (ORCPT ); Mon, 21 Aug 2017 12:03:21 -0400 Received: by mail-wr0-f178.google.com with SMTP id f8so67002563wrf.3 for ; Mon, 21 Aug 2017 09:03:21 -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=GuyOubelvJA7rWpAisvKFUWKQSlHIpAuJJBzrfBNATs=; b=ZjlwlA5EtHtHCKHeNPKT9LcwsAPRXHXS1fSAALWzfAtFBXIpchLsvc4lD+P+HLly1m DA/93lfsPPhsgV/pUMp52mxEBZTMotG1T40drv5x8o+jbcKUsTQPH/xxO0jPaky92Aeh scnZLQn0ftO5YMp3ad7JYrJazhnfRRgakcb5xnhJ5I6L+WmR+tS/04+iMi8G9NbyYzwR qCcpzmY7yGiOa0QlOHkN71dtTClxaXxnvLCKnDP5NhY9U2fYpZ1ohVxI+Ds1qE9A/1eb bafOoBBwxRytUwWdQFIfZa97GKLVlzeLmIu99oHQVA/QUQZUQ9J9Y7wrJVncApAFCbw+ uPwA== 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=GuyOubelvJA7rWpAisvKFUWKQSlHIpAuJJBzrfBNATs=; b=hn8mqTbIb5ttrSw2N0EuMXFgH3NLCe9x4jJ9EoJ/pD0sbSLk6Jf4Ex/GjrRqHhmUZS OWUxxLwZZeRtHyNTyiliMWp6V2B/mVsT4HlPdK8lFxExsa0nCeF+L0XJcn2GLxoyqWHI 4g3SL8lrvvfpNcCkbznN2+ZIrJ4Kd/fh5uMIQJSh7v/wnYZNHxM8SQ+jSkDMbnIQwGmv sJnbzHEvvDnxickO38HNhcTy3Uz0OZhtZ41w+0iJRQ5QKy0efLVM8B2nXyUJTS52bSdi QrNZ0PnW3F9+zwJyYoHqERfbMgAmIqF26IgkGR2XjBPw2vZs+x14BwUe/3W1COoe+PsD eDxA== X-Gm-Message-State: AHYfb5jP/zr5JxbGkYw2loDg+mVsL0UZwM02YwgN9Bug0YuHyXyj/w7/ w8hAal6IAmrGKHOy X-Received: by 10.28.195.87 with SMTP id t84mr1866595wmf.99.1503331400541; Mon, 21 Aug 2017 09:03:20 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id 63sm8120063wra.30.2017.08.21.09.03.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Aug 2017 09:03:19 -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 v2 14/16] mmc: meson-gx: implement voltage switch callback Date: Mon, 21 Aug 2017 18:02:59 +0200 Message-Id: <20170821160301.21899-15-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20170821160301.21899-1-jbrunet@baylibre.com> References: <20170821160301.21899-1-jbrunet@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.9.5 diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index df1ac96bd0db..3167f561e1a6 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -1050,6 +1050,28 @@ 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, @@ -1058,6 +1080,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)