From patchwork Fri Aug 4 17:43:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 109445 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp2474959qge; Fri, 4 Aug 2017 10:44:58 -0700 (PDT) X-Received: by 10.98.106.6 with SMTP id f6mr3304799pfc.53.1501868698453; Fri, 04 Aug 2017 10:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501868698; cv=none; d=google.com; s=arc-20160816; b=f/DBXxJO9cvJrMm0AOCAcGRoTlbWXPwlsu2lUqUtK6UxaBG54WAafqBXXjdGMsz7xM huDobXxZmiQpsn79DOJWRZJE4qZMFKULBbOZ34uZVfIwslx4KsE6Kb6KWz6AZzzEnt3o Tz1Aq4BkvlMIrWexf5XUti1PgBRqIXSKxK7bbXoAQhZ+Xk1ysYYxx6x+QXz/neD6yc/5 Nofl3eu9AgAuNfrouMV1eJJVX8zAlbEVzRTu3Et+TCMMoEBAOm7D9VwwcYlGAQq9POzf 1y4syM3DlJNG9zluIggUge8nuI8fmqTDVxASC4K8/XspHneCnQQdgbkgWZ+HsTbXGuzE kf/w== 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=rae1+ECKIkk7deJbeKB1VvYZqfcsE95/Y2lPBmxepRY=; b=0z9kAtiiO/+ILrDzSbXzySdoNKQS6waMx7pFRXLtROtz7aYKBghdAnlc6wENG+aBV/ y9QzT8U2NlAtIQrAfEEY4mI9c6H+uyQV3zktjIfAN4bhjhu1010bdbK3N8DlMcvBigHJ 7kPoO/V+fwpybV0NP6XOpfxZISSUur0QonOSPWI5slnbpYeO0DjfoC6lB5/8ds7kUDMb LV1U2i4vy8CBtoRk8OHSsnjidWCQiSHHN6V/YNwhn7byPpUXx2UFQA0Pa6sVymr7WHUM 3kl8YgDnmi+wlBOXH5eD6HncUyZyxRZXMjaytB0AgNbrUsywjZA/6CfG0vQSnsLEuklM zLsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.b=SxxSektu; 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 p33si1419157pld.151.2017.08.04.10.44.57; Fri, 04 Aug 2017 10:44:58 -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.b=SxxSektu; 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 S1753273AbdHDRo4 (ORCPT + 25 others); Fri, 4 Aug 2017 13:44:56 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:38492 "EHLO mail-wr0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753218AbdHDRoU (ORCPT ); Fri, 4 Aug 2017 13:44:20 -0400 Received: by mail-wr0-f169.google.com with SMTP id f21so19228994wrf.5 for ; Fri, 04 Aug 2017 10:44:19 -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=rae1+ECKIkk7deJbeKB1VvYZqfcsE95/Y2lPBmxepRY=; b=SxxSektuMuYBWMlkrEvyP0CquqzKOb6J6HtMbGrhXBlkZRVQtd/RNWttIFltisVu9E fAjpQfX2c1JQwLCQ33FJ/nicEQntBAVsFqusHsqOmn4arkGZF+VhNKyiJhvHo0fM+6S8 NuqPfeWCzHhqVfvP+U2xdnIFdTpq+jROL0nx6UMCSfjF5loW/+y9Wf0RoQTrybW4eMX4 +4HKERmjaPWbKDurTX6s5MN2CYhQXaclvUEX2b6itecdJUN4x+SJbFMWYxEaSKxvwvJT E5VChBgTfypEFvRog/m4DOpNcgtYT2SM9VrWQRE3m8Ubgl2SE38OqU2S6WdhRZhgxjdN 3YLg== 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=rae1+ECKIkk7deJbeKB1VvYZqfcsE95/Y2lPBmxepRY=; b=MB9O9ETc5q4A1plXH4oHHVTgrtCO2tS+JxT1tNgXnclpZJ1Zlc3QJuUsr1DujZMhVm Qj7y+hYZiqcWsP7oA3KqSuWdoyBql43zzxdVzy+gAvSIukTY59gl58jVxsejND8s7Xgy v1fG9JH720yAOvHDOQ2q2MStyJQcD0WiXziRtr6cURfwWNgpNu1YpAwEZmx1f+KhVqWR UwcvS6nVXLNY2HS4qttosUYcgyF9/XTzN4xetnr3co0xoUdLNSyUIlVw/9WB4Gw8Pz4a 4jpXXVdEc9WRtIKCFfWkQIuj7R1I/80tHZ1yve46uiHSiCS2El8MrWQxfzjUypBfluPD UtKw== X-Gm-Message-State: AIVw111th5eQIPa+GTP24oNX1VfkIUGNLL/XO+NrdwzZhJqlq9Mk0v3Y fup4OmdjLmEsX//a X-Received: by 10.223.155.145 with SMTP id d17mr2596400wrc.193.1501868659162; Fri, 04 Aug 2017 10:44:19 -0700 (PDT) Received: from localhost.localdomain (cag06-3-82-243-161-21.fbx.proxad.net. [82.243.161.21]) by smtp.googlemail.com with ESMTPSA id p17sm996082wma.45.2017.08.04.10.44.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Aug 2017 10:44:18 -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 14/14] mmc: meson-gx: implement voltage switch callback Date: Fri, 4 Aug 2017 19:43:53 +0200 Message-Id: <20170804174353.16486-15-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170804174353.16486-1-jbrunet@baylibre.com> References: <20170804174353.16486-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. Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.9.4 diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c index e991c9e452ab..de2d7b8a9d97 100644 --- a/drivers/mmc/host/meson-gx-mmc.c +++ b/drivers/mmc/host/meson-gx-mmc.c @@ -38,6 +38,8 @@ #include #include +#include + #define DRIVER_NAME "meson-gx-mmc" #define SD_EMMC_CLOCK 0x0 @@ -1024,6 +1026,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, @@ -1032,6 +1056,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)