devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: pl061 : fix gpio pl061 request bug
@ 2014-10-09  7:26 Xinwei Kong
  0 siblings, 0 replies; 3+ messages in thread
From: Xinwei Kong @ 2014-10-09  7:26 UTC (permalink / raw)
  To: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA,
	heyunlei-hv44wF8Li93QT0dZR+AlfA,
	z.liuxinliang-hv44wF8Li93QT0dZR+AlfA,
	liguozhu-C8/M+/jPZTeaMJb+Lgu22Q
  Cc: k00278426

From: k00278426 <kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>

Some gpio controller dts nodes has no "gpio-range" property will cause gpio
request fail(return -517).
Maybe in this case gpio request shouldn't go into pinctrl subsystem.

This patch try to resolve this gpio request issue.

Signed-off-by: k00278426 <kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
Signed-off-by: Yunlei He <heyunlei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---
 drivers/gpio/gpio-pl061.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 84b49cf..37ffe38 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pm.h>
+#include <linux/of_address.h>
 
 #define GPIODIR 0x400
 #define GPIOIS  0x404
@@ -264,8 +265,10 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
 
 	spin_lock_init(&chip->lock);
 
-	chip->gc.request = pl061_gpio_request;
-	chip->gc.free = pl061_gpio_free;
+	if (of_get_property(dev->of_node, "gpio-ranges", NULL)) {
+		chip->gc.request = pl061_gpio_request;
+		chip->gc.free = pl061_gpio_free;
+	}
 	chip->gc.direction_input = pl061_direction_input;
 	chip->gc.direction_output = pl061_direction_output;
 	chip->gc.get = pl061_get_value;
-- 
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 related	[flat|nested] 3+ messages in thread

* [PATCH] gpio: pl061 : fix gpio pl061 request bug
@ 2014-10-09 12:03 Xinwei Kong
       [not found] ` <1412856225-7640-1-git-send-email-kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Xinwei Kong @ 2014-10-09 12:03 UTC (permalink / raw)
  To: grant.likely-QSEj5FYQhm4dnm+yROfE0A,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA,
	liguozhuo-C8/M+/jPZTeaMJb+Lgu22Q
  Cc: k00278426, Yunlei He, Haojian Zhuang

From: k00278426 <kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>

Some gpio controller dts nodes has no "gpio-range" property will cause gpio
request fail(return -517).
Maybe in this case gpio request shouldn't go into pinctrl subsystem.

This patch try to resolve this gpio request issue.

Signed-off-by: k00278426 <kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
Signed-off-by: Yunlei He <heyunlei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
Signed-off-by: Haojian Zhuang <haojian.zhuang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 drivers/gpio/gpio-pl061.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index 84b49cf..37ffe38 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <linux/pinctrl/consumer.h>
 #include <linux/pm.h>
+#include <linux/of_address.h>
 
 #define GPIODIR 0x400
 #define GPIOIS  0x404
@@ -264,8 +265,10 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
 
 	spin_lock_init(&chip->lock);
 
-	chip->gc.request = pl061_gpio_request;
-	chip->gc.free = pl061_gpio_free;
+	if (of_get_property(dev->of_node, "gpio-ranges", NULL)) {
+		chip->gc.request = pl061_gpio_request;
+		chip->gc.free = pl061_gpio_free;
+	}
 	chip->gc.direction_input = pl061_direction_input;
 	chip->gc.direction_output = pl061_direction_output;
 	chip->gc.get = pl061_get_value;
-- 
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 related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: pl061 : fix gpio pl061 request bug
       [not found] ` <1412856225-7640-1-git-send-email-kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
@ 2014-10-09 12:05   ` Haojian Zhuang
  0 siblings, 0 replies; 3+ messages in thread
From: Haojian Zhuang @ 2014-10-09 12:05 UTC (permalink / raw)
  To: Xinwei Kong
  Cc: Grant Likely, Rob Herring,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	liguozhuo-C8/M+/jPZTeaMJb+Lgu22Q, Yunlei He

On 9 October 2014 20:03, Xinwei Kong <kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org> wrote:
> From: k00278426 <kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
>
> Some gpio controller dts nodes has no "gpio-range" property will cause gpio
> request fail(return -517).
> Maybe in this case gpio request shouldn't go into pinctrl subsystem.
>
> This patch try to resolve this gpio request issue.
>
> Signed-off-by: k00278426 <kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
> Signed-off-by: Yunlei He <heyunlei-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Haojian Zhuang <haojian.zhuang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/gpio/gpio-pl061.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
> index 84b49cf..37ffe38 100644
> --- a/drivers/gpio/gpio-pl061.c
> +++ b/drivers/gpio/gpio-pl061.c
> @@ -24,6 +24,7 @@
>  #include <linux/slab.h>
>  #include <linux/pinctrl/consumer.h>
>  #include <linux/pm.h>
> +#include <linux/of_address.h>
>
>  #define GPIODIR 0x400
>  #define GPIOIS  0x404
> @@ -264,8 +265,10 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
>
>         spin_lock_init(&chip->lock);
>
> -       chip->gc.request = pl061_gpio_request;
> -       chip->gc.free = pl061_gpio_free;
> +       if (of_get_property(dev->of_node, "gpio-ranges", NULL)) {
> +               chip->gc.request = pl061_gpio_request;
> +               chip->gc.free = pl061_gpio_free;
> +       }

Hi Xinwei,

Please follow the comments from Linus in the previous mail thread.

Regards
Haojian
>         chip->gc.direction_input = pl061_direction_input;
>         chip->gc.direction_output = pl061_direction_output;
>         chip->gc.get = pl061_get_value;
> --
> 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] 3+ messages in thread

end of thread, other threads:[~2014-10-09 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-09  7:26 [PATCH] gpio: pl061 : fix gpio pl061 request bug Xinwei Kong
  -- strict thread matches above, loose matches on Subject: below --
2014-10-09 12:03 Xinwei Kong
     [not found] ` <1412856225-7640-1-git-send-email-kong.kongxinwei-C8/M+/jPZTeaMJb+Lgu22Q@public.gmane.org>
2014-10-09 12:05   ` Haojian Zhuang

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