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: 9881869 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 705F8602B8 for ; Fri, 4 Aug 2017 17:49:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BF2D281C3 for ; Fri, 4 Aug 2017 17:49:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D95B284FC; Fri, 4 Aug 2017 17:49:14 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=unavailable 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 DE9AB281C3 for ; Fri, 4 Aug 2017 17:49:13 +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=Dyh2fKOtxUHXsnU3CoCg/yHLTNmTgUsT9efI0J9x98s=; b=otB7sX4mt1l0ff3mcW2zPb43ZS rj8av0jPVtnD3RzlPU1MdWVNdApqJa1nr7qbOv3fF5wWfV/sFAqjByfeU5OvCNXy32aCRC8jLGtKp xc4GJJBOXeK3nYfLGlxmSs0wSTsR4ZOceiQ/+5SUBSBh0bTp+kUf9q2PK2O36s9gy/3dAURVIVi1v rw2uE1tGMw3WBHDLNTr0fooysEVlH/aEnws11OPHzqsOcnepr+dwbyEPEyem4rxkvGqpQuqOMZq/1 /2uHHqOg5cD+W/8YfGjHr2rXRhnwywOJ3dXjdPSC4ieDiOPRQ4y+kfHamv2PwfkuxoaiLeMo70BZ+ nizms4kw==; 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 1ddgik-0002d1-0L; Fri, 04 Aug 2017 17:49:10 +0000 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ddgeM-0006Jv-1R for linux-arm-kernel@lists.infradead.org; Fri, 04 Aug 2017 17:45:24 +0000 Received: by mail-wr0-x230.google.com with SMTP id y43so19271792wrd.3 for ; Fri, 04 Aug 2017 10:44:20 -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=m/XZoCWnj/fIbLi3fx++/FZOMVxxCwidEnoDJuHghtg8tEsLvlcwOpQHTDvoWOq9HA faSeY1ePr4i0tJ4IcgtonCT9tG9tCZYGJ8ECn/ailJZfP3Ck+o/iDIfJrL3MBWyudfDz 3qI01r4mEpZOvICTfsI0ZDv4GcVYfQlX4BH25dzt5trx6okYFmvgamd8vC1gafUsBcIz YUEGChd4PlbMPly+D+gYjKzIh9hgjZK3GJL8HKmNaY3xSG4IcX7CaJmNDyxidk2oN42W j7+azji+RzmYKyjV4mxjFxX2mK+pV5L3LLkEbXMHW5lWkntT6WVRic6C1rYdOIfcBkd7 84Uw== X-Gm-Message-State: AIVw112FYRf1uNzWaPJVC1PXOeath+2/AI70F1xIg2Xb5ZG2GM4mmURj P/MMiCG9jF9etlQg 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170804_104439_672869_AB83953E X-CRM114-Status: GOOD ( 11.69 ) 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. Signed-off-by: Jerome Brunet --- drivers/mmc/host/meson-gx-mmc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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)