* [PATCH 00/10] Raspberry Pi vmmc regulator support
@ 2020-03-06 10:38 Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE Nicolas Saenz Julienne
` (10 more replies)
0 siblings, 11 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc
Cc: adrian.hunter, ulf.hansson, f.fainelli, phil,
Nicolas Saenz Julienne, linux-kernel
The series snowballed into adding a new quirk, as I reliased
sdhci-iproc's behaviour is not that uncommon.
Based on Phil Elwell's work in the downstream Raspberry Pi kernel.
---
Nicolas Saenz Julienne (10):
mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE
mmc: sdhci: milbeaut: Use quirk instead of custom set_power()
mmc: sdhci: arsan: Use quirk instead of custom set_power()
mmc: sdhci: at-91: Use quirk instead of custom set_power()
mmc: sdhci: pxav3: Use quirk instead of custom set_power()
mmc: sdhci: xenon: Use quirk instead of custom set_power()
mmc: sdhci: am654: Use quirk instead of custom set_power()
mmc: sdhci: Unexport sdhci_set_power_noreg()
mmc: sdhci: iproc: Use SDHCI_QUIRK2_SET_BUS_VOLTAGE on bcm2711
ARM: dts: bcm2711: Add sd_vcc regulator to emmc2
arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 11 +++++++++
drivers/mmc/host/sdhci-iproc.c | 1 +
drivers/mmc/host/sdhci-milbeaut.c | 15 ++----------
drivers/mmc/host/sdhci-of-arasan.c | 22 +++++------------
drivers/mmc/host/sdhci-of-at91.c | 18 +-------------
drivers/mmc/host/sdhci-pxav3.c | 20 +---------------
drivers/mmc/host/sdhci-xenon.c | 20 +---------------
drivers/mmc/host/sdhci.c | 34 +++++++++++++++------------
drivers/mmc/host/sdhci.h | 4 ++--
drivers/mmc/host/sdhci_am654.c | 23 +++++-------------
10 files changed, 50 insertions(+), 118 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 12:34 ` Adrian Hunter
2020-03-06 10:38 ` [PATCH 02/10] mmc: sdhci: milbeaut: Use quirk instead of custom set_power() Nicolas Saenz Julienne
` (9 subsequent siblings)
10 siblings, 1 reply; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Adrian Hunter
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
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 <nsaenzjulienne@suse.de>
---
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 */
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 02/10] mmc: sdhci: milbeaut: Use quirk instead of custom set_power()
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 03/10] mmc: sdhci: arsan: " Nicolas Saenz Julienne
` (8 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Adrian Hunter
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
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 <nsaenzjulienne@suse.de>
---
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");
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 03/10] mmc: sdhci: arsan: Use quirk instead of custom set_power()
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 02/10] mmc: sdhci: milbeaut: Use quirk instead of custom set_power() Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 04/10] mmc: sdhci: at-91: " Nicolas Saenz Julienne
` (7 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Michal Simek, Adrian Hunter
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
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 <nsaenzjulienne@suse.de>
---
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 = {
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 04/10] mmc: sdhci: at-91: Use quirk instead of custom set_power()
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
` (2 preceding siblings ...)
2020-03-06 10:38 ` [PATCH 03/10] mmc: sdhci: arsan: " Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 05/10] mmc: sdhci: pxav3: " Nicolas Saenz Julienne
` (6 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Adrian Hunter, Ludovic Desroches,
Nicolas Ferre, Alexandre Belloni
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
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 <nsaenzjulienne@suse.de>
---
drivers/mmc/host/sdhci-of-at91.c | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
index ab2bd314a390..395fe93b78d3 100644
--- a/drivers/mmc/host/sdhci-of-at91.c
+++ b/drivers/mmc/host/sdhci-of-at91.c
@@ -101,22 +101,6 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
}
-/*
- * In this specific implementation of the SDHCI controller, the power register
- * needs to have a valid voltage set even when the power supply is managed by
- * an external regulator.
- */
-static void sdhci_at91_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_at91_set_uhs_signaling(struct sdhci_host *host,
unsigned int timing)
{
@@ -145,11 +129,11 @@ static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
.set_bus_width = sdhci_set_bus_width,
.reset = sdhci_at91_reset,
.set_uhs_signaling = sdhci_at91_set_uhs_signaling,
- .set_power = sdhci_at91_set_power,
};
static const struct sdhci_pltfm_data sdhci_sama5d2_pdata = {
.ops = &sdhci_at91_sama5d2_ops,
+ .quirks2 = SDHCI_QUIRK2_SET_BUS_VOLTAGE,
};
static const struct sdhci_at91_soc_data soc_data_sama5d2 = {
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 05/10] mmc: sdhci: pxav3: Use quirk instead of custom set_power()
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
` (3 preceding siblings ...)
2020-03-06 10:38 ` [PATCH 04/10] mmc: sdhci: at-91: " Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 06/10] mmc: sdhci: xenon: " Nicolas Saenz Julienne
` (5 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Adrian Hunter
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
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 <nsaenzjulienne@suse.de>
---
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,
};
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 06/10] mmc: sdhci: xenon: Use quirk instead of custom set_power()
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
` (4 preceding siblings ...)
2020-03-06 10:38 ` [PATCH 05/10] mmc: sdhci: pxav3: " Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 07/10] mmc: sdhci: am654: " Nicolas Saenz Julienne
` (4 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Hu Ziji, Adrian Hunter
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
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 <nsaenzjulienne@suse.de>
---
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..5bca5f9e5660 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,6 @@ 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_bus_width = sdhci_set_bus_width,
.reset = xenon_reset,
.set_uhs_signaling = xenon_set_uhs_signaling,
@@ -252,6 +233,7 @@ static const struct sdhci_pltfm_data sdhci_xenon_pdata = {
.quirks = SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC |
SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN,
+ .quirks2 = SDHCI_QUIRK2_SET_BUS_VOLTAGE,
};
/*
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 07/10] mmc: sdhci: am654: Use quirk instead of custom set_power()
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
` (5 preceding siblings ...)
2020-03-06 10:38 ` [PATCH 06/10] mmc: sdhci: xenon: " Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 08/10] mmc: sdhci: Unexport sdhci_set_power_noreg() Nicolas Saenz Julienne
` (3 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Adrian Hunter
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
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 <nsaenzjulienne@suse.de>
---
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 = {
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 08/10] mmc: sdhci: Unexport sdhci_set_power_noreg()
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
` (6 preceding siblings ...)
2020-03-06 10:38 ` [PATCH 07/10] mmc: sdhci: am654: " Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 09/10] mmc: sdhci: iproc: Use SDHCI_QUIRK2_SET_BUS_VOLTAGE on bcm2711 Nicolas Saenz Julienne
` (2 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Adrian Hunter
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
There are no users left and, ideally, it's not a function that should be
called outside of the core sdhci code.
As sdhci_set_power_reg() depends on sdhci_set_power_noreg() it was moved
underneath it.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
drivers/mmc/host/sdhci.c | 39 +++++++++++++++++++--------------------
drivers/mmc/host/sdhci.h | 2 --
2 files changed, 19 insertions(+), 22 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c7fd87447457..728442b129f4 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1913,25 +1913,7 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
}
EXPORT_SYMBOL_GPL(sdhci_set_clock);
-static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode,
- unsigned short vdd)
-{
- struct mmc_host *mmc = host->mmc;
-
- 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
- sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
-}
-
-void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
+static void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
unsigned short vdd)
{
u8 pwr = 0;
@@ -2003,7 +1985,24 @@ void sdhci_set_power_noreg(struct sdhci_host *host, unsigned char mode,
mdelay(10);
}
}
-EXPORT_SYMBOL_GPL(sdhci_set_power_noreg);
+
+static void sdhci_set_power_reg(struct sdhci_host *host, unsigned char mode,
+ unsigned short vdd)
+{
+ struct mmc_host *mmc = host->mmc;
+
+ 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
+ sdhci_writeb(host, 0, SDHCI_POWER_CONTROL);
+}
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 9531a4e5b148..330557434519 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -774,8 +774,6 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock);
void sdhci_enable_clk(struct sdhci_host *host, u16 clk);
void sdhci_set_power(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);
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 09/10] mmc: sdhci: iproc: Use SDHCI_QUIRK2_SET_BUS_VOLTAGE on bcm2711
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
` (7 preceding siblings ...)
2020-03-06 10:38 ` [PATCH 08/10] mmc: sdhci: Unexport sdhci_set_power_noreg() Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 10/10] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
2020-03-06 10:46 ` [PATCH 00/10] Raspberry Pi vmmc regulator support Phil Elwell
10 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Adrian Hunter, Ray Jui,
Scott Branden
Cc: ulf.hansson, f.fainelli, phil, Nicolas Saenz Julienne, linux-kernel
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 <nsaenzjulienne@suse.de>
---
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,
};
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 10/10] ARM: dts: bcm2711: Add vmmc regulator in emmc2
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
` (8 preceding siblings ...)
2020-03-06 10:38 ` [PATCH 09/10] mmc: sdhci: iproc: Use SDHCI_QUIRK2_SET_BUS_VOLTAGE on bcm2711 Nicolas Saenz Julienne
@ 2020-03-06 10:38 ` Nicolas Saenz Julienne
2020-03-06 11:07 ` Stefan Wahren
2020-03-06 10:46 ` [PATCH 00/10] Raspberry Pi vmmc regulator support Phil Elwell
10 siblings, 1 reply; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:38 UTC (permalink / raw)
To: devicetree, bcm-kernel-feedback-list, linux-rpi-kernel,
linux-arm-kernel, linux-mmc, Rob Herring, Nicolas Saenz Julienne
Cc: adrian.hunter, ulf.hansson, f.fainelli, phil, linux-kernel
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 <nsaenzjulienne@suse.de>
---
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 e26ea9006378..8e98e917f9f4 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -56,6 +56,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 {
@@ -174,6 +184,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";
};
--
2.25.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 00/10] Raspberry Pi vmmc regulator support
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
` (9 preceding siblings ...)
2020-03-06 10:38 ` [PATCH 10/10] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
@ 2020-03-06 10:46 ` Phil Elwell
2020-03-06 10:52 ` Nicolas Saenz Julienne
10 siblings, 1 reply; 18+ messages in thread
From: Phil Elwell @ 2020-03-06 10:46 UTC (permalink / raw)
To: Nicolas Saenz Julienne, devicetree, bcm-kernel-feedback-list,
linux-rpi-kernel, linux-arm-kernel, linux-mmc
Cc: adrian.hunter, ulf.hansson, f.fainelli, linux-kernel
Hi Nicolas,
On 06/03/2020 10:38, Nicolas Saenz Julienne wrote:
> The series snowballed into adding a new quirk, as I reliased
> sdhci-iproc's behaviour is not that uncommon.
>
> Based on Phil Elwell's work in the downstream Raspberry Pi kernel.
There are a few typos in the commit messages ("reliased" -> "realised",
"trough" -> "through"), but otherwise:
Reviewed-by: Phil Elwell <phil@raspberrypi.com>
Phil
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 00/10] Raspberry Pi vmmc regulator support
2020-03-06 10:46 ` [PATCH 00/10] Raspberry Pi vmmc regulator support Phil Elwell
@ 2020-03-06 10:52 ` Nicolas Saenz Julienne
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 10:52 UTC (permalink / raw)
To: Phil Elwell, devicetree, bcm-kernel-feedback-list,
linux-rpi-kernel, linux-arm-kernel, linux-mmc
Cc: ulf.hansson, f.fainelli, adrian.hunter, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 571 bytes --]
On Fri, 2020-03-06 at 10:46 +0000, Phil Elwell wrote:
> Hi Nicolas,
>
> On 06/03/2020 10:38, Nicolas Saenz Julienne wrote:
> > The series snowballed into adding a new quirk, as I reliased
> > sdhci-iproc's behaviour is not that uncommon.
> >
> > Based on Phil Elwell's work in the downstream Raspberry Pi kernel.
>
> There are a few typos in the commit messages ("reliased" -> "realised",
> "trough" -> "through"), but otherwise:
Noted, I'll do an typo sweep for v2.
> Reviewed-by: Phil Elwell <phil@raspberrypi.com>
Thanks!
Regards,
Nicolas
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 10/10] ARM: dts: bcm2711: Add vmmc regulator in emmc2
2020-03-06 10:38 ` [PATCH 10/10] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
@ 2020-03-06 11:07 ` Stefan Wahren
2020-03-06 11:35 ` Phil Elwell
0 siblings, 1 reply; 18+ messages in thread
From: Stefan Wahren @ 2020-03-06 11:07 UTC (permalink / raw)
To: Nicolas Saenz Julienne, devicetree, bcm-kernel-feedback-list,
linux-rpi-kernel, linux-arm-kernel, linux-mmc, Rob Herring
Cc: ulf.hansson, f.fainelli, phil, adrian.hunter, linux-kernel
Hi Nicolas,
On 06.03.20 11:38, Nicolas Saenz Julienne wrote:
> 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 <nsaenzjulienne@suse.de>
> ---
> 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 e26ea9006378..8e98e917f9f4 100644
> --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> @@ -56,6 +56,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>;
this new GPIO has an empty GPIO label, please add it.
> + };
> };
>
> &firmware {
> @@ -174,6 +184,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";
> };
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 10/10] ARM: dts: bcm2711: Add vmmc regulator in emmc2
2020-03-06 11:07 ` Stefan Wahren
@ 2020-03-06 11:35 ` Phil Elwell
2020-03-06 11:37 ` Nicolas Saenz Julienne
0 siblings, 1 reply; 18+ messages in thread
From: Phil Elwell @ 2020-03-06 11:35 UTC (permalink / raw)
To: Stefan Wahren, Nicolas Saenz Julienne, devicetree,
bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
linux-mmc, Rob Herring
Cc: ulf.hansson, f.fainelli, phil, adrian.hunter, linux-kernel
Nicolas, Stefan,
On 06/03/2020 11:07, Stefan Wahren wrote:
> Hi Nicolas,
>
> On 06.03.20 11:38, Nicolas Saenz Julienne wrote:
>> 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 <nsaenzjulienne@suse.de>
>> ---
>> 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 e26ea9006378..8e98e917f9f4 100644
>> --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
>> +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
>> @@ -56,6 +56,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>;
> this new GPIO has an empty GPIO label, please add it.
The correct name would be "SD_PWR_ON".
>> + };
>> };
>>
>> &firmware {
>> @@ -174,6 +184,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";
>> };
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 10/10] ARM: dts: bcm2711: Add vmmc regulator in emmc2
2020-03-06 11:35 ` Phil Elwell
@ 2020-03-06 11:37 ` Nicolas Saenz Julienne
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 11:37 UTC (permalink / raw)
To: Phil Elwell, Stefan Wahren, devicetree, bcm-kernel-feedback-list,
linux-rpi-kernel, linux-arm-kernel, linux-mmc, Rob Herring
Cc: ulf.hansson, f.fainelli, phil, adrian.hunter, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]
On Fri, 2020-03-06 at 11:35 +0000, Phil Elwell wrote:
> Nicolas, Stefan,
>
> On 06/03/2020 11:07, Stefan Wahren wrote:
> > Hi Nicolas,
> >
> > On 06.03.20 11:38, Nicolas Saenz Julienne wrote:
> > > 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 <nsaenzjulienne@suse.de>
> > > ---
> > > 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 e26ea9006378..8e98e917f9f4 100644
> > > --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> > > +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> > > @@ -56,6 +56,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>;
> > this new GPIO has an empty GPIO label, please add it.
>
> The correct name would be "SD_PWR_ON".
Noted
Regrads,
Nicolas
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE
2020-03-06 10:38 ` [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE Nicolas Saenz Julienne
@ 2020-03-06 12:34 ` Adrian Hunter
2020-03-06 12:40 ` Nicolas Saenz Julienne
0 siblings, 1 reply; 18+ messages in thread
From: Adrian Hunter @ 2020-03-06 12:34 UTC (permalink / raw)
To: Nicolas Saenz Julienne, devicetree, bcm-kernel-feedback-list,
linux-rpi-kernel, linux-arm-kernel, linux-mmc
Cc: ulf.hansson, f.fainelli, phil, linux-kernel
On 6/03/20 12:38 pm, Nicolas Saenz Julienne wrote:
> 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 <nsaenzjulienne@suse.de>
> ---
> 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) {
We don't really want to replace callbacks by quirks.
Replace sdhci_milbeaut_set_power() etc by a common fn in sdhci.c if you want.
> + 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 */
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE
2020-03-06 12:34 ` Adrian Hunter
@ 2020-03-06 12:40 ` Nicolas Saenz Julienne
0 siblings, 0 replies; 18+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 12:40 UTC (permalink / raw)
To: Adrian Hunter, devicetree, bcm-kernel-feedback-list,
linux-rpi-kernel, linux-arm-kernel, linux-mmc
Cc: ulf.hansson, f.fainelli, phil, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]
On Fri, 2020-03-06 at 14:34 +0200, Adrian Hunter wrote:
> On 6/03/20 12:38 pm, Nicolas Saenz Julienne wrote:
> > 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 <nsaenzjulienne@suse.de>
> > ---
> > 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) {
>
> We don't really want to replace callbacks by quirks.
>
> Replace sdhci_milbeaut_set_power() etc by a common fn in sdhci.c if you want.
Ok, fair enough.
Regards,
Nicolas
>
> > + 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 */
> >
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2020-03-06 12:41 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06 10:38 [PATCH 00/10] Raspberry Pi vmmc regulator support Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 01/10] mmc: sdhci: Add quirk SDHCI_QUIRK2_SET_BUS_VOLTAGE Nicolas Saenz Julienne
2020-03-06 12:34 ` Adrian Hunter
2020-03-06 12:40 ` Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 02/10] mmc: sdhci: milbeaut: Use quirk instead of custom set_power() Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 03/10] mmc: sdhci: arsan: " Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 04/10] mmc: sdhci: at-91: " Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 05/10] mmc: sdhci: pxav3: " Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 06/10] mmc: sdhci: xenon: " Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 07/10] mmc: sdhci: am654: " Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 08/10] mmc: sdhci: Unexport sdhci_set_power_noreg() Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 09/10] mmc: sdhci: iproc: Use SDHCI_QUIRK2_SET_BUS_VOLTAGE on bcm2711 Nicolas Saenz Julienne
2020-03-06 10:38 ` [PATCH 10/10] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
2020-03-06 11:07 ` Stefan Wahren
2020-03-06 11:35 ` Phil Elwell
2020-03-06 11:37 ` Nicolas Saenz Julienne
2020-03-06 10:46 ` [PATCH 00/10] Raspberry Pi vmmc regulator support Phil Elwell
2020-03-06 10:52 ` Nicolas Saenz Julienne
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).