From patchwork Fri Mar 6 17:44:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 211133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0366AC10F25 for ; Fri, 6 Mar 2020 17:44:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB90D2072D for ; Fri, 6 Mar 2020 17:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725922AbgCFRo0 (ORCPT ); Fri, 6 Mar 2020 12:44:26 -0500 Received: from mx2.suse.de ([195.135.220.15]:60530 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbgCFRo0 (ORCPT ); Fri, 6 Mar 2020 12:44:26 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DCF25ACC2; Fri, 6 Mar 2020 17:44:24 +0000 (UTC) From: Nicolas Saenz Julienne To: adrian.hunter@intel.com, linux-kernel@vger.kernel.org Cc: phil@raspberrypi.com, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, f.fainelli@gmail.com, stefan.wahren@i2se.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Nicolas Saenz Julienne , Ulf Hansson Subject: [PATCH v2 03/11] mmc: sdhci: milbeaut: Use sdhci_set_power_and_voltage() Date: Fri, 6 Mar 2020 18:44:05 +0100 Message-Id: <20200306174413.20634-4-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306174413.20634-1-nsaenzjulienne@suse.de> References: <20200306174413.20634-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The sdhci core provides a helper function with the same functionality as this controller's set_power() callback. Use it instead. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci-milbeaut.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/mmc/host/sdhci-milbeaut.c b/drivers/mmc/host/sdhci-milbeaut.c index 92f30a1db435..4e7cc0680f94 100644 --- a/drivers/mmc/host/sdhci-milbeaut.c +++ b/drivers/mmc/host/sdhci-milbeaut.c @@ -121,17 +121,6 @@ static void sdhci_milbeaut_reset(struct sdhci_host *host, u8 mask) } } -static void sdhci_milbeaut_set_power(struct sdhci_host *host, - unsigned char mode, unsigned short vdd) -{ - if (!IS_ERR(host->mmc->supply.vmmc)) { - struct mmc_host *mmc = host->mmc; - - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); - } - sdhci_set_power_noreg(host, mode, vdd); -} - static const struct sdhci_ops sdhci_milbeaut_ops = { .voltage_switch = sdhci_milbeaut_soft_voltage_switch, .get_min_clock = sdhci_milbeaut_get_min_clock, @@ -139,7 +128,7 @@ static const struct sdhci_ops sdhci_milbeaut_ops = { .set_clock = sdhci_set_clock, .set_bus_width = sdhci_set_bus_width, .set_uhs_signaling = sdhci_set_uhs_signaling, - .set_power = sdhci_milbeaut_set_power, + .set_power = sdhci_set_power_and_bus_voltage, }; static void sdhci_milbeaut_bridge_reset(struct sdhci_host *host, From patchwork Fri Mar 6 17:44:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 211129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E68FAC10F00 for ; Fri, 6 Mar 2020 17:44:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CB6F42072D for ; Fri, 6 Mar 2020 17:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727141AbgCFRov (ORCPT ); Fri, 6 Mar 2020 12:44:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:60562 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbgCFRo3 (ORCPT ); Fri, 6 Mar 2020 12:44:29 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E4D87AC66; Fri, 6 Mar 2020 17:44:27 +0000 (UTC) From: Nicolas Saenz Julienne To: adrian.hunter@intel.com, linux-kernel@vger.kernel.org Cc: phil@raspberrypi.com, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, f.fainelli@gmail.com, stefan.wahren@i2se.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Nicolas Saenz Julienne , Ulf Hansson Subject: [PATCH v2 05/11] mmc: sdhci: pxav3: Use sdhci_set_power_and_voltage() Date: Fri, 6 Mar 2020 18:44:07 +0100 Message-Id: <20200306174413.20634-6-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306174413.20634-1-nsaenzjulienne@suse.de> References: <20200306174413.20634-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The sdhci core provides a helper function with the same functionality as this controller's set_power() callback. Use it instead. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci-pxav3.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index e55037ceda73..75fe90b88f9b 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c @@ -297,27 +297,9 @@ static void pxav3_set_uhs_signaling(struct sdhci_host *host, unsigned int uhs) __func__, uhs, ctrl_2); } -static void pxav3_set_power(struct sdhci_host *host, unsigned char mode, - unsigned short vdd) -{ - struct mmc_host *mmc = host->mmc; - u8 pwr = host->pwr; - - sdhci_set_power_noreg(host, mode, vdd); - - if (host->pwr == pwr) - return; - - if (host->pwr == 0) - vdd = 0; - - if (!IS_ERR(mmc->supply.vmmc)) - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); -} - static const struct sdhci_ops pxav3_sdhci_ops = { .set_clock = sdhci_set_clock, - .set_power = pxav3_set_power, + .set_power = sdhci_set_power_and_bus_voltage, .platform_send_init_74_clocks = pxav3_gen_init_74_clocks, .get_max_clock = sdhci_pltfm_clk_get_max_clock, .set_bus_width = sdhci_set_bus_width, From patchwork Fri Mar 6 17:44:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 211130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE04CC10DCE for ; Fri, 6 Mar 2020 17:44:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C70552072D for ; Fri, 6 Mar 2020 17:44:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726947AbgCFRob (ORCPT ); Fri, 6 Mar 2020 12:44:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:60580 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726866AbgCFRoa (ORCPT ); Fri, 6 Mar 2020 12:44:30 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E704DACC2; Fri, 6 Mar 2020 17:44:28 +0000 (UTC) From: Nicolas Saenz Julienne To: adrian.hunter@intel.com, linux-kernel@vger.kernel.org, Hu Ziji Cc: phil@raspberrypi.com, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, f.fainelli@gmail.com, stefan.wahren@i2se.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Nicolas Saenz Julienne , Ulf Hansson Subject: [PATCH v2 06/11] mmc: sdhci: xenon: Use sdhci_set_power_and_voltage() Date: Fri, 6 Mar 2020 18:44:08 +0100 Message-Id: <20200306174413.20634-7-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306174413.20634-1-nsaenzjulienne@suse.de> References: <20200306174413.20634-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The sdhci core provides a helper function with the same functionality as this controller's set_power() callback. Use it instead. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci-xenon.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c index 1dea1ba66f7b..1e9a7a76f2ba 100644 --- a/drivers/mmc/host/sdhci-xenon.c +++ b/drivers/mmc/host/sdhci-xenon.c @@ -213,24 +213,6 @@ static void xenon_set_uhs_signaling(struct sdhci_host *host, sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); } -static void xenon_set_power(struct sdhci_host *host, unsigned char mode, - unsigned short vdd) -{ - struct mmc_host *mmc = host->mmc; - u8 pwr = host->pwr; - - sdhci_set_power_noreg(host, mode, vdd); - - if (host->pwr == pwr) - return; - - if (host->pwr == 0) - vdd = 0; - - if (!IS_ERR(mmc->supply.vmmc)) - mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); -} - static void xenon_voltage_switch(struct sdhci_host *host) { /* Wait for 5ms after set 1.8V signal enable bit */ @@ -240,7 +222,7 @@ static void xenon_voltage_switch(struct sdhci_host *host) static const struct sdhci_ops sdhci_xenon_ops = { .voltage_switch = xenon_voltage_switch, .set_clock = sdhci_set_clock, - .set_power = xenon_set_power, + .set_power = sdhci_set_power_and_bus_voltage, .set_bus_width = sdhci_set_bus_width, .reset = xenon_reset, .set_uhs_signaling = xenon_set_uhs_signaling, From patchwork Fri Mar 6 17:44:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 211131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B87CCC10F25 for ; Fri, 6 Mar 2020 17:44:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B43120848 for ; Fri, 6 Mar 2020 17:44:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727079AbgCFRon (ORCPT ); Fri, 6 Mar 2020 12:44:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:60562 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726846AbgCFRoc (ORCPT ); Fri, 6 Mar 2020 12:44:32 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9759FAE95; Fri, 6 Mar 2020 17:44:30 +0000 (UTC) From: Nicolas Saenz Julienne To: adrian.hunter@intel.com, linux-kernel@vger.kernel.org Cc: phil@raspberrypi.com, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, f.fainelli@gmail.com, stefan.wahren@i2se.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Nicolas Saenz Julienne , Ulf Hansson Subject: [PATCH v2 08/11] mmc: sdhci: Unexport sdhci_set_power_noreg() Date: Fri, 6 Mar 2020 18:44:10 +0100 Message-Id: <20200306174413.20634-9-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306174413.20634-1-nsaenzjulienne@suse.de> References: <20200306174413.20634-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org There are no users left and, ideally, this isn't a function that should be called outside of core sdhci code. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci.c | 5 ++--- drivers/mmc/host/sdhci.h | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 6ed11f9554e8..37f0107fc276 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1926,8 +1926,8 @@ static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode, sdhci_writeb(host, 0, SDHCI_POWER_CONTROL); } -void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, - unsigned short vdd) +static void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, + unsigned short vdd) { u8 pwr = 0; @@ -1998,7 +1998,6 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, mdelay(10); } } -EXPORT_SYMBOL_GPL(sdhci_set_power_noreg); void sdhci_set_power(struct sdhci_host *host, unsigned char mode, unsigned short vdd) diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 1be7c18264cd..9bb84b0f87d5 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -775,8 +775,6 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode, void sdhci_set_power_and_bus_voltage(struct sdhci_host *host, unsigned char mode, unsigned short vdd); -void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode, - unsigned short vdd); void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq); void sdhci_set_bus_width(struct sdhci_host *host, int width); void sdhci_reset(struct sdhci_host *host, u8 mask); From patchwork Fri Mar 6 17:44:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Saenz Julienne X-Patchwork-Id: 211132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E24C0C10DCE for ; Fri, 6 Mar 2020 17:44:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C615A2084E for ; Fri, 6 Mar 2020 17:44:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbgCFRog (ORCPT ); Fri, 6 Mar 2020 12:44:36 -0500 Received: from mx2.suse.de ([195.135.220.15]:60580 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727052AbgCFRoe (ORCPT ); Fri, 6 Mar 2020 12:44:34 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8D8E5AEC5; Fri, 6 Mar 2020 17:44:33 +0000 (UTC) From: Nicolas Saenz Julienne To: adrian.hunter@intel.com, linux-kernel@vger.kernel.org, Rob Herring , Nicolas Saenz Julienne Cc: phil@raspberrypi.com, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, f.fainelli@gmail.com, stefan.wahren@i2se.com, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Date: Fri, 6 Mar 2020 18:44:13 +0100 Message-Id: <20200306174413.20634-12-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306174413.20634-1-nsaenzjulienne@suse.de> References: <20200306174413.20634-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The SD card power can be controlled trough a pin routed into the board's external GPIO expander. Turn that into a regulator and provide it to emmc2. Signed-off-by: Nicolas Saenz Julienne --- arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts index b0ea8233b636..a2da058396fe 100644 --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts @@ -55,6 +55,16 @@ sd_io_1v8_reg: sd_io_1v8_reg { 3300000 0x0>; status = "okay"; }; + + sd_vcc_reg: sd_vcc_reg { + compatible = "regulator-fixed"; + regulator-name = "vcc-sd"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + enable-active-high; + gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>; + }; }; &firmware { @@ -173,6 +183,7 @@ brcmf: wifi@1 { /* EMMC2 is used to drive the SD card */ &emmc2 { vqmmc-supply = <&sd_io_1v8_reg>; + vmmc-supply = <&sd_vcc_reg>; broken-cd; status = "okay"; };