All of lore.kernel.org
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@microchip.com>
To: <ulf.hansson@linaro.org>, <robh+dt@kernel.org>,
	<nicolas.ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
	<ludovic.desroches@microchip.com>
Cc: <linux-mmc@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: [PATCH 2/4] mmc: pwrseq: sd8787: add support for specifying the delay b/w power and reset
Date: Fri, 6 Aug 2021 14:29:59 +0300	[thread overview]
Message-ID: <20210806113001.821660-3-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <20210806113001.821660-1-claudiu.beznea@microchip.com>

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


WARNING: multiple messages have this Message-ID (diff)
From: Claudiu Beznea <claudiu.beznea@microchip.com>
To: <ulf.hansson@linaro.org>, <robh+dt@kernel.org>,
	<nicolas.ferre@microchip.com>, <alexandre.belloni@bootlin.com>,
	<ludovic.desroches@microchip.com>
Cc: <linux-mmc@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	Claudiu Beznea <claudiu.beznea@microchip.com>
Subject: [PATCH 2/4] mmc: pwrseq: sd8787: add support for specifying the delay b/w power and reset
Date: Fri, 6 Aug 2021 14:29:59 +0300	[thread overview]
Message-ID: <20210806113001.821660-3-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <20210806113001.821660-1-claudiu.beznea@microchip.com>

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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-08-06 11:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 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:29 ` Claudiu Beznea [this message]
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   ` Claudiu Beznea
2021-08-06 11:30 ` [PATCH 4/4] ARM: dts: at91: sama5d27_wlsom1: add wifi device 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
2021-08-13 20:23   ` Rob Herring
2021-08-16  6:46   ` Claudiu.Beznea
2021-08-16  6:46     ` Claudiu.Beznea

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210806113001.821660-3-claudiu.beznea@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=robh+dt@kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.