Skip to contentSkip to conversation

Assorted patches for pxa-gpio

PATCH New Daniel Mack 4 participants 16 messages Jul 11, 2013 – Aug 11, 2013 1 message not in the archive

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover Assorted patches for pxa-gpio

Hi Eric,
Hi Haojian,

here are some patches for gpio-pxa and its bindings. They fix some flaws I came across while trying to boot a PXA3xx board with v3.10+.

Best regards,
Daniel

Daniel Mack (5):
gpio: pxa: remove dead code
gpio: pxa: fix Documentation of interrupt-names property
gpio: pxa: Documentation: provide example bindings for PXA3xx
ARM: pxa: fix DT auxdata for pxa3xx-gpio
ARM: pxa: DTS: override gpio node in pxa3xx.dtsi

 .../devicetree/bindings/gpio/mrvl-gpio.txt         | 22 ++++++++++++++++++----
 arch/arm/boot/dts/pxa3xx.dtsi                      | 11 +++++++++++
 arch/arm/mach-pxa/pxa-dt.c                         |  2 +-
 drivers/gpio/gpio-pxa.c                            | 13 +++----------
 4 files changed, 33 insertions(+), 15 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/5 gpio: pxa: remove dead code

Commit f87311743 ("ARM: mmp: add more compatible names in gpio driver") changed the driver logic to determine the number of available GPIOs from the compatible string, and hence obsoleted the (undocumented) child nodes that were previously necessary. However, it left some remainder which can be safely removed now.

Also, this patch makes pxa_gpio_probe_dt() return the correct value in case irq_alloc_descs() fails.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 drivers/gpio/gpio-pxa.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
drivers/gpio/gpio-pxa.c +3 -10
index df2199d..cc13d1b 100644
@@ -524,8 +524,8 @@ const struct irq_domain_ops pxa_irq_domain_ops = {
 
 static int pxa_gpio_probe_dt(struct platform_device *pdev)
 {
-	int ret, nr_gpios;
-	struct device_node *prev, *next, *np = pdev->dev.of_node;
+	int ret = 0, nr_gpios;
+	struct device_node *np = pdev->dev.of_node;
 	const struct of_device_id *of_id =
 				of_match_device(pxa_gpio_dt_ids, &pdev->dev);
 	const struct pxa_gpio_id *gpio_id;
@@ -537,20 +537,13 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev)
 	gpio_id = of_id->data;
 	gpio_type = gpio_id->type;
 
-	next = of_get_next_child(np, NULL);
-	prev = next;
-	if (!next) {
-		dev_err(&pdev->dev, "Failed to find child gpio node\n");
-		ret = -EINVAL;
-		goto err;
-	}
-	of_node_put(prev);
 	nr_gpios = gpio_id->gpio_nums;
 	pxa_last_gpio = nr_gpios - 1;
 
 	irq_base = irq_alloc_descs(-1, 0, nr_gpios, 0);
 	if (irq_base < 0) {
 		dev_err(&pdev->dev, "Failed to allocate IRQ numbers\n");
+		ret = irq_base;
 		goto err;
 	}
 	domain = irq_domain_add_legacy(np, nr_gpios, irq_base, 0,
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 1/5 gpio: pxa: remove dead code

Quoted 6 lines · Daniel Mack

Commit f87311743 ("ARM: mmp: add more compatible names in gpio driver") changed the driver logic to determine the number of available GPIOs from the compatible string, and hence obsoleted the (undocumented) child nodes that were previously necessary. However, it left some remainder which can be safely removed now.

Quoted 7 lines

Also, this patch makes pxa_gpio_probe_dt() return the correct value in case irq_alloc_descs() fails.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>

Tentatively applied, Haojian, does this look allright?

Yours,
Linus Walleij

#3 lore raw

PATCH 1/5 gpio: pxa: remove dead code

Quoted 16 lines · Linus Walleij
Quoted 6 lines · Daniel Mack

Commit f87311743 ("ARM: mmp: add more compatible names in gpio driver") changed the driver logic to determine the number of available GPIOs from the compatible string, and hence obsoleted the (undocumented) child nodes that were previously necessary. However, it left some remainder which can be safely removed now.

Quoted 7 lines

Also, this patch makes pxa_gpio_probe_dt() return the correct value in case irq_alloc_descs() fails.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
Quoted 4 lines

Tentatively applied, Haojian, does this look allright?

Yours,
Linus Walleij

This patch is good.

#4 lore raw

PATCH 1/5 gpio: pxa: remove dead code

Quoted 17 lines · Haojian Zhuang
Quoted 16 lines · Linus Walleij
Quoted 13 lines · Daniel Mack

Commit f87311743 ("ARM: mmp: add more compatible names in gpio driver") changed the driver logic to determine the number of available GPIOs from the compatible string, and hence obsoleted the (undocumented) child nodes that were previously necessary. However, it left some remainder which can be safely removed now.

Also, this patch makes pxa_gpio_probe_dt() return the correct value in case irq_alloc_descs() fails.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
Quoted 9 lines
Quoted 4 lines

Tentatively applied, Haojian, does this look allright?

Yours,
Linus Walleij

This patch is good.

And what about the others? I think the first 3 patches of this series can go through Linus W, and the other 2 should end up in the pxa tree, right?

Thanks,
Daniel

#5 lore raw

PATCH 1/5 gpio: pxa: remove dead code

Quoted 3 lines · Daniel Mack

And what about the others? I think the first 3 patches of this series can go through Linus W, and the other 2 should end up in the pxa tree, right?

Yes. They might need to build on top of the pinctrl tree.

Or, if there are no other things happening in the PXA tree for the next merge window, I can take it into my tree, with the ACKs of e.g. Eric and Olof Johansson.

Yours,
Linus Walleij

A message that is not in the archive (sent off-list or not yet received): CAD6h2NRBsRZkeZnQfko0inQ=QKurqibNSq_ZnuipU5MtZW3h=Q@mail.gmail.com

#7 lore raw

PATCH 1/5 gpio: pxa: remove dead code

Quoted 17 lines · Haojian Zhuang
Quoted 1 line · Linus Walleij

On Thu, Jul 25, 2013 at 11:00 AM, Daniel Mack <[email protected]>

Quoted 2 lines · wrote:
Quoted 2 lines

And what about the others? I think the first 3 patches of this

series

Quoted 1 line
Quoted 1 line

can go through Linus W, and the other 2 should end up in the pxa

tree,

Quoted 8 lines
Quoted 1 line

right?

Yes. They might need to build on top of the pinctrl tree.

Or, if there are no other things happening in the PXA tree for the next merge window, I can take it into my tree, with the ACKs of e.g. Eric and Olof Johansson.

Quoted 5 lines
Quoted 3 lines

Yours,
Linus Walleij

It's OK to merge all patches into gpio git tree.

No, wait. I have some more patches coming soon, and they will cause conflicts then in the merge window. So please take the last two ones into the pxa repo, and only the gpio specific one through Linus W.

Thanks,
Daniel

Quoted 1 line
#8 lore raw

PATCH 2/5 gpio: pxa: fix Documentation of interrupt-names property

In reply to Daniel Mack

The property name to pass names for interrupt resources is called "interrupt-names", not "interrupt-name". Fix it to avoid further confusion.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 Documentation/devicetree/bindings/gpio/mrvl-gpio.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/gpio/mrvl-gpio.txt +4 -3
index 9b3f1d4..6641626 100644
@@ -10,8 +10,9 @@ Required properties:
   There're three gpio interrupts in arch-pxa, and they're gpio0,
   gpio1 and gpio_mux. There're only one gpio interrupt in arch-mmp,
   gpio_mux.
-- interrupt-name : Should be the name of irq resource. Each interrupt
-  binds its interrupt-name.
+- interrupt-names : Should be the names of irq resources. Each interrupt
+  uses its own interrupt name, so there should be as many interrupt names
+  as referenced interrups.
 - interrupt-controller : Identifies the node as an interrupt controller.
 - #interrupt-cells: Specifies the number of cells needed to encode an
   interrupt source.
@@ -24,7 +25,7 @@ Example:
 		compatible = "marvell,mmp-gpio";
 		reg = <0xd4019000 0x1000>;
 		interrupts = <49>;
-		interrupt-name = "gpio_mux";
+		interrupt-names = "gpio_mux";
 		gpio-controller;
 		#gpio-cells = <1>;
 		interrupt-controller;
Signature · 1 line
1.8.1.4
#9 lore raw

PATCH 2/5 gpio: pxa: fix Documentation of interrupt-names property

Quoted 8 lines · Daniel Mack

The property name to pass names for interrupt resources is called "interrupt-names", not "interrupt-name". Fix it to avoid further confusion.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>

Obviously correct so applied.

Cc binding patches to devicetree at vger.kernel.org going forward...

Yours,
Linus Walleij

#10 lore raw

PATCH 3/5 gpio: pxa: Documentation: provide example bindings for PXA3xx

In reply to Daniel Mack

Add another example to describe bindings that work for PXA3xx boards.

---
 Documentation/devicetree/bindings/gpio/mrvl-gpio.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/gpio/mrvl-gpio.txt +14 -1
index 6641626..b2afdb2 100644
@@ -19,7 +19,7 @@ Required properties:
 - gpio-controller : Marks the device node as a gpio controller.
 - #gpio-cells : Should be one.  It is the pin number.
 
-Example:
+Example for a MMP platform:
 
 	gpio: gpio at d4019000 {
 		compatible = "marvell,mmp-gpio";
@@ -32,6 +32,19 @@ Example:
 		#interrupt-cells = <1>;
       };
 
+Example for a PXA3xx platform:
+
+	gpio: gpio at 40e00000 {
+		compatible = "intel,pxa3xx-gpio";
+		reg = <0x40e00000 0x10000>;
+		interrupt-names = "gpio0", "gpio1", "gpio_mux";
+		interrupts = <8 9 10>;
+		gpio-controller;
+		#gpio-cells = <0x2>;
+		interrupt-controller;
+		#interrupt-cells = <0x2>;
+	};
+
 * Marvell Orion GPIO Controller
 
 Required properties:
Signature · 1 line
1.8.1.4
maintainer
#11 lore raw

PATCH 3/5 gpio: pxa: Documentation: provide example bindings for PXA3xx

Quoted 41 lines · Daniel Mack

Add another example to describe bindings that work for PXA3xx boards.

---
 Documentation/devicetree/bindings/gpio/mrvl-gpio.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/gpio/mrvl-gpio.txt +14 -2
index 6641626..b2afdb2 100644
@@ -19,7 +19,7 @@ Required properties:
 - gpio-controller : Marks the device node as a gpio controller.
 - #gpio-cells : Should be one.  It is the pin number.
 
-Example:
+Example for a MMP platform:
 
        gpio: gpio at d4019000 {
                compatible = "marvell,mmp-gpio";
@@ -32,6 +32,19 @@ Example:
                #interrupt-cells = <1>;
       };
 
+Example for a PXA3xx platform:
+
+       gpio: gpio at 40e00000 {
+               compatible = "intel,pxa3xx-gpio";
+               reg = <0x40e00000 0x10000>;
+               interrupt-names = "gpio0", "gpio1", "gpio_mux";
+               interrupts = <8 9 10>;
+               gpio-controller;
+               #gpio-cells = <0x2>;
+               interrupt-controller;
+               #interrupt-cells = <0x2>;
+       };
+
 * Marvell Orion GPIO Controller
 
 Required properties:
--
Quoted 3 lines

1.8.1.4

#12 lore raw

PATCH 3/5 gpio: pxa: Documentation: provide example bindings for PXA3xx

Quoted 40 lines · Haojian Zhuang
Quoted 39 lines · Daniel Mack

Add another example to describe bindings that work for PXA3xx boards.

---
 Documentation/devicetree/bindings/gpio/mrvl-gpio.txt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/gpio/mrvl-gpio.txt +14 -1
index 6641626..b2afdb2 100644
@@ -19,7 +19,7 @@ Required properties:
 - gpio-controller : Marks the device node as a gpio controller.
 - #gpio-cells : Should be one.  It is the pin number.
 
-Example:
+Example for a MMP platform:
 
        gpio: gpio at d4019000 {
                compatible = "marvell,mmp-gpio";
@@ -32,6 +32,19 @@ Example:
                #interrupt-cells = <1>;
       };
 
+Example for a PXA3xx platform:
+
+       gpio: gpio at 40e00000 {
+               compatible = "intel,pxa3xx-gpio";
+               reg = <0x40e00000 0x10000>;
+               interrupt-names = "gpio0", "gpio1", "gpio_mux";
+               interrupts = <8 9 10>;
+               gpio-controller;
+               #gpio-cells = <0x2>;
+               interrupt-controller;
+               #interrupt-cells = <0x2>;
+       };
+
 * Marvell Orion GPIO Controller
 
Quoted 7 lines
Quoted 5 lines
Documentation/devicetree/bindings/gpio/mrvl-gpio.txt +0 -1
 Required properties:
--

1.8.1.4

Ok, great, thanks Haojian.

Linus W, 4/5 and 5/5 will be picked and merged by Haojian's tree. That makes more sense as I have more pxa patches coming.

Thanks,
Daniel

#13 lore raw

PATCH 4/5 ARM: pxa: fix DT auxdata for pxa3xx-gpio

In reply to Daniel Mack

Commit f87311743 ("ARM: mmp: add more compatible names in gpio driver") changed the DT match string for pxa3xx-gpio, but left the auxdata table unchanged.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/arm/mach-pxa/pxa-dt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/pxa-dt.c +1 -1
index 3835979..f6a2c4b 100644
@@ -28,7 +28,7 @@ static const struct of_dev_auxdata pxa3xx_auxdata_lookup[] __initconst = {
 	OF_DEV_AUXDATA("mrvl,pxa-uart",		0x40700000, "pxa2xx-uart.2", NULL),
 	OF_DEV_AUXDATA("mrvl,pxa-uart",		0x41600000, "pxa2xx-uart.3", NULL),
 	OF_DEV_AUXDATA("marvell,pxa-mmc",	0x41100000, "pxa2xx-mci.0", NULL),
-	OF_DEV_AUXDATA("mrvl,pxa-gpio",		0x40e00000, "pxa-gpio", NULL),
+	OF_DEV_AUXDATA("intel,pxa3xx-gpio",	0x40e00000, "pxa3xx-gpio", NULL),
 	OF_DEV_AUXDATA("marvell,pxa-ohci",	0x4c000000, "pxa27x-ohci", NULL),
 	OF_DEV_AUXDATA("mrvl,pxa-i2c",		0x40301680, "pxa2xx-i2c.0", NULL),
 	OF_DEV_AUXDATA("mrvl,pwri2c",		0x40f500c0, "pxa3xx-i2c.1", NULL),
Signature · 1 line
1.8.1.4
#14 lore raw

PATCH 4/5 ARM: pxa: fix DT auxdata for pxa3xx-gpio

Quoted 26 lines · Daniel Mack

Commit f87311743 ("ARM: mmp: add more compatible names in gpio driver") changed the DT match string for pxa3xx-gpio, but left the auxdata table unchanged.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/arm/mach-pxa/pxa-dt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/pxa-dt.c +1 -2
index 3835979..f6a2c4b 100644
@@ -28,7 +28,7 @@ static const struct of_dev_auxdata pxa3xx_auxdata_lookup[] __initconst = {
        OF_DEV_AUXDATA("mrvl,pxa-uart",         0x40700000, "pxa2xx-uart.2", NULL),
        OF_DEV_AUXDATA("mrvl,pxa-uart",         0x41600000, "pxa2xx-uart.3", NULL),
        OF_DEV_AUXDATA("marvell,pxa-mmc",       0x41100000, "pxa2xx-mci.0", NULL),
-       OF_DEV_AUXDATA("mrvl,pxa-gpio",         0x40e00000, "pxa-gpio", NULL),
+       OF_DEV_AUXDATA("intel,pxa3xx-gpio",     0x40e00000, "pxa3xx-gpio", NULL),
        OF_DEV_AUXDATA("marvell,pxa-ohci",      0x4c000000, "pxa27x-ohci", NULL),
        OF_DEV_AUXDATA("mrvl,pxa-i2c",          0x40301680, "pxa2xx-i2c.0", NULL),
        OF_DEV_AUXDATA("mrvl,pwri2c",           0x40f500c0, "pxa3xx-i2c.1", NULL),
--
Quoted 2 lines

1.8.1.4

Applied.

Regards
Haojian

#15 lore raw

PATCH 5/5 ARM: pxa: DTS: override gpio node in pxa3xx.dtsi

In reply to Daniel Mack

The gpio controller node inherited from pxa2xx.dtsi won't work for pxa3xx SoCs, so let's override it in pxa3xx.dtsi.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/arm/boot/dts/pxa3xx.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/pxa3xx.dtsi +11 -0
index f9d92da..83bb0ef 100644
@@ -28,5 +28,16 @@
 			marvell,intc-priority;
 			marvell,intc-nr-irqs = <56>;
 		};
+
+		gpio: gpio at 40e00000 {
+			compatible = "intel,pxa3xx-gpio";
+			reg = <0x40e00000 0x10000>;
+			interrupt-names = "gpio0", "gpio1", "gpio_mux";
+			interrupts = <8 9 10>;
+			gpio-controller;
+			#gpio-cells = <0x2>;
+			interrupt-controller;
+			#interrupt-cells = <0x2>;
+		};
 	};
 };
Signature · 1 line
1.8.1.4
#16 lore raw

PATCH 5/5 ARM: pxa: DTS: override gpio node in pxa3xx.dtsi

Quoted 33 lines · Daniel Mack

The gpio controller node inherited from pxa2xx.dtsi won't work for pxa3xx SoCs, so let's override it in pxa3xx.dtsi.

Cc Haojian Zhuang <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 arch/arm/boot/dts/pxa3xx.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/boot/dts/pxa3xx.dtsi +11 -1
index f9d92da..83bb0ef 100644
@@ -28,5 +28,16 @@
                        marvell,intc-priority;
                        marvell,intc-nr-irqs = <56>;
                };
+
+               gpio: gpio at 40e00000 {
+                       compatible = "intel,pxa3xx-gpio";
+                       reg = <0x40e00000 0x10000>;
+                       interrupt-names = "gpio0", "gpio1", "gpio_mux";
+                       interrupts = <8 9 10>;
+                       gpio-controller;
+                       #gpio-cells = <0x2>;
+                       interrupt-controller;
+                       #interrupt-cells = <0x2>;
+               };
        };
 };
--
Quoted 2 lines

1.8.1.4

Applied.

Regards
Haojian