From patchwork Fri Mar 6 10:38:46 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: 211142 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=ham 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 B0148C10F27 for ; Fri, 6 Mar 2020 10:39:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8D97C20848 for ; Fri, 6 Mar 2020 10:39:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726973AbgCFKjW (ORCPT ); Fri, 6 Mar 2020 05:39:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:44058 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726359AbgCFKjW (ORCPT ); Fri, 6 Mar 2020 05:39:22 -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 ABC6EAC46; Fri, 6 Mar 2020 10:39:20 +0000 (UTC) From: Nicolas Saenz Julienne To: devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Adrian Hunter Cc: ulf.hansson@linaro.org, f.fainelli@gmail.com, phil@raspberrypi.org, Nicolas Saenz Julienne , linux-kernel@vger.kernel.org Subject: [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE Date: Fri, 6 Mar 2020 11:38:46 +0100 Message-Id: <20200306103857.23962-2-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306103857.23962-1-nsaenzjulienne@suse.de> References: <20200306103857.23962-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 Adds quirk for controllers whose bus power select register has to be set even when powering SD cards from a regulator. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci.c | 5 +++++ drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index c59566363a42..c7fd87447457 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1920,6 +1920,11 @@ static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode, mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); + if (host->quirks2 & SDHCI_QUIRK2_SET_BUS_VOLTAGE) { + sdhci_set_power_noreg(host, mode, vdd); + return; + } + if (mode != MMC_POWER_OFF) sdhci_writeb(host, SDHCI_POWER_ON, SDHCI_POWER_CONTROL); else diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index cac2d97782e6..9531a4e5b148 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -484,6 +484,8 @@ struct sdhci_host { * block count. */ #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18) +/* Set bus voltage even when powering from an external regulator */ +#define SDHCI_QUIRK2_SET_BUS_VOLTAGE (1<<19) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */ From patchwork Fri Mar 6 10:38:47 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: 211137 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 0182EC10F00 for ; Fri, 6 Mar 2020 10:40:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CCEA421744 for ; Fri, 6 Mar 2020 10:40:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727026AbgCFKjY (ORCPT ); Fri, 6 Mar 2020 05:39:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:44104 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726970AbgCFKjX (ORCPT ); Fri, 6 Mar 2020 05:39:23 -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 A510AADC9; Fri, 6 Mar 2020 10:39:21 +0000 (UTC) From: Nicolas Saenz Julienne To: devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Adrian Hunter Cc: ulf.hansson@linaro.org, f.fainelli@gmail.com, phil@raspberrypi.org, Nicolas Saenz Julienne , linux-kernel@vger.kernel.org Subject: [PATCH 02/10] mmc: sdhci: milbeaut: Use quirk instead of custom set_power() Date: Fri, 6 Mar 2020 11:38:47 +0100 Message-Id: <20200306103857.23962-3-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306103857.23962-1-nsaenzjulienne@suse.de> References: <20200306103857.23962-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 With the introduction of SDHCI_QUIRK2_SET_BUS_VOLTAGE there is no need to use a custom set_power() implementation as the quirk takes care of configuring the bus voltage register even when powering trough a regulator. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci-milbeaut.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/host/sdhci-milbeaut.c b/drivers/mmc/host/sdhci-milbeaut.c index 92f30a1db435..6a935554c54d 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,6 @@ 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, }; static void sdhci_milbeaut_bridge_reset(struct sdhci_host *host, @@ -262,7 +250,8 @@ static int sdhci_milbeaut_probe(struct platform_device *pdev) SDHCI_QUIRK_DELAY_AFTER_POWER; host->quirks2 = SDHCI_QUIRK2_SUPPORT_SINGLE | SDHCI_QUIRK2_TUNING_WORK_AROUND | - SDHCI_QUIRK2_PRESET_VALUE_BROKEN; + SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + SDHCI_QUIRK2_SET_BUS_VOLTAGE; priv->enable_cmd_dat_delay = device_property_read_bool(dev, "fujitsu,cmd-dat-delay-select"); From patchwork Fri Mar 6 10:38:48 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: 211141 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 DE2E5C10F00 for ; Fri, 6 Mar 2020 10:39:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BCDAB2166E for ; Fri, 6 Mar 2020 10:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbgCFKjZ (ORCPT ); Fri, 6 Mar 2020 05:39:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:44144 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726998AbgCFKjY (ORCPT ); Fri, 6 Mar 2020 05:39:24 -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 BAF70B1A6; Fri, 6 Mar 2020 10:39:22 +0000 (UTC) From: Nicolas Saenz Julienne To: devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Michal Simek , Adrian Hunter Cc: ulf.hansson@linaro.org, f.fainelli@gmail.com, phil@raspberrypi.org, Nicolas Saenz Julienne , linux-kernel@vger.kernel.org Subject: [PATCH 03/10] mmc: sdhci: arsan: Use quirk instead of custom set_power() Date: Fri, 6 Mar 2020 11:38:48 +0100 Message-Id: <20200306103857.23962-4-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306103857.23962-1-nsaenzjulienne@suse.de> References: <20200306103857.23962-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 With the introduction of SDHCI_QUIRK2_SET_BUS_VOLTAGE there is no need to use a custom set_power() implementation as the quirk takes care of configuring the bus voltage register even when powering trough a regulator. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci-of-arasan.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 0146d7dd315b..928953bbdc10 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -325,17 +325,6 @@ static int sdhci_arasan_voltage_switch(struct mmc_host *mmc, return -EINVAL; } -static void sdhci_arasan_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_arasan_ops = { .set_clock = sdhci_arasan_set_clock, .get_max_clock = sdhci_pltfm_clk_get_max_clock, @@ -343,7 +332,6 @@ static const struct sdhci_ops sdhci_arasan_ops = { .set_bus_width = sdhci_set_bus_width, .reset = sdhci_arasan_reset, .set_uhs_signaling = sdhci_set_uhs_signaling, - .set_power = sdhci_arasan_set_power, }; static const struct sdhci_pltfm_data sdhci_arasan_pdata = { @@ -351,7 +339,8 @@ static const struct sdhci_pltfm_data sdhci_arasan_pdata = { .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN | - SDHCI_QUIRK2_STOP_WITH_TC, + SDHCI_QUIRK2_STOP_WITH_TC | + SDHCI_QUIRK2_SET_BUS_VOLTAGE, }; static struct sdhci_arasan_of_data sdhci_arasan_data = { @@ -362,7 +351,8 @@ static const struct sdhci_pltfm_data sdhci_arasan_zynqmp_pdata = { .ops = &sdhci_arasan_ops, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN | - SDHCI_QUIRK2_STOP_WITH_TC, + SDHCI_QUIRK2_STOP_WITH_TC | + SDHCI_QUIRK2_SET_BUS_VOLTAGE, }; static struct sdhci_arasan_of_data sdhci_arasan_zynqmp_data = { @@ -414,7 +404,6 @@ static const struct sdhci_ops sdhci_arasan_cqe_ops = { .set_bus_width = sdhci_set_bus_width, .reset = sdhci_arasan_reset, .set_uhs_signaling = sdhci_set_uhs_signaling, - .set_power = sdhci_arasan_set_power, .irq = sdhci_arasan_cqhci_irq, }; @@ -422,7 +411,8 @@ static const struct sdhci_pltfm_data sdhci_arasan_cqe_pdata = { .ops = &sdhci_arasan_cqe_ops, .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | - SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN, + SDHCI_QUIRK2_CLOCK_DIV_ZERO_BROKEN | + SDHCI_QUIRK2_SET_BUS_VOLTAGE, }; static struct sdhci_arasan_of_data sdhci_arasan_rk3399_data = { From patchwork Fri Mar 6 10:38:50 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: 211138 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=ham 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 DD02FC3F2D6 for ; Fri, 6 Mar 2020 10:40:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B70D52084E for ; Fri, 6 Mar 2020 10:40:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727332AbgCFKkJ (ORCPT ); Fri, 6 Mar 2020 05:40:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:44240 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbgCFKj0 (ORCPT ); Fri, 6 Mar 2020 05:39: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 9FF06B22D; Fri, 6 Mar 2020 10:39:24 +0000 (UTC) From: Nicolas Saenz Julienne To: devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Adrian Hunter Cc: ulf.hansson@linaro.org, f.fainelli@gmail.com, phil@raspberrypi.org, Nicolas Saenz Julienne , linux-kernel@vger.kernel.org Subject: [PATCH 05/10] mmc: sdhci: pxav3: Use quirk instead of custom set_power() Date: Fri, 6 Mar 2020 11:38:50 +0100 Message-Id: <20200306103857.23962-6-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306103857.23962-1-nsaenzjulienne@suse.de> References: <20200306103857.23962-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 With the introduction of SDHCI_QUIRK2_SET_BUS_VOLTAGE there is no need to use a custom set_power() implementation as the quirk takes care of configuring the bus voltage register even when powering trough a regulator. 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..dc4a1e69e6f6 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c @@ -297,27 +297,8 @@ 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, .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, @@ -330,6 +311,7 @@ static const struct sdhci_pltfm_data sdhci_pxav3_pdata = { | SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC | SDHCI_QUIRK_32BIT_ADMA_SIZE | SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, + .quirks2 = SDHCI_QUIRK2_SET_BUS_VOLTAGE, .ops = &pxav3_sdhci_ops, }; From patchwork Fri Mar 6 10:38:52 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: 211140 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=ham 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 04E68C10F00 for ; Fri, 6 Mar 2020 10:39:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D923C2072D for ; Fri, 6 Mar 2020 10:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727125AbgCFKja (ORCPT ); Fri, 6 Mar 2020 05:39:30 -0500 Received: from mx2.suse.de ([195.135.220.15]:44310 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727071AbgCFKj2 (ORCPT ); Fri, 6 Mar 2020 05:39:28 -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 7C308B230; Fri, 6 Mar 2020 10:39:26 +0000 (UTC) From: Nicolas Saenz Julienne To: devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Adrian Hunter Cc: ulf.hansson@linaro.org, f.fainelli@gmail.com, phil@raspberrypi.org, Nicolas Saenz Julienne , linux-kernel@vger.kernel.org Subject: [PATCH 07/10] mmc: sdhci: am654: Use quirk instead of custom set_power() Date: Fri, 6 Mar 2020 11:38:52 +0100 Message-Id: <20200306103857.23962-8-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306103857.23962-1-nsaenzjulienne@suse.de> References: <20200306103857.23962-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 With the introduction of SDHCI_QUIRK2_SET_BUS_VOLTAGE there is no need to use a custom set_power() implementation as the quirk takes care of configuring the bus voltage register even when powering trough a regulator. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci_am654.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c index 58183b5f4e82..4629596da86a 100644 --- a/drivers/mmc/host/sdhci_am654.c +++ b/drivers/mmc/host/sdhci_am654.c @@ -255,17 +255,6 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host, sdhci_set_clock(host, clock); } -static void sdhci_am654_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 void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg) { unsigned char timing = host->mmc->ios.timing; @@ -321,7 +310,6 @@ static struct sdhci_ops sdhci_am654_ops = { .get_timeout_clock = sdhci_pltfm_clk_get_max_clock, .set_uhs_signaling = sdhci_set_uhs_signaling, .set_bus_width = sdhci_set_bus_width, - .set_power = sdhci_am654_set_power, .set_clock = sdhci_am654_set_clock, .write_b = sdhci_am654_write_b, .irq = sdhci_am654_cqhci_irq, @@ -331,7 +319,8 @@ static struct sdhci_ops sdhci_am654_ops = { static const struct sdhci_pltfm_data sdhci_am654_pdata = { .ops = &sdhci_am654_ops, .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + SDHCI_QUIRK2_SET_BUS_VOLTAGE, }; static const struct sdhci_am654_driver_data sdhci_am654_drvdata = { @@ -344,7 +333,6 @@ static struct sdhci_ops sdhci_j721e_8bit_ops = { .get_timeout_clock = sdhci_pltfm_clk_get_max_clock, .set_uhs_signaling = sdhci_set_uhs_signaling, .set_bus_width = sdhci_set_bus_width, - .set_power = sdhci_am654_set_power, .set_clock = sdhci_am654_set_clock, .write_b = sdhci_am654_write_b, .irq = sdhci_am654_cqhci_irq, @@ -354,7 +342,8 @@ static struct sdhci_ops sdhci_j721e_8bit_ops = { static const struct sdhci_pltfm_data sdhci_j721e_8bit_pdata = { .ops = &sdhci_j721e_8bit_ops, .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + SDHCI_QUIRK2_SET_BUS_VOLTAGE, }; static const struct sdhci_am654_driver_data sdhci_j721e_8bit_drvdata = { @@ -367,7 +356,6 @@ static struct sdhci_ops sdhci_j721e_4bit_ops = { .get_timeout_clock = sdhci_pltfm_clk_get_max_clock, .set_uhs_signaling = sdhci_set_uhs_signaling, .set_bus_width = sdhci_set_bus_width, - .set_power = sdhci_am654_set_power, .set_clock = sdhci_j721e_4bit_set_clock, .write_b = sdhci_am654_write_b, .irq = sdhci_am654_cqhci_irq, @@ -377,7 +365,8 @@ static struct sdhci_ops sdhci_j721e_4bit_ops = { static const struct sdhci_pltfm_data sdhci_j721e_4bit_pdata = { .ops = &sdhci_j721e_4bit_ops, .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + SDHCI_QUIRK2_SET_BUS_VOLTAGE, }; static const struct sdhci_am654_driver_data sdhci_j721e_4bit_drvdata = { From patchwork Fri Mar 6 10:38:54 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: 211139 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 C641BC10F26 for ; Fri, 6 Mar 2020 10:39:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A683520848 for ; Fri, 6 Mar 2020 10:39:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727250AbgCFKjr (ORCPT ); Fri, 6 Mar 2020 05:39:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:44144 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbgCFKja (ORCPT ); Fri, 6 Mar 2020 05:39: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 B28D3B31F; Fri, 6 Mar 2020 10:39:28 +0000 (UTC) From: Nicolas Saenz Julienne To: devicetree@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, Adrian Hunter , Ray Jui , Scott Branden Cc: ulf.hansson@linaro.org, f.fainelli@gmail.com, phil@raspberrypi.org, Nicolas Saenz Julienne , linux-kernel@vger.kernel.org Subject: [PATCH 09/10] mmc: sdhci: iproc: Use SDHCI_QUIRK2_SET_BUS_VOLTAGE on bcm2711 Date: Fri, 6 Mar 2020 11:38:54 +0100 Message-Id: <20200306103857.23962-10-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200306103857.23962-1-nsaenzjulienne@suse.de> References: <20200306103857.23962-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 Although vmmc is provided by a regulator, bcm2711's sdhci-iproc needs its bus voltage register to be set to a non-zero value. Failure to do so turns the core off. Signed-off-by: Nicolas Saenz Julienne --- drivers/mmc/host/sdhci-iproc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c index f4f5f0a70cda..e2fab52d6721 100644 --- a/drivers/mmc/host/sdhci-iproc.c +++ b/drivers/mmc/host/sdhci-iproc.c @@ -263,6 +263,7 @@ static const struct sdhci_iproc_data bcm2835_data = { static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = { .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, + .quirks2 = SDHCI_QUIRK2_SET_BUS_VOLTAGE, .ops = &sdhci_iproc_32only_ops, };