Skip to contentSkip to conversation

GPIO DT support for da850

PATCH In review Philip Avinash 5 participants 12 messages Jun 14, 2013 – Aug 14, 2013

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

v2 cover GPIO DT support for da850

With conversion of GPIO davinci driver to platform driver, gpio-davinci driver can support DT boot.
This patch series
- adds dt binding support for gpio-davinci.
- da850 dt support goio.

This patch series is based on Linux 3.10-rc4 and is availabel at [1].

1. https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4

KV Sujith (3):
gpio: davinci: DT changes for driver
ARM: davinci: da850: add GPIO DT entries
ARM: davinci: da850 evm: add GPIO DT data

Philip Avinash (1):
ARM: davinci: da850: Use #include for all device trees

 .../devicetree/bindings/gpio/gpio-davinci.txt      |   32 +++++++++++
 arch/arm/boot/dts/da850-enbw-cmc.dts               |    2 +-
 arch/arm/boot/dts/da850-evm.dts                    |   21 +++++++-
 arch/arm/boot/dts/da850.dtsi                       |   17 +++++-
 drivers/gpio/gpio-davinci.c                        |   57 ++++++++++++++++++--
 5 files changed, 123 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/4 ARM: davinci: da850: Use #include for all device trees

Replace /include/ by #include for da850 device tree files, in order to use the C pre-processor, making use of #define features possible.

---
Changes since v1:
- New patch and comes as a dependency of patch 3/4

 arch/arm/boot/dts/da850-enbw-cmc.dts |    2 +-
 arch/arm/boot/dts/da850-evm.dts      |    2 +-
 arch/arm/boot/dts/da850.dtsi         |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/da850-enbw-cmc.dts +1 -1
index 422fdb3..e750ab9 100644
@@ -10,7 +10,7 @@
  * option) any later version.
  */
 /dts-v1/;
-/include/ "da850.dtsi"
+#include "da850.dtsi"
 
 / {
 	compatible = "enbw,cmc", "ti,da850";
arch/arm/boot/dts/da850-evm.dts +1 -1
index c914357..5bce7cc 100644
@@ -8,7 +8,7 @@
  * Free Software Foundation, version 2.
  */
 /dts-v1/;
-/include/ "da850.dtsi"
+#include "da850.dtsi"
 
 / {
 	compatible = "ti,da850-evm", "ti,da850";
arch/arm/boot/dts/da850.dtsi +1 -1
index 452bdc6..3b66020 100644
@@ -7,7 +7,7 @@
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	arm {
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v2 1/4] ARM: davinci: da850: Use #include for all device trees

Quoted 4 lines · Philip Avinash

Replace /include/ by #include for da850 device tree files, in order to use the C pre-processor, making use of #define features possible.

Added this to my v3.11/dt branch.

Thanks,
Sekhar

#3 lore raw

PATCH v2 3/4 ARM: davinci: da850: add GPIO DT entries

In reply to Philip Avinash

From: KV Sujith <[email protected]>

Add DT entries for Davinci GPIO.

---
Changes since v1:
- interrupts member defined as array and with interrupt flags

 arch/arm/boot/dts/da850.dtsi |   15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/da850.dtsi +14 -0
index 3b66020..cd7b362 100644
@@ -8,6 +8,7 @@
  * option) any later version.
  */
 #include "skeleton.dtsi"
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
 	arm {
@@ -126,6 +127,20 @@
 				>;
 			};
 		};
+		gpio: gpio@1e26000 {
+			compatible = "ti,da830-gpio";
+			reg = <0x226000 0x1000>;
+			interrupts = <42 IRQ_TYPE_EDGE_BOTH
+				43 IRQ_TYPE_EDGE_BOTH 44 IRQ_TYPE_EDGE_BOTH
+				45 IRQ_TYPE_EDGE_BOTH 46 IRQ_TYPE_EDGE_BOTH
+				47 IRQ_TYPE_EDGE_BOTH 48 IRQ_TYPE_EDGE_BOTH
+				49 IRQ_TYPE_EDGE_BOTH 50 IRQ_TYPE_EDGE_BOTH>;
+			ngpio = <144>;
+			intc_irq_num = <101>;
+			gpio_unbanked = <0>;
+			status = "disabled";
+		};
 		serial0: serial@1c42000 {
 			compatible = "ns16550a";
 			reg = <0x42000 0x100>;
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v2 4/4 ARM: davinci: da850 evm: add GPIO DT data

In reply to Philip Avinash

From: KV Sujith <[email protected]>

- Add GPIO DT Data and pinmux for DA850 EVM. GPIO is configurable differently on different boards. So add GPIO pinmuxing in dts file.
- Dependency: This patch is dependent on Grab-pin-control patch;
https://patchwork.kernel.org/patch/2013751/

---
 arch/arm/boot/dts/da850-evm.dts |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/arm/boot/dts/da850-evm.dts +19 -0
index 5bce7cc..2c127ff 100644
@@ -17,6 +17,20 @@
 	soc {
 		pmx_core: pinmux@1c14120 {
 			status = "okay";
+			gpio_pins: pinmux_gpio_pins {
+				pinctrl-single,bits = <
+					/* GPIO2_4 GPIO2_6 */
+					0x18 0x00008080 0x0000f0f0
+					/* GPIO2_8 GPIO2_15 */
+					0x14 0x80000008 0xf000000f
+					/* GPIO3_12 GPIO3_13 */
+					0x1C 0x00008800 0x0000ff00
+					/* GPIO4_0 GPIO4_1 */
+					0x28 0x88000000 0xff000000
+					/* GPIO6_9 GPIO6_10 GPIO6_13 */
+					0x34 0x08800800 0x0ff00f00
+				>;
+			};
 		};
 		serial0: serial@1c42000 {
 			status = "okay";
@@ -90,6 +104,11 @@
 				};
 			};
 		};
+		gpio: gpio@1e26000 {
+			status = "okay";
+			pinctrl-names = "default";
+			pinctrl-0 = <&gpio_pins>;
+		};
 	};
 	nand_cs3@62000000 {
 		status = "okay";
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH v2 2/4 gpio: davinci: DT changes for driver

In reply to Philip Avinash

From: KV Sujith <[email protected]>

- Add of_device_id for Davinci GPIO driver.
- Add function to populate data from DT.
- Modify the probe to read from DT if DT match is found.
- Add DT binding documentation for Davinci GPIO properties in a new file gpio-davinci.txt located at Documentation/devicetree/bindings/gpio/.

---
Changes since v1:
- description for interrupts changed to reflecti interrupt array usage.

 .../devicetree/bindings/gpio/gpio-davinci.txt      |   32 +++++++++++
 drivers/gpio/gpio-davinci.c                        |   57 ++++++++++++++++++--
 2 files changed, 86 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/gpio/gpio-davinci.txt new file +32 -0
new file mode 100644
index 0000000..1c31638
@@ -0,0 +1,32 @@
+Davinci GPIO controller bindings
+
+Required Properties:
+- compatible:"ti,da830-gpio"
+
+- reg: Physical base address of the controller and length of memory mapped
+	region.
+
+- interrupts: Array of GPIO interrupt number.
+
+- ngpio: The number of GPIO pins supported
+
+- intc_irq_num: The number of IRQs supported by the Interrupt Controller
+
+- gpio_unbanked: The number of GPIOs that have an individual interrupt
+		line to processor.
+
+Example:
+#include <dt-bindings/interrupt-controller/irq.h>
+
+gpio: gpio@1e26000 {
+	compatible = "ti,da830-gpio";
+	reg = <0x226000 0x1000>;
+	interrupts = <42 IRQ_TYPE_EDGE_BOTH 43 IRQ_TYPE_EDGE_BOTH
+		44 IRQ_TYPE_EDGE_BOTH 45 IRQ_TYPE_EDGE_BOTH
+		46 IRQ_TYPE_EDGE_BOTH 47 IRQ_TYPE_EDGE_BOTH
+		48 IRQ_TYPE_EDGE_BOTH 49 IRQ_TYPE_EDGE_BOTH
+		50 IRQ_TYPE_EDGE_BOTH>;
+	ngpio = <144>;
+	intc_irq_num = <101>;
+	gpio_unbanked = <0>;
+};
drivers/gpio/gpio-davinci.c +54 -3

87 lines not on this page · raw message

Signature · 1 line
1.7.9.5
Acked-by on v2 2/4
#6 lore raw

Re: [PATCH v2 2/4] gpio: davinci: DT changes for driver

Quoted 14 lines · Philip Avinash

From: KV Sujith <[email protected]>

- Add of_device_id for Davinci GPIO driver.
- Add function to populate data from DT.
- Modify the probe to read from DT if DT match is found.
- Add DT binding documentation for Davinci GPIO properties in a new file gpio-davinci.txt located at Documentation/devicetree/bindings/gpio/.

---
Changes since v1:
- description for interrupts changed to reflecti interrupt array usage.

(...)

drivers/gpio/gpio-davinci.c davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · line 150

Quoted 9 lines
drivers/gpio/gpio-davinci.c +9 -0
+static struct davinci_gpio_platform_data *davinci_gpio_set_pdata_of(
+                                               struct platform_device *pdev)
+{
+       struct device_node *dn = pdev->dev.of_node;
+       struct davinci_gpio_platform_data *pdata;
+       u32 val, ret;
+
+       pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+       if (pdata) {

Instead of this arrow pattern:

if (!pdata) {
dev_err( ... "out of memory allocating platform data"); return NULL;
}

And de-indent the rest.

With that change:

I guess this may go through the DaVinci tree with the rest of the DaVinci patches?

Yours,
Linus Walleij

#7 lore raw

Re: [PATCH v2 2/4] gpio: davinci: DT changes for driver

Quoted 36 lines · Linus Walleij
Quoted 14 lines · Philip Avinash

From: KV Sujith <[email protected]>

- Add of_device_id for Davinci GPIO driver.
- Add function to populate data from DT.
- Modify the probe to read from DT if DT match is found.
- Add DT binding documentation for Davinci GPIO properties in a new file gpio-davinci.txt located at Documentation/devicetree/bindings/gpio/.

---
Changes since v1:
- description for interrupts changed to reflecti interrupt array usage.

(...)

drivers/gpio/gpio-davinci.c davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · line 150

Quoted 9 lines
drivers/gpio/gpio-davinci.c +9 -0
+static struct davinci_gpio_platform_data *davinci_gpio_set_pdata_of(
+                                               struct platform_device *pdev)
+{
+       struct device_node *dn = pdev->dev.of_node;
+       struct davinci_gpio_platform_data *pdata;
+       u32 val, ret;
+
+       pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+       if (pdata) {

Instead of this arrow pattern:

if (!pdata) {
dev_err( ... "out of memory allocating platform data"); return NULL;
}

Quoted 7 lines

And de-indent the rest.

With that change:

I guess this may go through the DaVinci tree with the rest of the DaVinci patches?

Linus, yes, I will pick these up with your acks.

Thanks,
Sekhar

#8 lore raw

Re: [PATCH v2 2/4] gpio: davinci: DT changes for driver

In reply to Philip Avinash
Quoted 25 lines · Philip Avinash

From: KV Sujith <[email protected]>

- Add of_device_id for Davinci GPIO driver.
- Add function to populate data from DT.
- Modify the probe to read from DT if DT match is found.
- Add DT binding documentation for Davinci GPIO properties in a new file gpio-davinci.txt located at Documentation/devicetree/bindings/gpio/.

---
Changes since v1:
- description for interrupts changed to reflecti interrupt array usage.

 .../devicetree/bindings/gpio/gpio-davinci.txt      |   32 +++++++++++
 drivers/gpio/gpio-davinci.c                        |   57 ++++++++++++++++++--
 2 files changed, 86 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/gpio/gpio-davinci.txt new file +0 -0
new file mode 100644
index 0000000..1c31638

Documentation/devicetree/bindings/gpio/gpio-davinci.txt line 4

Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-davinci.txt new file +4 -0
@@ -0,0 +1,32 @@
+Davinci GPIO controller bindings
+
+Required Properties:
+- compatible:"ti,da830-gpio"

"ti,dm6441-gpio" instead since this came first on DM6441?

Documentation/devicetree/bindings/gpio/gpio-davinci.txt line 11

Quoted 7 lines
Documentation/devicetree/bindings/gpio/gpio-davinci.txt new file +7 -0
+
+- reg: Physical base address of the controller and length of memory mapped
+	region.
+
+- interrupts: Array of GPIO interrupt number.
+
+- ngpio: The number of GPIO pins supported

Is this a generic GPIO property? I could not find it in documentation. Looks like Marvell GPIO uses a similar property too, but even there it is not marked as Marvell specific. Should this be added as a generic GPIO property?

Documentation/devicetree/bindings/gpio/gpio-davinci.txt line 13

Quoted 1 line
Documentation/devicetree/bindings/gpio/gpio-davinci.txt new file +1 -0
+- intc_irq_num: The number of IRQs supported by the Interrupt Controller

You are not actually looking at the number of IRQs interrupt controller on the SoC supports (which is quite unrelated to GPIO module). What you are actually looking for is the base from where GPIO interrupt numbering can start. So "ti,davinci-gpio-irq-base" is more meaningful.

That said, this property is probably not required if irqdomains are used (I myself have to read about that). Not sure if it is okay to add this property now waiting for irqdomain conversion. I will let Linus take a call.

Documentation/devicetree/bindings/gpio/gpio-davinci.txt line 16

Quoted 3 lines
Documentation/devicetree/bindings/gpio/gpio-davinci.txt new file +3 -0
+
+- gpio_unbanked: The number of GPIOs that have an individual interrupt
+		line to processor.

This is also a TI specific property so it should be "ti,davinci-gpio-unbanked".

Thanks,
Sekhar

#9 lore raw
In reply to Philip Avinash
Quoted 9 lines · Avinash

With conversion of GPIO davinci driver to platform driver, gpio-davinci driver can support DT boot.
This patch series
- adds dt binding support for gpio-davinci.
- da850 dt support goio.

This patch series is based on Linux 3.10-rc4 and is availabel at [1].

1. https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4

This patch series has dependency on [PATCH v2 0/7] Convert GPIO Davinci to platform driver

https://lkml.org/lkml/2013/6/14/120

Thanks
Avinash

Quoted 25 lines

KV Sujith (3):
gpio: davinci: DT changes for driver
ARM: davinci: da850: add GPIO DT entries
ARM: davinci: da850 evm: add GPIO DT data

Philip Avinash (1):
ARM: davinci: da850: Use #include for all device trees

 .../devicetree/bindings/gpio/gpio-davinci.txt      |   32 +++++++++++
 arch/arm/boot/dts/da850-enbw-cmc.dts               |    2 +-
 arch/arm/boot/dts/da850-evm.dts                    |   21 +++++++-
 arch/arm/boot/dts/da850.dtsi                       |   17 +++++-
 drivers/gpio/gpio-davinci.c                        |   57 ++++++++++++++++++--
 5 files changed, 123 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-davinci.txt
Signature · 6 lines
1.7.9.5

_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source at linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
#10 lore raw

Hi Sekhar,

Quoted 7 lines · Avinash
Quoted 6 lines · Avinash

With conversion of GPIO davinci driver to platform driver, gpio-davinci driver can support DT boot.
This patch series
- adds dt binding support for gpio-davinci.
- da850 dt support goio.

Quoted 9 lines
Quoted 3 lines

This patch series is based on Linux 3.10-rc4 and is availabel at [1].

1. https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4

This patch series has dependency on [PATCH v2 0/7] Convert GPIO Davinci to platform driver

https://lkml.org/lkml/2013/6/14/120

What is the status of this patch series is any one taking care of it or else I can take care of review comments and repost them.

Regards,
--Prabhakar Lad

#11 lore raw

Hi Prabhakar,

Quoted 15 lines · Prabhakar Lad

Hi Sekhar,

Quoted 12 lines · Avinash
Quoted 9 lines · Avinash

With conversion of GPIO davinci driver to platform driver, gpio-davinci driver can support DT boot.
This patch series
- adds dt binding support for gpio-davinci.
- da850 dt support goio.

This patch series is based on Linux 3.10-rc4 and is availabel at [1].

1. https://github.com/avinashphilip/am335x_linux/tree/linux_davinci_v3.10_soc_gpio_v310-rc4

Quoted 6 lines
Quoted 4 lines

This patch series has dependency on [PATCH v2 0/7] Convert GPIO Davinci to platform driver

https://lkml.org/lkml/2013/6/14/120

What is the status of this patch series is any one taking care of it or else I can take care of review comments and repost them.

Avinash is not working for TI anymore. It will be great if you can take this up.

Thanks,
Sekhar