LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support
@ 2020-03-06 17:44 Nicolas Saenz Julienne
  2020-03-06 17:44 ` [PATCH v2 01/11] mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage() Nicolas Saenz Julienne
                   ` (11 more replies)
  0 siblings, 12 replies; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, devicetree

The series first cleans up a common pattern, which is ultimately needed
to integrate the regulator with bcm2711's sdhci-iproc. It then
introduces the relevant device-tree changes.

---

Changes since v1:
 - Use helper function istead of quirk
 - Add GPIO label

Nicolas Saenz Julienne (11):
  mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage()
  mmc: sdhci: arasan: Use sdhci_set_power_and_voltage()
  mmc: sdhci: milbeaut: Use sdhci_set_power_and_voltage()
  mmc: sdhci: at91: Use sdhci_set_power_and_voltage()
  mmc: sdhci: pxav3: Use sdhci_set_power_and_voltage()
  mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
  mmc: sdhci: am654: Use sdhci_set_power_and_voltage()
  mmc: sdhci: Unexport sdhci_set_power_noreg()
  mmc: sdhci: iproc: Add custom set_power() callback for bcm2711
  ARM: dts: bcm2711: Update expgpio's GPIO labels
  ARM: dts: bcm2711: Add vmmc regulator in emmc2

 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 13 ++++++++++++-
 drivers/mmc/host/sdhci-iproc.c        | 17 ++++++++++++++++-
 drivers/mmc/host/sdhci-milbeaut.c     | 13 +------------
 drivers/mmc/host/sdhci-of-arasan.c    | 15 ++-------------
 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              | 24 +++++++++++++++++++++---
 drivers/mmc/host/sdhci.h              |  5 +++--
 drivers/mmc/host/sdhci_am654.c        | 17 +++--------------
 10 files changed, 61 insertions(+), 101 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 01/11] mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage()
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09  7:21   ` Adrian Hunter
  2020-03-06 17:44 ` [PATCH v2 02/11] mmc: sdhci: arasan: Use sdhci_set_power_and_voltage() Nicolas Saenz Julienne
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, Ulf Hansson

Some controllers diverge from the standard way of setting power and need
their bus voltage register to be configured regardless of the whether
they use regulators. As this is a common pattern across sdhci hosts,
create a helper function.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 drivers/mmc/host/sdhci.c | 19 +++++++++++++++++++
 drivers/mmc/host/sdhci.h |  3 +++
 2 files changed, 22 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 9c3745118e49..6ed11f9554e8 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2010,6 +2010,25 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
 }
 EXPORT_SYMBOL_GPL(sdhci_set_power);
 
+/*
+ * Some controllers need to configure a valid bus voltage on their power
+ * register regardless of whether an external regulator is taking care of power
+ * supply. This helper function takes care of it if set as the controller's
+ * sdhci_ops.set_power callback.
+ */
+void sdhci_set_power_and_bus_voltage(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);
+}
+EXPORT_SYMBOL_GPL(sdhci_set_power_and_bus_voltage);
+
 /*****************************************************************************\
  *                                                                           *
  * MMC callbacks                                                             *
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index cac2d97782e6..1be7c18264cd 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -772,6 +772,9 @@ 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_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);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 02/11] mmc: sdhci: arasan: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
  2020-03-06 17:44 ` [PATCH v2 01/11] mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage() Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09  7:22   ` Adrian Hunter
  2020-03-06 17:44 ` [PATCH v2 03/11] mmc: sdhci: milbeaut: " Nicolas Saenz Julienne
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel, Michal Simek
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, Ulf Hansson

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 <nsaenzjulienne@suse.de>
---
 drivers/mmc/host/sdhci-of-arasan.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 0146d7dd315b..d4905c106c06 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,7 @@ 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,
+	.set_power = sdhci_set_power_and_bus_voltage,
 };
 
 static const struct sdhci_pltfm_data sdhci_arasan_pdata = {
@@ -414,7 +403,7 @@ 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,
+	.set_power = sdhci_set_power_and_bus_voltage,
 	.irq = sdhci_arasan_cqhci_irq,
 };
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 03/11] mmc: sdhci: milbeaut: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
  2020-03-06 17:44 ` [PATCH v2 01/11] mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage() Nicolas Saenz Julienne
  2020-03-06 17:44 ` [PATCH v2 02/11] mmc: sdhci: arasan: Use sdhci_set_power_and_voltage() Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09  7:25   ` Adrian Hunter
  2020-03-06 17:44 ` [PATCH v2 04/11] mmc: sdhci: at91: " Nicolas Saenz Julienne
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, Ulf Hansson

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 <nsaenzjulienne@suse.de>
---
 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,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 04/11] mmc: sdhci: at91: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (2 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 03/11] mmc: sdhci: milbeaut: " Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09  7:25   ` Adrian Hunter
  2020-03-06 17:44 ` [PATCH v2 05/11] mmc: sdhci: pxav3: " Nicolas Saenz Julienne
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel, Ludovic Desroches, Nicolas Ferre,
	Alexandre Belloni
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, Ulf Hansson

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 <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..564a606f6729 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,7 +129,7 @@ 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,
+	.set_power		= sdhci_set_power_and_bus_voltage,
 };
 
 static const struct sdhci_pltfm_data sdhci_sama5d2_pdata = {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 05/11] mmc: sdhci: pxav3: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (3 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 04/11] mmc: sdhci: at91: " Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09  7:20   ` Adrian Hunter
  2020-03-06 17:44 ` [PATCH v2 06/11] mmc: sdhci: xenon: " Nicolas Saenz Julienne
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, Ulf Hansson

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 <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..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,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 06/11] mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (4 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 05/11] mmc: sdhci: pxav3: " Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09  7:20   ` Adrian Hunter
  2020-03-06 17:44 ` [PATCH v2 07/11] mmc: sdhci: am654: " Nicolas Saenz Julienne
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel, Hu Ziji
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, Ulf Hansson

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 <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..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,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 07/11] mmc: sdhci: am654: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (5 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 06/11] mmc: sdhci: xenon: " Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09  7:27   ` Adrian Hunter
  2020-03-06 17:44 ` [PATCH v2 08/11] mmc: sdhci: Unexport sdhci_set_power_noreg() Nicolas Saenz Julienne
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, Ulf Hansson

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 <nsaenzjulienne@suse.de>
---
 drivers/mmc/host/sdhci_am654.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index 3afea580fbea..c70647489bbd 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -208,17 +208,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;
@@ -274,7 +263,7 @@ 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_power = sdhci_set_power_and_bus_voltage,
 	.set_clock = sdhci_am654_set_clock,
 	.write_b = sdhci_am654_write_b,
 	.irq = sdhci_am654_cqhci_irq,
@@ -297,7 +286,7 @@ 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_power = sdhci_set_power_and_bus_voltage,
 	.set_clock = sdhci_am654_set_clock,
 	.write_b = sdhci_am654_write_b,
 	.irq = sdhci_am654_cqhci_irq,
@@ -320,7 +309,7 @@ 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_power = sdhci_set_power_and_bus_voltage,
 	.set_clock = sdhci_j721e_4bit_set_clock,
 	.write_b = sdhci_am654_write_b,
 	.irq = sdhci_am654_cqhci_irq,
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 08/11] mmc: sdhci: Unexport sdhci_set_power_noreg()
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (6 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 07/11] mmc: sdhci: am654: " Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-06 17:44 ` [PATCH v2 09/11] mmc: sdhci: iproc: Add custom set_power() callback for bcm2711 Nicolas Saenz Julienne
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel,
	Nicolas Saenz Julienne, Ulf Hansson

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 <nsaenzjulienne@suse.de>
---
 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);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 09/11] mmc: sdhci: iproc: Add custom set_power() callback for bcm2711
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (7 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 08/11] mmc: sdhci: Unexport sdhci_set_power_noreg() Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09  7:29   ` Adrian Hunter
  2020-03-06 17:44 ` [PATCH v2 10/11] ARM: dts: bcm2711: Update expgpio's GPIO labels Nicolas Saenz Julienne
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	linux-rpi-kernel, Nicolas Saenz Julienne, Ulf Hansson

The controller needs a valid bus voltage in its power register
regardless of whether an external regulator is taking care of the power
supply.

The sdhci core already provides a helper function for this,
sdhci_set_power_and_bus_voltage(), so create a bcm2711 specific 'struct
sdhci_ops' which makes use of it.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 drivers/mmc/host/sdhci-iproc.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index f4f5f0a70cda..225603148d7d 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -261,9 +261,24 @@ static const struct sdhci_iproc_data bcm2835_data = {
 	.mmc_caps = 0x00000000,
 };
 
+static const struct sdhci_ops sdhci_iproc_bcm2711_ops = {
+	.read_l = sdhci_iproc_readl,
+	.read_w = sdhci_iproc_readw,
+	.read_b = sdhci_iproc_readb,
+	.write_l = sdhci_iproc_writel,
+	.write_w = sdhci_iproc_writew,
+	.write_b = sdhci_iproc_writeb,
+	.set_clock = sdhci_set_clock,
+	.set_power = sdhci_set_power_and_bus_voltage,
+	.get_max_clock = sdhci_iproc_get_max_clock,
+	.set_bus_width = sdhci_set_bus_width,
+	.reset = sdhci_reset,
+	.set_uhs_signaling = sdhci_set_uhs_signaling,
+};
+
 static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = {
 	.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
-	.ops = &sdhci_iproc_32only_ops,
+	.ops = &sdhci_iproc_bcm2711_ops,
 };
 
 static const struct sdhci_iproc_data bcm2711_data = {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 10/11] ARM: dts: bcm2711: Update expgpio's GPIO labels
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (8 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 09/11] mmc: sdhci: iproc: Add custom set_power() callback for bcm2711 Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-27 11:21   ` Nicolas Saenz Julienne
  2020-03-06 17:44 ` [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
  2020-03-12 13:08 ` [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Ulf Hansson
  11 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel, Rob Herring, Nicolas Saenz Julienne
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, devicetree

The 6th line of the GPIO expander is used to power the board's SD card.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
index 1d4b589fe233..b0ea8233b636 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -68,7 +68,7 @@ expgpio: gpio {
 				  "GLOBAL_RESET",
 				  "VDD_SD_IO_SEL",
 				  "CAM_GPIO",
-				  "",
+				  "SD_PWR_ON",
 				  "";
 		status = "okay";
 	};
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (9 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 10/11] ARM: dts: bcm2711: Update expgpio's GPIO labels Nicolas Saenz Julienne
@ 2020-03-06 17:44 ` Nicolas Saenz Julienne
  2020-03-09 20:00   ` Stefan Wahren
  2020-03-27 11:22   ` Nicolas Saenz Julienne
  2020-03-12 13:08 ` [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Ulf Hansson
  11 siblings, 2 replies; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-06 17:44 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel, Rob Herring, Nicolas Saenz Julienne
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, devicetree

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 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";
 };
-- 
2.25.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 05/11] mmc: sdhci: pxav3: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 ` [PATCH v2 05/11] mmc: sdhci: pxav3: " Nicolas Saenz Julienne
@ 2020-03-09  7:20   ` Adrian Hunter
  0 siblings, 0 replies; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09  7:20 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

On 6/03/20 7:44 pm, Nicolas Saenz Julienne wrote:
> 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 <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..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);
> -}

This code is different.  The commit message should explain why it is
equivalent.  Has it been tested?

> -
>  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,
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 06/11] mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 ` [PATCH v2 06/11] mmc: sdhci: xenon: " Nicolas Saenz Julienne
@ 2020-03-09  7:20   ` Adrian Hunter
  2020-03-09 10:53     ` Nicolas Saenz Julienne
  0 siblings, 1 reply; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09  7:20 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel, Hu Ziji
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

On 6/03/20 7:44 pm, Nicolas Saenz Julienne wrote:
> 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 <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..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);
> -}

This code is different.  The commit message should explain why it is
equivalent.  Has it been tested?

> -
>  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,
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 01/11] mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage()
  2020-03-06 17:44 ` [PATCH v2 01/11] mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage() Nicolas Saenz Julienne
@ 2020-03-09  7:21   ` Adrian Hunter
  0 siblings, 0 replies; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09  7:21 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

On 6/03/20 7:44 pm, Nicolas Saenz Julienne wrote:
> Some controllers diverge from the standard way of setting power and need
> their bus voltage register to be configured regardless of the whether
> they use regulators. As this is a common pattern across sdhci hosts,
> create a helper function.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci.c | 19 +++++++++++++++++++
>  drivers/mmc/host/sdhci.h |  3 +++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 9c3745118e49..6ed11f9554e8 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2010,6 +2010,25 @@ void sdhci_set_power(struct sdhci_host *host, unsigned char mode,
>  }
>  EXPORT_SYMBOL_GPL(sdhci_set_power);
>  
> +/*
> + * Some controllers need to configure a valid bus voltage on their power
> + * register regardless of whether an external regulator is taking care of power
> + * supply. This helper function takes care of it if set as the controller's
> + * sdhci_ops.set_power callback.
> + */
> +void sdhci_set_power_and_bus_voltage(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);
> +}
> +EXPORT_SYMBOL_GPL(sdhci_set_power_and_bus_voltage);
> +
>  /*****************************************************************************\
>   *                                                                           *
>   * MMC callbacks                                                             *
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index cac2d97782e6..1be7c18264cd 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -772,6 +772,9 @@ 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_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);
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 02/11] mmc: sdhci: arasan: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 ` [PATCH v2 02/11] mmc: sdhci: arasan: Use sdhci_set_power_and_voltage() Nicolas Saenz Julienne
@ 2020-03-09  7:22   ` Adrian Hunter
  0 siblings, 0 replies; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09  7:22 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel, Michal Simek
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

On 6/03/20 7:44 pm, Nicolas Saenz Julienne wrote:
> 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 <nsaenzjulienne@suse.de>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-of-arasan.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 0146d7dd315b..d4905c106c06 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,7 @@ 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,
> +	.set_power = sdhci_set_power_and_bus_voltage,
>  };
>  
>  static const struct sdhci_pltfm_data sdhci_arasan_pdata = {
> @@ -414,7 +403,7 @@ 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,
> +	.set_power = sdhci_set_power_and_bus_voltage,
>  	.irq = sdhci_arasan_cqhci_irq,
>  };
>  
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 03/11] mmc: sdhci: milbeaut: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 ` [PATCH v2 03/11] mmc: sdhci: milbeaut: " Nicolas Saenz Julienne
@ 2020-03-09  7:25   ` Adrian Hunter
  0 siblings, 0 replies; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09  7:25 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

On 6/03/20 7:44 pm, Nicolas Saenz Julienne wrote:
> 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 <nsaenzjulienne@suse.de>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  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,
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 04/11] mmc: sdhci: at91: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 ` [PATCH v2 04/11] mmc: sdhci: at91: " Nicolas Saenz Julienne
@ 2020-03-09  7:25   ` Adrian Hunter
  0 siblings, 0 replies; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09  7:25 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel, Ludovic Desroches,
	Nicolas Ferre, Alexandre Belloni
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

On 6/03/20 7:44 pm, Nicolas Saenz Julienne wrote:
> 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 <nsaenzjulienne@suse.de>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  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..564a606f6729 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,7 +129,7 @@ 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,
> +	.set_power		= sdhci_set_power_and_bus_voltage,
>  };
>  
>  static const struct sdhci_pltfm_data sdhci_sama5d2_pdata = {
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 07/11] mmc: sdhci: am654: Use sdhci_set_power_and_voltage()
  2020-03-06 17:44 ` [PATCH v2 07/11] mmc: sdhci: am654: " Nicolas Saenz Julienne
@ 2020-03-09  7:27   ` Adrian Hunter
  0 siblings, 0 replies; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09  7:27 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

On 6/03/20 7:44 pm, Nicolas Saenz Julienne wrote:
> 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 <nsaenzjulienne@suse.de>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci_am654.c | 17 +++--------------
>  1 file changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
> index 3afea580fbea..c70647489bbd 100644
> --- a/drivers/mmc/host/sdhci_am654.c
> +++ b/drivers/mmc/host/sdhci_am654.c
> @@ -208,17 +208,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;
> @@ -274,7 +263,7 @@ 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_power = sdhci_set_power_and_bus_voltage,
>  	.set_clock = sdhci_am654_set_clock,
>  	.write_b = sdhci_am654_write_b,
>  	.irq = sdhci_am654_cqhci_irq,
> @@ -297,7 +286,7 @@ 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_power = sdhci_set_power_and_bus_voltage,
>  	.set_clock = sdhci_am654_set_clock,
>  	.write_b = sdhci_am654_write_b,
>  	.irq = sdhci_am654_cqhci_irq,
> @@ -320,7 +309,7 @@ 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_power = sdhci_set_power_and_bus_voltage,
>  	.set_clock = sdhci_j721e_4bit_set_clock,
>  	.write_b = sdhci_am654_write_b,
>  	.irq = sdhci_am654_cqhci_irq,
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 09/11] mmc: sdhci: iproc: Add custom set_power() callback for bcm2711
  2020-03-06 17:44 ` [PATCH v2 09/11] mmc: sdhci: iproc: Add custom set_power() callback for bcm2711 Nicolas Saenz Julienne
@ 2020-03-09  7:29   ` Adrian Hunter
  0 siblings, 0 replies; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09  7:29 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	linux-rpi-kernel, Ulf Hansson

On 6/03/20 7:44 pm, Nicolas Saenz Julienne wrote:
> The controller needs a valid bus voltage in its power register
> regardless of whether an external regulator is taking care of the power
> supply.
> 
> The sdhci core already provides a helper function for this,
> sdhci_set_power_and_bus_voltage(), so create a bcm2711 specific 'struct
> sdhci_ops' which makes use of it.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/sdhci-iproc.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index f4f5f0a70cda..225603148d7d 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -261,9 +261,24 @@ static const struct sdhci_iproc_data bcm2835_data = {
>  	.mmc_caps = 0x00000000,
>  };
>  
> +static const struct sdhci_ops sdhci_iproc_bcm2711_ops = {
> +	.read_l = sdhci_iproc_readl,
> +	.read_w = sdhci_iproc_readw,
> +	.read_b = sdhci_iproc_readb,
> +	.write_l = sdhci_iproc_writel,
> +	.write_w = sdhci_iproc_writew,
> +	.write_b = sdhci_iproc_writeb,
> +	.set_clock = sdhci_set_clock,
> +	.set_power = sdhci_set_power_and_bus_voltage,
> +	.get_max_clock = sdhci_iproc_get_max_clock,
> +	.set_bus_width = sdhci_set_bus_width,
> +	.reset = sdhci_reset,
> +	.set_uhs_signaling = sdhci_set_uhs_signaling,
> +};
> +
>  static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = {
>  	.quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
> -	.ops = &sdhci_iproc_32only_ops,
> +	.ops = &sdhci_iproc_bcm2711_ops,
>  };
>  
>  static const struct sdhci_iproc_data bcm2711_data = {
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 06/11] mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
  2020-03-09  7:20   ` Adrian Hunter
@ 2020-03-09 10:53     ` Nicolas Saenz Julienne
  2020-03-09 11:55       ` Adrian Hunter
  0 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-09 10:53 UTC (permalink / raw)
  To: Adrian Hunter, linux-kernel, Hu Ziji
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

[-- Attachment #1: Type: text/plain, Size: 1481 bytes --]

On Mon, 2020-03-09 at 09:20 +0200, Adrian Hunter wrote:
> > -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);
> > -}
> 
> This code is different.  The commit message should explain why it is
> equivalent.  Has it been tested?

Yes, I should've pointed it out. The rationale behind including sdhci-xenon and
sdhci-pxav3 is based on xenon's original commit message (99c14fc360dbb):

	mmc: sdhci-xenon: add set_power callback

	Xenon sdh controller requests proper SD bus voltage select
	bits programmed even with vmmc power supply. Any reserved
	value(100b-000b) programmed in this field will lead to controller
	ignore SD bus power bit and keep its value at zero.
	Add set_power callback to handle this.

I can't test it, but it felt to me as the implementation differences are only
there as different people wrote the code. Ultimately, I'll be happy to drop
them from the series if you feel it's too much of an assumption, I can see how
the controllers could react badly to the ordering change. If not I can send a
v3 with fixed commit messages.

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 06/11] mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
  2020-03-09 10:53     ` Nicolas Saenz Julienne
@ 2020-03-09 11:55       ` Adrian Hunter
  2020-03-09 11:56         ` Adrian Hunter
  0 siblings, 1 reply; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09 11:55 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel, Hu Ziji
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

On 9/03/20 12:53 pm, Nicolas Saenz Julienne wrote:
> On Mon, 2020-03-09 at 09:20 +0200, Adrian Hunter wrote:
>>> -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);
>>> -}
>>
>> This code is different.  The commit message should explain why it is
>> equivalent.  Has it been tested?
> 
> Yes, I should've pointed it out. The rationale behind including sdhci-xenon and
> sdhci-pxav3 is based on xenon's original commit message (99c14fc360dbb):
> 
> 	mmc: sdhci-xenon: add set_power callback
> 
> 	Xenon sdh controller requests proper SD bus voltage select
> 	bits programmed even with vmmc power supply. Any reserved
> 	value(100b-000b) programmed in this field will lead to controller
> 	ignore SD bus power bit and keep its value at zero.
> 	Add set_power callback to handle this.
> 
> I can't test it, but it felt to me as the implementation differences are only
> there as different people wrote the code. Ultimately, I'll be happy to drop
> them from the series if you feel it's too much of an assumption, I can see how
> the controllers could react badly to the ordering change. If not I can send a
> v3 with fixed commit messages.

We can wait a bit and see if anyone provides a Tested-by tag, otherwise
safer to drop it.

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 06/11] mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
  2020-03-09 11:55       ` Adrian Hunter
@ 2020-03-09 11:56         ` Adrian Hunter
  0 siblings, 0 replies; 30+ messages in thread
From: Adrian Hunter @ 2020-03-09 11:56 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, linux-kernel, Hu Ziji, Zhoujie Wu
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, Ulf Hansson

+ Zhoujie Wu <zjwu@marvell.com>

On 9/03/20 1:55 pm, Adrian Hunter wrote:
> On 9/03/20 12:53 pm, Nicolas Saenz Julienne wrote:
>> On Mon, 2020-03-09 at 09:20 +0200, Adrian Hunter wrote:
>>>> -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);
>>>> -}
>>>
>>> This code is different.  The commit message should explain why it is
>>> equivalent.  Has it been tested?
>>
>> Yes, I should've pointed it out. The rationale behind including sdhci-xenon and
>> sdhci-pxav3 is based on xenon's original commit message (99c14fc360dbb):
>>
>> 	mmc: sdhci-xenon: add set_power callback
>>
>> 	Xenon sdh controller requests proper SD bus voltage select
>> 	bits programmed even with vmmc power supply. Any reserved
>> 	value(100b-000b) programmed in this field will lead to controller
>> 	ignore SD bus power bit and keep its value at zero.
>> 	Add set_power callback to handle this.
>>
>> I can't test it, but it felt to me as the implementation differences are only
>> there as different people wrote the code. Ultimately, I'll be happy to drop
>> them from the series if you feel it's too much of an assumption, I can see how
>> the controllers could react badly to the ordering change. If not I can send a
>> v3 with fixed commit messages.
> 
> We can wait a bit and see if anyone provides a Tested-by tag, otherwise
> safer to drop it.
> 


^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2
  2020-03-06 17:44 ` [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
@ 2020-03-09 20:00   ` Stefan Wahren
  2020-03-09 20:01     ` Nicolas Saenz Julienne
  2020-03-27 11:22   ` Nicolas Saenz Julienne
  1 sibling, 1 reply; 30+ messages in thread
From: Stefan Wahren @ 2020-03-09 20:00 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, adrian.hunter, linux-kernel, Rob Herring
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli,
	bcm-kernel-feedback-list, linux-rpi-kernel, devicetree

Hi Nicolas,

Am 06.03.20 um 18:44 schrieb Nicolas Saenz Julienne:
> 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 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";

i think we need to enable CONFIG_REGULATOR_FIXED_VOLTAGE in
bcm2835_defconfig

Best regards
Stefan

> +		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";
>  };

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2
  2020-03-09 20:00   ` Stefan Wahren
@ 2020-03-09 20:01     ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-09 20:01 UTC (permalink / raw)
  To: Stefan Wahren, adrian.hunter, linux-kernel, Rob Herring
  Cc: devicetree, f.fainelli, linux-mmc, bcm-kernel-feedback-list,
	linux-rpi-kernel, phil, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]

On Mon, 2020-03-09 at 21:00 +0100, Stefan Wahren wrote:
> Hi Nicolas,
> 
> Am 06.03.20 um 18:44 schrieb Nicolas Saenz Julienne:
> > 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 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";
> 
> i think we need to enable CONFIG_REGULATOR_FIXED_VOLTAGE in
> bcm2835_defconfig

I'll take it into account for v3,

Thanks!
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support
  2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
                   ` (10 preceding siblings ...)
  2020-03-06 17:44 ` [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
@ 2020-03-12 13:08 ` Ulf Hansson
  2020-03-12 13:13   ` Nicolas Saenz Julienne
  11 siblings, 1 reply; 30+ messages in thread
From: Ulf Hansson @ 2020-03-12 13:08 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: Adrian Hunter, Linux Kernel Mailing List, phil, linux-mmc,
	Linux ARM, Florian Fainelli, Stefan Wahren, BCM Kernel Feedback,
	linux-rpi-kernel, DTML

On Fri, 6 Mar 2020 at 18:44, Nicolas Saenz Julienne
<nsaenzjulienne@suse.de> wrote:
>
> The series first cleans up a common pattern, which is ultimately needed
> to integrate the regulator with bcm2711's sdhci-iproc. It then
> introduces the relevant device-tree changes.
>
> ---
>
> Changes since v1:
>  - Use helper function istead of quirk
>  - Add GPIO label
>
> Nicolas Saenz Julienne (11):
>   mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage()
>   mmc: sdhci: arasan: Use sdhci_set_power_and_voltage()
>   mmc: sdhci: milbeaut: Use sdhci_set_power_and_voltage()
>   mmc: sdhci: at91: Use sdhci_set_power_and_voltage()
>   mmc: sdhci: pxav3: Use sdhci_set_power_and_voltage()
>   mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
>   mmc: sdhci: am654: Use sdhci_set_power_and_voltage()
>   mmc: sdhci: Unexport sdhci_set_power_noreg()
>   mmc: sdhci: iproc: Add custom set_power() callback for bcm2711
>   ARM: dts: bcm2711: Update expgpio's GPIO labels
>   ARM: dts: bcm2711: Add vmmc regulator in emmc2
>
>  arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 13 ++++++++++++-
>  drivers/mmc/host/sdhci-iproc.c        | 17 ++++++++++++++++-
>  drivers/mmc/host/sdhci-milbeaut.c     | 13 +------------
>  drivers/mmc/host/sdhci-of-arasan.c    | 15 ++-------------
>  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              | 24 +++++++++++++++++++++---
>  drivers/mmc/host/sdhci.h              |  5 +++--
>  drivers/mmc/host/sdhci_am654.c        | 17 +++--------------
>  10 files changed, 61 insertions(+), 101 deletions(-)
>
> --
> 2.25.1
>

Patch 1-4, 6, 9 applied for next, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support
  2020-03-12 13:08 ` [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Ulf Hansson
@ 2020-03-12 13:13   ` Nicolas Saenz Julienne
  2020-03-12 14:06     ` Ulf Hansson
  0 siblings, 1 reply; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-12 13:13 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Adrian Hunter, Linux Kernel Mailing List, phil, linux-mmc,
	Linux ARM, Florian Fainelli, Stefan Wahren, BCM Kernel Feedback,
	linux-rpi-kernel, DTML

[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]

Hi Ulf,

On Thu, 2020-03-12 at 14:08 +0100, Ulf Hansson wrote:
> On Fri, 6 Mar 2020 at 18:44, Nicolas Saenz Julienne
> <nsaenzjulienne@suse.de> wrote:
> > The series first cleans up a common pattern, which is ultimately needed
> > to integrate the regulator with bcm2711's sdhci-iproc. It then
> > introduces the relevant device-tree changes.
> > 
> > ---
> > 
> > Changes since v1:
> >  - Use helper function istead of quirk
> >  - Add GPIO label
> > 
> > Nicolas Saenz Julienne (11):
> >   mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage()
> >   mmc: sdhci: arasan: Use sdhci_set_power_and_voltage()
> >   mmc: sdhci: milbeaut: Use sdhci_set_power_and_voltage()
> >   mmc: sdhci: at91: Use sdhci_set_power_and_voltage()
> >   mmc: sdhci: pxav3: Use sdhci_set_power_and_voltage()
> >   mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
> >   mmc: sdhci: am654: Use sdhci_set_power_and_voltage()
> >   mmc: sdhci: Unexport sdhci_set_power_noreg()
> >   mmc: sdhci: iproc: Add custom set_power() callback for bcm2711
> >   ARM: dts: bcm2711: Update expgpio's GPIO labels
> >   ARM: dts: bcm2711: Add vmmc regulator in emmc2
> > 
> >  arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 13 ++++++++++++-
> >  drivers/mmc/host/sdhci-iproc.c        | 17 ++++++++++++++++-
> >  drivers/mmc/host/sdhci-milbeaut.c     | 13 +------------
> >  drivers/mmc/host/sdhci-of-arasan.c    | 15 ++-------------
> >  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              | 24 +++++++++++++++++++++---
> >  drivers/mmc/host/sdhci.h              |  5 +++--
> >  drivers/mmc/host/sdhci_am654.c        | 17 +++--------------
> >  10 files changed, 61 insertions(+), 101 deletions(-)
> > 
> > --
> > 2.25.1
> > 
> 
> Patch 1-4, 6, 9 applied for next, thanks!

I think you meant to apply 1-4, 7 and 9. Patch 6 is one of the contentious
ones.

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support
  2020-03-12 13:13   ` Nicolas Saenz Julienne
@ 2020-03-12 14:06     ` Ulf Hansson
  0 siblings, 0 replies; 30+ messages in thread
From: Ulf Hansson @ 2020-03-12 14:06 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: Adrian Hunter, Linux Kernel Mailing List, phil, linux-mmc,
	Linux ARM, Florian Fainelli, Stefan Wahren, BCM Kernel Feedback,
	linux-rpi-kernel, DTML

On Thu, 12 Mar 2020 at 14:13, Nicolas Saenz Julienne
<nsaenzjulienne@suse.de> wrote:
>
> Hi Ulf,
>
> On Thu, 2020-03-12 at 14:08 +0100, Ulf Hansson wrote:
> > On Fri, 6 Mar 2020 at 18:44, Nicolas Saenz Julienne
> > <nsaenzjulienne@suse.de> wrote:
> > > The series first cleans up a common pattern, which is ultimately needed
> > > to integrate the regulator with bcm2711's sdhci-iproc. It then
> > > introduces the relevant device-tree changes.
> > >
> > > ---
> > >
> > > Changes since v1:
> > >  - Use helper function istead of quirk
> > >  - Add GPIO label
> > >
> > > Nicolas Saenz Julienne (11):
> > >   mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage()
> > >   mmc: sdhci: arasan: Use sdhci_set_power_and_voltage()
> > >   mmc: sdhci: milbeaut: Use sdhci_set_power_and_voltage()
> > >   mmc: sdhci: at91: Use sdhci_set_power_and_voltage()
> > >   mmc: sdhci: pxav3: Use sdhci_set_power_and_voltage()
> > >   mmc: sdhci: xenon: Use sdhci_set_power_and_voltage()
> > >   mmc: sdhci: am654: Use sdhci_set_power_and_voltage()
> > >   mmc: sdhci: Unexport sdhci_set_power_noreg()
> > >   mmc: sdhci: iproc: Add custom set_power() callback for bcm2711
> > >   ARM: dts: bcm2711: Update expgpio's GPIO labels
> > >   ARM: dts: bcm2711: Add vmmc regulator in emmc2
> > >
> > >  arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 13 ++++++++++++-
> > >  drivers/mmc/host/sdhci-iproc.c        | 17 ++++++++++++++++-
> > >  drivers/mmc/host/sdhci-milbeaut.c     | 13 +------------
> > >  drivers/mmc/host/sdhci-of-arasan.c    | 15 ++-------------
> > >  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              | 24 +++++++++++++++++++++---
> > >  drivers/mmc/host/sdhci.h              |  5 +++--
> > >  drivers/mmc/host/sdhci_am654.c        | 17 +++--------------
> > >  10 files changed, 61 insertions(+), 101 deletions(-)
> > >
> > > --
> > > 2.25.1
> > >
> >
> > Patch 1-4, 6, 9 applied for next, thanks!
>
> I think you meant to apply 1-4, 7 and 9. Patch 6 is one of the contentious
> ones.

Yes, that's what I did, but told you about 6. :-)

Thanks and sorry for the noise.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 10/11] ARM: dts: bcm2711: Update expgpio's GPIO labels
  2020-03-06 17:44 ` [PATCH v2 10/11] ARM: dts: bcm2711: Update expgpio's GPIO labels Nicolas Saenz Julienne
@ 2020-03-27 11:21   ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-27 11:21 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel, Rob Herring
  Cc: stefan.wahren, devicetree, f.fainelli, linux-mmc,
	bcm-kernel-feedback-list, linux-rpi-kernel, phil,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 262 bytes --]

On Fri, 2020-03-06 at 18:44 +0100, Nicolas Saenz Julienne wrote:
> The 6th line of the GPIO expander is used to power the board's SD card.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> ---

Applied for-next.

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2
  2020-03-06 17:44 ` [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
  2020-03-09 20:00   ` Stefan Wahren
@ 2020-03-27 11:22   ` Nicolas Saenz Julienne
  1 sibling, 0 replies; 30+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-27 11:22 UTC (permalink / raw)
  To: adrian.hunter, linux-kernel, Rob Herring
  Cc: phil, linux-mmc, linux-arm-kernel, f.fainelli, stefan.wahren,
	bcm-kernel-feedback-list, linux-rpi-kernel, devicetree

[-- Attachment #1: Type: text/plain, Size: 338 bytes --]

On Fri, 2020-03-06 at 18:44 +0100, 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>

Applied for-next.

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2020-03-27 11:22 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-06 17:44 [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Nicolas Saenz Julienne
2020-03-06 17:44 ` [PATCH v2 01/11] mmc: sdhci: Introduce sdhci_set_power_and_bus_voltage() Nicolas Saenz Julienne
2020-03-09  7:21   ` Adrian Hunter
2020-03-06 17:44 ` [PATCH v2 02/11] mmc: sdhci: arasan: Use sdhci_set_power_and_voltage() Nicolas Saenz Julienne
2020-03-09  7:22   ` Adrian Hunter
2020-03-06 17:44 ` [PATCH v2 03/11] mmc: sdhci: milbeaut: " Nicolas Saenz Julienne
2020-03-09  7:25   ` Adrian Hunter
2020-03-06 17:44 ` [PATCH v2 04/11] mmc: sdhci: at91: " Nicolas Saenz Julienne
2020-03-09  7:25   ` Adrian Hunter
2020-03-06 17:44 ` [PATCH v2 05/11] mmc: sdhci: pxav3: " Nicolas Saenz Julienne
2020-03-09  7:20   ` Adrian Hunter
2020-03-06 17:44 ` [PATCH v2 06/11] mmc: sdhci: xenon: " Nicolas Saenz Julienne
2020-03-09  7:20   ` Adrian Hunter
2020-03-09 10:53     ` Nicolas Saenz Julienne
2020-03-09 11:55       ` Adrian Hunter
2020-03-09 11:56         ` Adrian Hunter
2020-03-06 17:44 ` [PATCH v2 07/11] mmc: sdhci: am654: " Nicolas Saenz Julienne
2020-03-09  7:27   ` Adrian Hunter
2020-03-06 17:44 ` [PATCH v2 08/11] mmc: sdhci: Unexport sdhci_set_power_noreg() Nicolas Saenz Julienne
2020-03-06 17:44 ` [PATCH v2 09/11] mmc: sdhci: iproc: Add custom set_power() callback for bcm2711 Nicolas Saenz Julienne
2020-03-09  7:29   ` Adrian Hunter
2020-03-06 17:44 ` [PATCH v2 10/11] ARM: dts: bcm2711: Update expgpio's GPIO labels Nicolas Saenz Julienne
2020-03-27 11:21   ` Nicolas Saenz Julienne
2020-03-06 17:44 ` [PATCH v2 11/11] ARM: dts: bcm2711: Add vmmc regulator in emmc2 Nicolas Saenz Julienne
2020-03-09 20:00   ` Stefan Wahren
2020-03-09 20:01     ` Nicolas Saenz Julienne
2020-03-27 11:22   ` Nicolas Saenz Julienne
2020-03-12 13:08 ` [PATCH v2 00/11] Raspbery Pi 4 vmmc regulator support Ulf Hansson
2020-03-12 13:13   ` Nicolas Saenz Julienne
2020-03-12 14:06     ` Ulf Hansson

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).