All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] mmc: pwrseq: Add support to multiple gpios in pwrseq simple
@ 2015-01-28 13:16 ` Srinivas Kandagatla
  0 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2015-01-28 13:16 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: linux-kernel, devicetree, Kumar Gala, Rob Herring, Srinivas Kandagatla

This patchset adds support to reset/powerup multiple gpio pins on a given
sdio bus. The use case is simple, on sdio we could have multiple devices
like WLAN, BT which are controlled by there own reset lines. So having
multiple reset is something more useful in such cases.

Without this patch I could not get BT and WLAN working at same time on IFC6410.

Thanks,
srini

Srinivas Kandagatla (2):
  mmc: pwrseq: Add support to control multiple gpios in simple pwrseq
  mmc: pwrseq: Update document with multiple gpios support

 .../devicetree/bindings/mmc/mmc-pwrseq-simple.txt  |  7 ++-
 drivers/mmc/core/pwrseq_simple.c                   | 64 +++++++++++++++-------
 2 files changed, 49 insertions(+), 22 deletions(-)

-- 
1.9.1


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

* [PATCH 0/2] mmc: pwrseq: Add support to multiple gpios in pwrseq simple
@ 2015-01-28 13:16 ` Srinivas Kandagatla
  0 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2015-01-28 13:16 UTC (permalink / raw)
  To: linux-mmc-u79uwXL29TY76Z2rM5mHXA, Ulf Hansson
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Kumar Gala, Rob Herring,
	Srinivas Kandagatla

This patchset adds support to reset/powerup multiple gpio pins on a given
sdio bus. The use case is simple, on sdio we could have multiple devices
like WLAN, BT which are controlled by there own reset lines. So having
multiple reset is something more useful in such cases.

Without this patch I could not get BT and WLAN working at same time on IFC6410.

Thanks,
srini

Srinivas Kandagatla (2):
  mmc: pwrseq: Add support to control multiple gpios in simple pwrseq
  mmc: pwrseq: Update document with multiple gpios support

 .../devicetree/bindings/mmc/mmc-pwrseq-simple.txt  |  7 ++-
 drivers/mmc/core/pwrseq_simple.c                   | 64 +++++++++++++++-------
 2 files changed, 49 insertions(+), 22 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/2] mmc: pwrseq: Add support to control multiple gpios in simple pwrseq
  2015-01-28 13:16 ` Srinivas Kandagatla
  (?)
@ 2015-01-28 13:16 ` Srinivas Kandagatla
  -1 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2015-01-28 13:16 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: linux-kernel, devicetree, Kumar Gala, Rob Herring, Srinivas Kandagatla

This patch adds support to reset/powerup multiple gpio pins on a given
sdio bus. The use case is simple, on sdio we could have multiple devices
like WLAN, BT which are controlled by there own reset lines. So having
multiple reset is something more useful in such cases.

Without this patch I could not get BT and WLAN working at same time on IFC6410.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/mmc/core/pwrseq_simple.c | 64 ++++++++++++++++++++++++++++------------
 1 file changed, 45 insertions(+), 19 deletions(-)

diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index 0958c69..bb9aadd 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/device.h>
+#include <linux/of.h>
 #include <linux/err.h>
 #include <linux/gpio/consumer.h>
 
@@ -19,34 +20,44 @@
 
 struct mmc_pwrseq_simple {
 	struct mmc_pwrseq pwrseq;
-	struct gpio_desc *reset_gpio;
+	int		ngpios;
+	struct gpio_desc *reset_gpios[0];
 };
 
-static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
+static void __mmc_pwrseq_simple_pre_post_power_on_off(struct mmc_host *host,
+						      bool on)
 {
 	struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq,
 					struct mmc_pwrseq_simple, pwrseq);
+	int i;
 
-	if (!IS_ERR(pwrseq->reset_gpio))
-		gpiod_set_value_cansleep(pwrseq->reset_gpio, 1);
+	if (!IS_ERR(pwrseq->reset_gpios)) {
+		for (i = 0; i < pwrseq->ngpios; i++)
+			gpiod_set_value_cansleep(pwrseq->reset_gpios[i],
+						 on ? : 0);
+	}
 }
 
-static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host)
+static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
 {
-	struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq,
-					struct mmc_pwrseq_simple, pwrseq);
+	__mmc_pwrseq_simple_pre_post_power_on_off(host, true);
+}
 
-	if (!IS_ERR(pwrseq->reset_gpio))
-		gpiod_set_value_cansleep(pwrseq->reset_gpio, 0);
+static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host)
+{
+	__mmc_pwrseq_simple_pre_post_power_on_off(host, false);
 }
 
 static void mmc_pwrseq_simple_free(struct mmc_host *host)
 {
 	struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq,
 					struct mmc_pwrseq_simple, pwrseq);
+	int i;
 
-	if (!IS_ERR(pwrseq->reset_gpio))
-		gpiod_put(pwrseq->reset_gpio);
+	if (!IS_ERR(pwrseq->reset_gpios)) {
+		for (i = 0; i < pwrseq->ngpios; i++)
+			gpiod_put(pwrseq->reset_gpios[i]);
+	}
 
 	kfree(pwrseq);
 	host->pwrseq = NULL;
@@ -62,20 +73,35 @@ static struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
 int mmc_pwrseq_simple_alloc(struct mmc_host *host, struct device *dev)
 {
 	struct mmc_pwrseq_simple *pwrseq;
-	int ret = 0;
+	int ngpios, i, ret = 0;
+
+	ngpios = of_count_phandle_with_args(dev->of_node,
+					    "reset-gpios", "#gpio-cells");
 
-	pwrseq = kzalloc(sizeof(struct mmc_pwrseq_simple), GFP_KERNEL);
+	if (!ngpios)
+		return -ENOENT;
+
+	pwrseq = kzalloc(sizeof(struct mmc_pwrseq_simple) +
+			 ngpios * sizeof(struct gpio_desc *), GFP_KERNEL);
 	if (!pwrseq)
 		return -ENOMEM;
 
-	pwrseq->reset_gpio = gpiod_get_index(dev, "reset", 0, GPIOD_OUT_HIGH);
-	if (IS_ERR(pwrseq->reset_gpio) &&
-		PTR_ERR(pwrseq->reset_gpio) != -ENOENT &&
-		PTR_ERR(pwrseq->reset_gpio) != -ENOSYS) {
-		ret = PTR_ERR(pwrseq->reset_gpio);
-		goto free;
+	for (i = 0; i < ngpios; i++) {
+		pwrseq->reset_gpios[i] = gpiod_get_index(dev, "reset",
+							 i, GPIOD_OUT_HIGH);
+		if (IS_ERR(pwrseq->reset_gpios[i]) &&
+			PTR_ERR(pwrseq->reset_gpios[i]) != -ENOENT &&
+			PTR_ERR(pwrseq->reset_gpios[i]) != -ENOSYS) {
+			ret = PTR_ERR(pwrseq->reset_gpios[i]);
+
+			while (--i)
+				gpiod_put(pwrseq->reset_gpios[i]);
+
+			goto free;
+		}
 	}
 
+	pwrseq->ngpios = ngpios;
 	pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
 	host->pwrseq = &pwrseq->pwrseq;
 
-- 
1.9.1


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

* [PATCH 2/2] mmc: pwrseq: Update document with multiple gpios support
  2015-01-28 13:16 ` Srinivas Kandagatla
  (?)
  (?)
@ 2015-01-28 13:17 ` Srinivas Kandagatla
  -1 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2015-01-28 13:17 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: linux-kernel, devicetree, Kumar Gala, Rob Herring, Srinivas Kandagatla

This patch updates the text and examples the mmc pwrseq document with multiple
gpios support. Typical example is WLAN and BT chips on SDIO bus.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt
index da333d9..1a86efa 100644
--- a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt
+++ b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt
@@ -8,13 +8,14 @@ Required properties:
 - compatible : contains "mmc-pwrseq-simple".
 
 Optional properties:
-- reset-gpios : contains a GPIO specifier. The reset GPIO is asserted at
-	initialization and prior we start the power up procedure of the card. It
+- reset-gpios : contains list of GPIO specifiers. The reset GPIOs are asserted at
+	initialization and prior we start the power up procedure of the card. They
 	will be de-asserted right after the power has been provided to the card.
 
 Example:
 
 	sdhci0_pwrseq {
 		compatible = "mmc-pwrseq-simple";
-		reset-gpios = <&gpio1 12 0>;
+		/* WLAN and BT reset */
+		reset-gpios = <&gpio1 12 0>, <&gpio1 14 0>;
 	}
-- 
1.9.1


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

* Re: [PATCH 0/2] mmc: pwrseq: Add support to multiple gpios in pwrseq simple
@ 2015-01-28 13:35   ` Ulf Hansson
  0 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2015-01-28 13:35 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: linux-mmc, linux-kernel, devicetree, Kumar Gala, Rob Herring

On 28 January 2015 at 14:16, Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> wrote:
> This patchset adds support to reset/powerup multiple gpio pins on a given
> sdio bus. The use case is simple, on sdio we could have multiple devices
> like WLAN, BT which are controlled by there own reset lines. So having
> multiple reset is something more useful in such cases.
>
> Without this patch I could not get BT and WLAN working at same time on IFC6410.
>
> Thanks,
> srini
>
> Srinivas Kandagatla (2):
>   mmc: pwrseq: Add support to control multiple gpios in simple pwrseq
>   mmc: pwrseq: Update document with multiple gpios support
>
>  .../devicetree/bindings/mmc/mmc-pwrseq-simple.txt  |  7 ++-
>  drivers/mmc/core/pwrseq_simple.c                   | 64 +++++++++++++++-------
>  2 files changed, 49 insertions(+), 22 deletions(-)
>
> --
> 1.9.1
>

Hi Srinivas,

I noticed that Javier a few hours ago posted a patchset which
implement the same thing as yours, I guess this is a wanted feature.
:-)

I am going to review Javier's patchset, would be nice if you could
have a look at it as well.

Kind regards
Uffe

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

* Re: [PATCH 0/2] mmc: pwrseq: Add support to multiple gpios in pwrseq simple
@ 2015-01-28 13:35   ` Ulf Hansson
  0 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2015-01-28 13:35 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: linux-mmc, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Kumar Gala, Rob Herring

On 28 January 2015 at 14:16, Srinivas Kandagatla
<srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> This patchset adds support to reset/powerup multiple gpio pins on a given
> sdio bus. The use case is simple, on sdio we could have multiple devices
> like WLAN, BT which are controlled by there own reset lines. So having
> multiple reset is something more useful in such cases.
>
> Without this patch I could not get BT and WLAN working at same time on IFC6410.
>
> Thanks,
> srini
>
> Srinivas Kandagatla (2):
>   mmc: pwrseq: Add support to control multiple gpios in simple pwrseq
>   mmc: pwrseq: Update document with multiple gpios support
>
>  .../devicetree/bindings/mmc/mmc-pwrseq-simple.txt  |  7 ++-
>  drivers/mmc/core/pwrseq_simple.c                   | 64 +++++++++++++++-------
>  2 files changed, 49 insertions(+), 22 deletions(-)
>
> --
> 1.9.1
>

Hi Srinivas,

I noticed that Javier a few hours ago posted a patchset which
implement the same thing as yours, I guess this is a wanted feature.
:-)

I am going to review Javier's patchset, would be nice if you could
have a look at it as well.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/2] mmc: pwrseq: Add support to multiple gpios in pwrseq simple
@ 2015-01-28 13:46     ` Srinivas Kandagatla
  0 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2015-01-28 13:46 UTC (permalink / raw)
  To: Ulf Hansson; +Cc: linux-mmc, linux-kernel, devicetree, Kumar Gala, Rob Herring


On 28/01/15 13:35, Ulf Hansson wrote:
> On 28 January 2015 at 14:16, Srinivas Kandagatla
> <srinivas.kandagatla@linaro.org> wrote:
>> This patchset adds support to reset/powerup multiple gpio pins on a given
>> sdio bus. The use case is simple, on sdio we could have multiple devices
>> like WLAN, BT which are controlled by there own reset lines. So having
>> multiple reset is something more useful in such cases.
>>
>> Without this patch I could not get BT and WLAN working at same time on IFC6410.
>>
>> Thanks,
>> srini
>>
>> Srinivas Kandagatla (2):
>>    mmc: pwrseq: Add support to control multiple gpios in simple pwrseq
>>    mmc: pwrseq: Update document with multiple gpios support
>>
>>   .../devicetree/bindings/mmc/mmc-pwrseq-simple.txt  |  7 ++-
>>   drivers/mmc/core/pwrseq_simple.c                   | 64 +++++++++++++++-------
>>   2 files changed, 49 insertions(+), 22 deletions(-)
>>
>> --
>> 1.9.1
>>
>
> Hi Srinivas,
>
> I noticed that Javier a few hours ago posted a patchset which
> implement the same thing as yours, I guess this is a wanted feature.
> :-)
yes.

>
> I am going to review Javier's patchset, would be nice if you could
> have a look at it as well.
Sure.. they look very similar..

!!!  Should have sent my patches yesterday :-)
>
> Kind regards
> Uffe
>

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

* Re: [PATCH 0/2] mmc: pwrseq: Add support to multiple gpios in pwrseq simple
@ 2015-01-28 13:46     ` Srinivas Kandagatla
  0 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2015-01-28 13:46 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: linux-mmc, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Kumar Gala, Rob Herring


On 28/01/15 13:35, Ulf Hansson wrote:
> On 28 January 2015 at 14:16, Srinivas Kandagatla
> <srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>> This patchset adds support to reset/powerup multiple gpio pins on a given
>> sdio bus. The use case is simple, on sdio we could have multiple devices
>> like WLAN, BT which are controlled by there own reset lines. So having
>> multiple reset is something more useful in such cases.
>>
>> Without this patch I could not get BT and WLAN working at same time on IFC6410.
>>
>> Thanks,
>> srini
>>
>> Srinivas Kandagatla (2):
>>    mmc: pwrseq: Add support to control multiple gpios in simple pwrseq
>>    mmc: pwrseq: Update document with multiple gpios support
>>
>>   .../devicetree/bindings/mmc/mmc-pwrseq-simple.txt  |  7 ++-
>>   drivers/mmc/core/pwrseq_simple.c                   | 64 +++++++++++++++-------
>>   2 files changed, 49 insertions(+), 22 deletions(-)
>>
>> --
>> 1.9.1
>>
>
> Hi Srinivas,
>
> I noticed that Javier a few hours ago posted a patchset which
> implement the same thing as yours, I guess this is a wanted feature.
> :-)
yes.

>
> I am going to review Javier's patchset, would be nice if you could
> have a look at it as well.
Sure.. they look very similar..

!!!  Should have sent my patches yesterday :-)
>
> Kind regards
> Uffe
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-01-29  2:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 13:16 [PATCH 0/2] mmc: pwrseq: Add support to multiple gpios in pwrseq simple Srinivas Kandagatla
2015-01-28 13:16 ` Srinivas Kandagatla
2015-01-28 13:16 ` [PATCH 1/2] mmc: pwrseq: Add support to control multiple gpios in simple pwrseq Srinivas Kandagatla
2015-01-28 13:17 ` [PATCH 2/2] mmc: pwrseq: Update document with multiple gpios support Srinivas Kandagatla
2015-01-28 13:35 ` [PATCH 0/2] mmc: pwrseq: Add support to multiple gpios in pwrseq simple Ulf Hansson
2015-01-28 13:35   ` Ulf Hansson
2015-01-28 13:46   ` Srinivas Kandagatla
2015-01-28 13:46     ` Srinivas Kandagatla

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.