From 7779b34556978f6771a78bd87557523623e0405b Mon Sep 17 00:00:00 2001 From: Jamie Iles Date: Tue, 25 Feb 2014 17:01:01 -0600 Subject: gpio: add a driver for the Synopsys DesignWare APB GPIO block The Synopsys DesignWare block is used in some ARM devices (picoxcell) and can be configured to provide multiple banks of GPIO pins. v12: - Add irq_startup/shutdown - do irq_create_mapping() in probe, irq_find_mapping() in to_irq() - Adjust mappings to show support for 1 gpio per port. - gpio-cells = <1> v11: - Use NULL when checking existence of 'interrupts' property - Bindings descriptions cleanup v10: - in documentation nr-gpio -> nr-gpios v9: - cleanup in dt bindings doc - use of_get_child_count() v8: - remove socfpga.dtsi changes - minor cleanup in devicetree documentation v7: - use irq_generic_chip - support one irq per gpio line or one irq for many - s/bank/port/ and other cleanup v6: - (atull) squash the set of patches - use linear irq domain - build fixes. Original driver was reviewed on v3.2. - Fix setting irq edge type for 'rising' and 'both'. - Support as a loadable module. - Use bgpio_chip's spinlock during register access. - Clean up register names to match spec - s/bank/port/ because register names use the word 'port' - s/nr-gpio/nr-gpios/ - don't get/put the of_node - remove signoffs/acked-by's because of changes - other cleanup v5: - handle sparse bank population correctly v3: - depend on rather than select IRQ_DOMAIN - split IRQ support into a separate patch v2: - use Rob Herring's irqdomain in generic irq chip patches - use reg property to indicate bank index - support irqs on both edges based on LinusW's u300 driver Signed-off-by: Jamie Iles Signed-off-by: Alan Tull Reviewed-by: Sebastian Hesselbarth Signed-off-by: Linus Walleij --- .../devicetree/bindings/gpio/snps-dwapb-gpio.txt | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt (limited to 'Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt') diff --git a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt new file mode 100644 index 000000000000..093495018c1b --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt @@ -0,0 +1,57 @@ +* Synopsys DesignWare APB GPIO controller + +Required properties: +- compatible : Should contain "snps,dw-apb-gpio" +- reg : Address and length of the register set for the device. +- #address-cells : should be 1 (for addressing port subnodes). +- #size-cells : should be 0 (port subnodes). + +The GPIO controller has a configurable number of ports, each of which are +represented as child nodes with the following properties: + +Required properties: +- compatible : "snps,dw-apb-gpio-port" +- gpio-controller : Marks the device node as a gpio controller. +- #gpio-cells : Should be 1. It is the pin number. +- reg : The integer port index of the port, a single cell. + +Optional properties: +- interrupt-controller : The first port may be configured to be an interrupt +controller. +- #interrupt-cells : Specifies the number of cells needed to encode an + interrupt. Shall be set to 2. The first cell defines the interrupt number, + the second encodes the triger flags encoded as described in + Documentation/devicetree/bindings/interrupts.txt +- interrupt-parent : The parent interrupt controller. +- interrupts : The interrupt to the parent controller raised when GPIOs + generate the interrupts. +- snps,nr-gpios : The number of pins in the port, a single cell. + +Example: + +gpio: gpio@20000 { + compatible = "snps,dw-apb-gpio"; + reg = <0x20000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + porta: gpio-controller@0 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <1>; + snps,nr-gpios = <8>; + reg = <0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&vic1>; + interrupts = <0>; + }; + + portb: gpio-controller@1 { + compatible = "snps,dw-apb-gpio-port"; + gpio-controller; + #gpio-cells = <1>; + snps,nr-gpios = <8>; + reg = <1>; + }; +}; -- cgit v1.2.1 From 1d4a2166f9501fd5b564b33414a2aa9c493fdfb8 Mon Sep 17 00:00:00 2001 From: Alan Tull Date: Fri, 14 Mar 2014 11:08:54 -0500 Subject: gpio: gpio-dwapb size-cells should be two Fix size-cells to show use of OF_GPIO_ACTIVE_LOW flag. Signed-off-by: Alan Tull Signed-off-by: Linus Walleij --- Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt') diff --git a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt index 093495018c1b..91cc90c6cf67 100644 --- a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt +++ b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt @@ -12,7 +12,10 @@ represented as child nodes with the following properties: Required properties: - compatible : "snps,dw-apb-gpio-port" - gpio-controller : Marks the device node as a gpio controller. -- #gpio-cells : Should be 1. It is the pin number. +- #gpio-cells : Should be two. The first cell is the pin number and + the second cell is used to specify the gpio polarity: + 0 = active high + 1 = active low - reg : The integer port index of the port, a single cell. Optional properties: -- cgit v1.2.1 From a54aef5072325ad3e5bd3e7c2858ae208fb4454d Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Sat, 22 Mar 2014 17:16:39 +0100 Subject: gpio: dwapb: correct gpio-cells in binding document The example uses gpio-cells = 1 while it should be two (it is even mentioned in the text above). Cc: devicetree@vger.kernel.org Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Linus Walleij --- Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt') diff --git a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt index 91cc90c6cf67..dd5d2c0394b1 100644 --- a/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt +++ b/Documentation/devicetree/bindings/gpio/snps-dwapb-gpio.txt @@ -41,7 +41,7 @@ gpio: gpio@20000 { porta: gpio-controller@0 { compatible = "snps,dw-apb-gpio-port"; gpio-controller; - #gpio-cells = <1>; + #gpio-cells = <2>; snps,nr-gpios = <8>; reg = <0>; interrupt-controller; @@ -53,7 +53,7 @@ gpio: gpio@20000 { portb: gpio-controller@1 { compatible = "snps,dw-apb-gpio-port"; gpio-controller; - #gpio-cells = <1>; + #gpio-cells = <2>; snps,nr-gpios = <8>; reg = <1>; }; -- cgit v1.2.1