mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 05:04:00 +08:00
9caf1f2202
Add a GPIO driver for the main GPIOs found in the TZ1090 (Comet) SoC. This doesn't include low-power GPIOs as they're controlled separately via the Powerdown Controller (PDC) registers. The driver is instantiated by device tree and supports interrupts for all GPIOs. Changes in v4: - fix typos in DT bindings compatible properties - reference Documentation/devicetree/bindings/gpio/gpio.txt in gpio-ranges description in DT bindings - fix gpio-ranges examples in DT bindings (it must now have 3 cells) - gpio-tz1090: use of_property_read_u32 instead of of_get_property Changes in v3: - separated from irq-imgpdc and removed arch/metag changes to allow these patches to go upstream separately via the pinctrl[/gpio] trees (particularly the pinctrl drivers depend on the new pinconf DT bindings). - some s/unsigned/unsigned int/. - some s/unsigned int/bool/ and use of BIT(). - gpio-tz1090*: refer to <dt-bindings/gpio/gpio.h> and <dt-bindings/interrupt-controller/irq.h> flags in bindings. - gpio-tz1090*: move initcall from postcore to subsys. - gpio-tz1090: add REG_ prefix to some constants for consistency. - gpio-tz1090: add comment to explain tz1090_gpio_irq_next_edge cunningness. Changes in v2: - gpio-tz1090: remove references to Linux flags in dt bindings - gpio-tz1090: make use of BIT() from linux/bitops.h - gpio-tz1090: make register accessors inline to match pinctrl - gpio-tz1090: update gpio-ranges to use 3 cells after recent ABI breakage Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Grant Likely <grant.likely@linaro.org> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Rob Landley <rob@landley.net> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: linux-doc@vger.kernel.org Cc: devicetree-discuss@lists.ozlabs.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
89 lines
2.4 KiB
Plaintext
89 lines
2.4 KiB
Plaintext
ImgTec TZ1090 GPIO Controller
|
|
|
|
Required properties:
|
|
- compatible: Compatible property value should be "img,tz1090-gpio".
|
|
|
|
- reg: Physical base address of the controller and length of memory mapped
|
|
region.
|
|
|
|
- #address-cells: Should be 1 (for bank subnodes)
|
|
|
|
- #size-cells: Should be 0 (for bank subnodes)
|
|
|
|
- Each bank of GPIOs should have a subnode to represent it.
|
|
|
|
Bank subnode required properties:
|
|
- reg: Index of bank in the range 0 to 2.
|
|
|
|
- gpio-controller: Specifies that the node is a gpio controller.
|
|
|
|
- #gpio-cells: Should be 2. The syntax of the gpio specifier used by client
|
|
nodes should have the following values.
|
|
<[phandle of the gpio controller node]
|
|
[gpio number within the gpio bank]
|
|
[gpio flags]>
|
|
|
|
Values for gpio specifier:
|
|
- GPIO number: a value in the range 0 to 29.
|
|
- GPIO flags: bit field of flags, as defined in <dt-bindings/gpio/gpio.h>.
|
|
Only the following flags are supported:
|
|
GPIO_ACTIVE_HIGH
|
|
GPIO_ACTIVE_LOW
|
|
|
|
Bank subnode optional properties:
|
|
- gpio-ranges: Mapping to pin controller pins (as described in
|
|
Documentation/devicetree/bindings/gpio/gpio.txt)
|
|
|
|
- interrupts: Interrupt for the entire bank
|
|
|
|
- interrupt-controller: Specifies that the node is an interrupt controller
|
|
|
|
- #interrupt-cells: Should be 2. The syntax of the interrupt specifier used by
|
|
client nodes should have the following values.
|
|
<[phandle of the interurupt controller]
|
|
[gpio number within the gpio bank]
|
|
[irq flags]>
|
|
|
|
Values for irq specifier:
|
|
- GPIO number: a value in the range 0 to 29
|
|
- IRQ flags: value to describe edge and level triggering, as defined in
|
|
<dt-bindings/interrupt-controller/irq.h>. Only the following flags are
|
|
supported:
|
|
IRQ_TYPE_EDGE_RISING
|
|
IRQ_TYPE_EDGE_FALLING
|
|
IRQ_TYPE_EDGE_BOTH
|
|
IRQ_TYPE_LEVEL_HIGH
|
|
IRQ_TYPE_LEVEL_LOW
|
|
|
|
|
|
|
|
Example:
|
|
|
|
gpios: gpio-controller@02005800 {
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
compatible = "img,tz1090-gpio";
|
|
reg = <0x02005800 0x90>;
|
|
|
|
/* bank 0 with an interrupt */
|
|
gpios0: bank@0 {
|
|
#gpio-cells = <2>;
|
|
#interrupt-cells = <2>;
|
|
reg = <0>;
|
|
interrupts = <13 IRQ_TYPE_LEVEL_HIGH>;
|
|
gpio-controller;
|
|
gpio-ranges = <&pinctrl 0 0 30>;
|
|
interrupt-controller;
|
|
};
|
|
|
|
/* bank 2 without interrupt */
|
|
gpios2: bank@2 {
|
|
#gpio-cells = <2>;
|
|
reg = <2>;
|
|
gpio-controller;
|
|
gpio-ranges = <&pinctrl 0 60 30>;
|
|
};
|
|
};
|
|
|
|
|