LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable
@ 2021-08-06 11:29 Claudiu Beznea
  2021-08-06 11:29 ` [PATCH 1/4] dt-bindings: mmc: pwrseq-sd8787: add binding for delay b/w reset and power Claudiu Beznea
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Claudiu Beznea @ 2021-08-06 11:29 UTC (permalink / raw)
  To: ulf.hansson, robh+dt, nicolas.ferre, alexandre.belloni,
	ludovic.desroches
  Cc: linux-mmc, devicetree, linux-kernel, linux-arm-kernel, Claudiu Beznea

Hi,

This series adds support for selecting the delay b/w reset and power
lines on pwrseq-sd8787. With this the driver could also be used by
other devices (e.g. WILC1000/WILC3000 which needs a delay of 5ms). Along
with this added the DT bindings for WILC3000 device present on
SAMA5D27 WLSOM1 board.

Thank you,
Claudiu Beznea

Claudiu Beznea (3):
  dt-bindings: mmc: pwrseq-sd8787: add binding for delay b/w reset and
    power
  mmc: pwrseq: sd8787: add support for specifying the delay b/w power
    and reset
  mmc: pwrseq: add wilc1000_sdio dependency for pwrseq_sd8787

Eugen Hristev (1):
  ARM: dts: at91: sama5d27_wlsom1: add wifi device

 .../bindings/mmc/mmc-pwrseq-sd8787.yaml       |  4 ++
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi   | 72 +++++++++++++++++++
 drivers/mmc/core/Kconfig                      |  2 +-
 drivers/mmc/core/pwrseq_sd8787.c              | 11 ++-
 4 files changed, 87 insertions(+), 2 deletions(-)

-- 
2.25.1


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

* [PATCH 1/4] dt-bindings: mmc: pwrseq-sd8787: add binding for delay b/w reset and power
  2021-08-06 11:29 [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Claudiu Beznea
@ 2021-08-06 11:29 ` Claudiu Beznea
  2021-08-06 11:29 ` [PATCH 2/4] mmc: pwrseq: sd8787: add support for specifying the delay b/w power and reset Claudiu Beznea
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Claudiu Beznea @ 2021-08-06 11:29 UTC (permalink / raw)
  To: ulf.hansson, robh+dt, nicolas.ferre, alexandre.belloni,
	ludovic.desroches
  Cc: linux-mmc, devicetree, linux-kernel, linux-arm-kernel, Claudiu Beznea

Add documentation for binding that specifies the delay that should
be introduced b/w reset and power lines when powering up the device.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 Documentation/devicetree/bindings/mmc/mmc-pwrseq-sd8787.yaml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-sd8787.yaml b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-sd8787.yaml
index e0169a285aa2..4b1e89750e94 100644
--- a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-sd8787.yaml
+++ b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-sd8787.yaml
@@ -23,6 +23,10 @@ properties:
     description:
       contains a reset GPIO specifier with the default active state
 
+  reset-power-delay-ms:
+    description:
+      Delay in ms between powerdown and reset gpios
+
 required:
   - compatible
   - powerdown-gpios
-- 
2.25.1


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

* [PATCH 2/4] mmc: pwrseq: sd8787: add support for specifying the delay b/w power and reset
  2021-08-06 11:29 [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Claudiu Beznea
  2021-08-06 11:29 ` [PATCH 1/4] dt-bindings: mmc: pwrseq-sd8787: add binding for delay b/w reset and power Claudiu Beznea
@ 2021-08-06 11:29 ` Claudiu Beznea
  2021-08-06 11:30 ` [PATCH 3/4] mmc: pwrseq: add wilc1000_sdio dependency for pwrseq_sd8787 Claudiu Beznea
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Claudiu Beznea @ 2021-08-06 11:29 UTC (permalink / raw)
  To: ulf.hansson, robh+dt, nicolas.ferre, alexandre.belloni,
	ludovic.desroches
  Cc: linux-mmc, devicetree, linux-kernel, linux-arm-kernel, Claudiu Beznea

Add support to be able to specify the delay to be introduced b/w
power and reset lines on power up sequence. With this, the driver
could also be used by other WiFi chips (e.g. WILC1000/WILC3000
devices that need a delay of 5ms b/w power and reset line for
a proper powering up sequence).

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/mmc/core/pwrseq_sd8787.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/core/pwrseq_sd8787.c b/drivers/mmc/core/pwrseq_sd8787.c
index 68a826f1c0a1..a554eefdf1b1 100644
--- a/drivers/mmc/core/pwrseq_sd8787.c
+++ b/drivers/mmc/core/pwrseq_sd8787.c
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/device.h>
 #include <linux/err.h>
@@ -27,6 +28,7 @@ struct mmc_pwrseq_sd8787 {
 	struct mmc_pwrseq pwrseq;
 	struct gpio_desc *reset_gpio;
 	struct gpio_desc *pwrdn_gpio;
+	u32 reset_pwrdwn_delay_ms;
 };
 
 #define to_pwrseq_sd8787(p) container_of(p, struct mmc_pwrseq_sd8787, pwrseq)
@@ -37,7 +39,7 @@ static void mmc_pwrseq_sd8787_pre_power_on(struct mmc_host *host)
 
 	gpiod_set_value_cansleep(pwrseq->reset_gpio, 1);
 
-	msleep(300);
+	msleep(pwrseq->reset_pwrdwn_delay_ms);
 	gpiod_set_value_cansleep(pwrseq->pwrdn_gpio, 1);
 }
 
@@ -64,6 +66,7 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev)
 {
 	struct mmc_pwrseq_sd8787 *pwrseq;
 	struct device *dev = &pdev->dev;
+	int ret;
 
 	pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL);
 	if (!pwrseq)
@@ -77,6 +80,12 @@ static int mmc_pwrseq_sd8787_probe(struct platform_device *pdev)
 	if (IS_ERR(pwrseq->reset_gpio))
 		return PTR_ERR(pwrseq->reset_gpio);
 
+	ret = device_property_read_u32(dev, "reset-power-delay-ms",
+				       &pwrseq->reset_pwrdwn_delay_ms);
+	/* Keep compatibility with old devices. */
+	if (ret)
+		pwrseq->reset_pwrdwn_delay_ms = 300;
+
 	pwrseq->pwrseq.dev = dev;
 	pwrseq->pwrseq.ops = &mmc_pwrseq_sd8787_ops;
 	pwrseq->pwrseq.owner = THIS_MODULE;
-- 
2.25.1


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

* [PATCH 3/4] mmc: pwrseq: add wilc1000_sdio dependency for pwrseq_sd8787
  2021-08-06 11:29 [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Claudiu Beznea
  2021-08-06 11:29 ` [PATCH 1/4] dt-bindings: mmc: pwrseq-sd8787: add binding for delay b/w reset and power Claudiu Beznea
  2021-08-06 11:29 ` [PATCH 2/4] mmc: pwrseq: sd8787: add support for specifying the delay b/w power and reset Claudiu Beznea
@ 2021-08-06 11:30 ` Claudiu Beznea
  2021-08-06 11:30 ` [PATCH 4/4] ARM: dts: at91: sama5d27_wlsom1: add wifi device Claudiu Beznea
  2021-08-13 20:23 ` [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Rob Herring
  4 siblings, 0 replies; 7+ messages in thread
From: Claudiu Beznea @ 2021-08-06 11:30 UTC (permalink / raw)
  To: ulf.hansson, robh+dt, nicolas.ferre, alexandre.belloni,
	ludovic.desroches
  Cc: linux-mmc, devicetree, linux-kernel, linux-arm-kernel, Claudiu Beznea

pwseq_sd8787 could also be used with wilc1000_sdio driver. Add
a dependency for this.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 drivers/mmc/core/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/Kconfig b/drivers/mmc/core/Kconfig
index ae8b69aee619..6f25c34e4fec 100644
--- a/drivers/mmc/core/Kconfig
+++ b/drivers/mmc/core/Kconfig
@@ -15,7 +15,7 @@ config PWRSEQ_EMMC
 
 config PWRSEQ_SD8787
 	tristate "HW reset support for SD8787 BT + Wifi module"
-	depends on OF && (MWIFIEX || BT_MRVL_SDIO || LIBERTAS_SDIO)
+	depends on OF && (MWIFIEX || BT_MRVL_SDIO || LIBERTAS_SDIO || WILC1000_SDIO)
 	help
 	  This selects hardware reset support for the SD8787 BT + Wifi
 	  module. By default this option is set to n.
-- 
2.25.1


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

* [PATCH 4/4] ARM: dts: at91: sama5d27_wlsom1: add wifi device
  2021-08-06 11:29 [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Claudiu Beznea
                   ` (2 preceding siblings ...)
  2021-08-06 11:30 ` [PATCH 3/4] mmc: pwrseq: add wilc1000_sdio dependency for pwrseq_sd8787 Claudiu Beznea
@ 2021-08-06 11:30 ` Claudiu Beznea
  2021-08-13 20:23 ` [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Rob Herring
  4 siblings, 0 replies; 7+ messages in thread
From: Claudiu Beznea @ 2021-08-06 11:30 UTC (permalink / raw)
  To: ulf.hansson, robh+dt, nicolas.ferre, alexandre.belloni,
	ludovic.desroches
  Cc: linux-mmc, devicetree, linux-kernel, linux-arm-kernel,
	Eugen Hristev, Claudiu Beznea

From: Eugen Hristev <eugen.hristev@microchip.com>

SAMA5D27 WLSOM1 boards has a WILC3000 device soldered. Add proper
device tree nodes for this.

[eugen.hristev: original author of this code]
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
[nicolas.ferre: original author of this code]
Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
[claudiu.beznea: adapt for mmc-pwrseq-sd8787, commit message]
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 72 +++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
index 025a78310e3a..de8bb3439aef 100644
--- a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
@@ -30,6 +30,16 @@ main_xtal {
 			clock-frequency = <24000000>;
 		};
 	};
+
+	wifi_pwrseq: wifi_pwrseq {
+		compatible = "mmc-pwrseq-sd8787";
+		reset-gpios = <&pioA PIN_PA27 GPIO_ACTIVE_HIGH>;
+		powerdown-gpios = <&pioA PIN_PA29 GPIO_ACTIVE_HIGH>;
+		reset-power-delay-ms = <5>;
+		pinctrl-0 = <&pinctrl_wilc_pwrseq>;
+		pinctrl-names = "default";
+		status = "okay";
+	};
 };
 
 &flx1 {
@@ -310,5 +320,67 @@ pinctrl_qspi1_default: qspi1_default {
 			 <PIN_PB10__QSPI1_IO3>;
 		bias-pull-up;
 	};
+
+	pinctrl_sdmmc1_default: sdmmc1_default {
+		cmd-data {
+			pinmux = <PIN_PA28__SDMMC1_CMD>,
+				 <PIN_PA18__SDMMC1_DAT0>,
+				 <PIN_PA19__SDMMC1_DAT1>,
+				 <PIN_PA20__SDMMC1_DAT2>,
+				 <PIN_PA21__SDMMC1_DAT3>;
+			bias-disable;
+		};
+
+		conf-ck {
+			pinmux = <PIN_PA22__SDMMC1_CK>;
+			bias-disable;
+		};
+	};
+
+	pinctrl_wilc_default: wilc_default {
+		conf-irq {
+			pinmux = <PIN_PB25__GPIO>;
+			bias-disable;
+		};
+	};
+
+	pinctrl_wilc_pwrseq: wilc_pwrseq {
+		conf-ce-nrst {
+			pinmux = <PIN_PA27__GPIO>,
+				 <PIN_PA29__GPIO>;
+			bias-disable;
+		};
+
+		conf-rtcclk {
+			pinmux = <PIN_PB13__PCK1>;
+			bias-disable;
+		};
+	};
+};
+
+&sdmmc1 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	bus-width = <4>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_sdmmc1_default>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	no-1-8-v;
+	non-removable;
+	status = "okay";
+
+	wilc: wilc@0 {
+		reg = <0>;
+		bus-width = <4>;
+		compatible = "microchip,wilc3000", "microchip,wilc1000";
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinctrl_wilc_default>;
+		irq-gpios = <&pioA PIN_PB25 GPIO_ACTIVE_LOW>;
+		clocks = <&pmc PMC_TYPE_SYSTEM 9>;
+		clock-names = "rtc";
+		assigned-clocks = <&pmc PMC_TYPE_SYSTEM 9>;
+		assigned-clock-rates = <32768>;
+		status = "okay";
+	};
 };
 
-- 
2.25.1


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

* Re: [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable
  2021-08-06 11:29 [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Claudiu Beznea
                   ` (3 preceding siblings ...)
  2021-08-06 11:30 ` [PATCH 4/4] ARM: dts: at91: sama5d27_wlsom1: add wifi device Claudiu Beznea
@ 2021-08-13 20:23 ` Rob Herring
  2021-08-16  6:46   ` Claudiu.Beznea
  4 siblings, 1 reply; 7+ messages in thread
From: Rob Herring @ 2021-08-13 20:23 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: ulf.hansson, nicolas.ferre, alexandre.belloni, ludovic.desroches,
	linux-mmc, devicetree, linux-kernel, linux-arm-kernel

On Fri, Aug 06, 2021 at 02:29:57PM +0300, Claudiu Beznea wrote:
> Hi,
> 
> This series adds support for selecting the delay b/w reset and power
> lines on pwrseq-sd8787. With this the driver could also be used by
> other devices (e.g. WILC1000/WILC3000 which needs a delay of 5ms). Along
> with this added the DT bindings for WILC3000 device present on
> SAMA5D27 WLSOM1 board.

A 300ms delay doesn't work? Is powering on the device so timing 
critical?

Add a new compatible for your device and imply the timing from that. 
That way we're not extending the binding a property at a time in a 
poorly designed way for each new timing quirk.

Rob

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

* Re: [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable
  2021-08-13 20:23 ` [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Rob Herring
@ 2021-08-16  6:46   ` Claudiu.Beznea
  0 siblings, 0 replies; 7+ messages in thread
From: Claudiu.Beznea @ 2021-08-16  6:46 UTC (permalink / raw)
  To: robh
  Cc: ulf.hansson, Nicolas.Ferre, alexandre.belloni, Ludovic.Desroches,
	linux-mmc, devicetree, linux-kernel, linux-arm-kernel

On 13.08.2021 23:23, Rob Herring wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Fri, Aug 06, 2021 at 02:29:57PM +0300, Claudiu Beznea wrote:
>> Hi,
>>
>> This series adds support for selecting the delay b/w reset and power
>> lines on pwrseq-sd8787. With this the driver could also be used by
>> other devices (e.g. WILC1000/WILC3000 which needs a delay of 5ms). Along
>> with this added the DT bindings for WILC3000 device present on
>> SAMA5D27 WLSOM1 board.
> 
> A 300ms delay doesn't work?

It should work as the datasheet specifies a minimum of 5ms is necessary.

> Is powering on the device so timing
> critical?
> 
> Add a new compatible for your device and imply the timing from that.
> That way we're not extending the binding a property at a time in a
> poorly designed way for each new timing quirk.

OK, will do it in v2.

Thank you for your review,
Claudiu Beznea

> 
> Rob
> 


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

end of thread, other threads:[~2021-08-16  6:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06 11:29 [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Claudiu Beznea
2021-08-06 11:29 ` [PATCH 1/4] dt-bindings: mmc: pwrseq-sd8787: add binding for delay b/w reset and power Claudiu Beznea
2021-08-06 11:29 ` [PATCH 2/4] mmc: pwrseq: sd8787: add support for specifying the delay b/w power and reset Claudiu Beznea
2021-08-06 11:30 ` [PATCH 3/4] mmc: pwrseq: add wilc1000_sdio dependency for pwrseq_sd8787 Claudiu Beznea
2021-08-06 11:30 ` [PATCH 4/4] ARM: dts: at91: sama5d27_wlsom1: add wifi device Claudiu Beznea
2021-08-13 20:23 ` [PATCH 0/4] mmc: pwrseq: sd8787: add support for selectable Rob Herring
2021-08-16  6:46   ` Claudiu.Beznea

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