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: 9913411 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 A273660382 for ; Mon, 21 Aug 2017 17:24:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C559286E1 for ; Mon, 21 Aug 2017 17:24:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80BF228734; Mon, 21 Aug 2017 17:24:30 +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 37482286E1 for ; Mon, 21 Aug 2017 17:24:30 +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=+D5hVdIuEqsPXELbUzy1xPzgXlRBWLkU0iA6vXYLCSs=; b=L4V5FKq58xD0gTFBs54mBcDUME 0ZgECLSzFnLfJ1P7TB3Ke+Cs+cs6zSfca+0qBsaHrkcny9NDcsH3pGwmSplbMwPJOEErTk7dKhWzS PjgEq4RfkvlrICP/1aHw9YfJfjLZDSvCEGf9PD4y6ofphgzh+sEyCSocb+5sJoD+jXJvrg9m0LiI0 qGDpNJOKygY3IfTFveF+e8g9vCTRA9AOG7L+AYNKHblam0XM4YTYfD8md2jIFvCdx3te1zwNlrVrg t5a6cNsMrOxt4L6X5OW5WKe0xrygahophHibkkDCS6C3SxohYPtoSYdBIHENqtwDnVAZcluO/Owkh DWp5XzOQ==; 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 1djqRB-0002Vp-Dn; Mon, 21 Aug 2017 17:24:29 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1djqLi-0005WC-Jc for linux-arm-kernel@bombadil.infradead.org; Mon, 21 Aug 2017 17:18:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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=GuyOubelvJA7rWpAisvKFUWKQSlHIpAuJJBzrfBNATs=; b=JD8zlTAP5sN2bupclJUeqMJBx QD91/MTEoTZeXz/pWkuyeyWxQqS58eewpIdOOPLd23YBII82ElBpVC6l8QYIkoDWCR7iO9I6Ukhwq b5icWBBvGlqZtAS4d4CXf+maNucM1XB/LiC/TZpH+2IIXtDw1/fODdjlULkohEp8W/s5SHXFHbBqD THmln0+v0cyml7THABBYMzxAPq2mTN5e7PK1ZD9QFM0VDfyrlECjtaX36lL0Q8xyATGnMffT6A7eU UjtxEE8Y9GcWQaop9Iz4X2PKt2caS0ESILBz3Rk3pmN+uk31nj+eAb6V2okXIZR7t/RdQrEYxyhYs t4yj+gvbg==; Received: from mail-wr0-x22e.google.com ([2a00:1450:400c:c0c::22e]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1djpB1-0006dZ-1X for linux-arm-kernel@lists.infradead.org; Mon, 21 Aug 2017 16:03:44 +0000 Received: by mail-wr0-x22e.google.com with SMTP id k46so28392647wre.2 for ; Mon, 21 Aug 2017 09:03:22 -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=R7lXR5tfzre/VMW/CNNpYaNMFiT8dHXL5qyRmZWg1p108rIUqRGBpbi6QGTRq3qJmL 6DD4UI5j6TxMw0U7/hMG7g38xgAuyEeUtMR3VH9FbwyQURqNyI+mVRhN/HVilg4+OLb8 1tN0oNcdT2sKeeF6f7seY+BsqW4weO+d7cgvwkCjyspOK1jHHg2Z2k/S+U/JLMBFm4Xr YX1kC9U/daq2F5NzdXWFzILhDFhbavgDPPv/k3S+uc06V6U8y5nWEdE7GQe60l9yBpll LdZrphc0Ix9KtW0nr7HQ+KLeN2qmp74M6oLI0rEOPUVGH87/3e0emuK16HkuQ2BZOdfG RiGw== X-Gm-Message-State: AHYfb5jKOC1HikW40yWQGlU95tttG1weCZFGUNsTmk10H5XrAu+YzSTL bB2Iq5iHKYB/Bkv8 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 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> 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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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)