gpio: Add a driver for Cadence GPIO controller
Subsystems (2)
v3 cover gpio: Add a driver for Cadence GPIO controller
This patchset adds a driver support for Cadence GPIO controller.
Number of supported lines is configurable. The driver initializes all pins as inputs in probe(). Currently it only supports level-sensitive interrupts.
The interrupts controller was tested with I2C and SPI IPs acting as interrupt sources.
Changes since V2:
Added spinlocks in request, free and irq_set_type functions.
Changes since V1:
Switched to generic GPIO infrastructure. Redesigned interrupts, now uses chained irqchip. Drop support for edge-sensitive interrupts. Restore bypass settings at unexport/remove.
Jan Kotas (2):
dt-bindings: gpio: Add bindings for Cadence GPIO
gpio: Add Cadence GPIO driver
.../devicetree/bindings/gpio/cdns,gpio.txt | 44 ++++ drivers/gpio/Kconfig | 8 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-cadence.c | 291 +++++++++++++++++++++ 4 files changed, 344 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/cdns,gpio.txt create mode 100644 drivers/gpio/gpio-cadence.c
Signature · 1 line
2.15.0
PATCH v3 1/2 dt-bindings: gpio: Add bindings for Cadence GPIO
This patch adds a DT binding documentation for
Cadence GPIO controller.
--- .../devicetree/bindings/gpio/cdns,gpio.txt | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/cdns,gpio.txt
Documentation/devicetree/bindings/gpio/cdns,gpio.txt new file +44 -0
@@ -0,0 +1,44 @@ +Cadence GPIO controller bindings + +Required properties: +- compatible: should be "cdns,gpio-r1p02". +- reg: the register base address and size. +- #gpio-cells: should be 2. + * first cell is the GPIO number. + * second cell specifies the GPIO flags, as defined in + <dt-bindings/gpio/gpio.h>. Only the GPIO_ACTIVE_HIGH + and GPIO_ACTIVE_LOW flags are supported. +- gpio-controller: marks the device as a GPIO controller. +- clocks: should contain one entry referencing the peripheral clock driving + the GPIO controller. + +Optional properties: +- ngpios: integer number of gpio lines supported by this controller, up to 32. +- interrupt-parent: phandle of the parent interrupt controller. +- interrupts: interrupt specifier for the controllers interrupt. +- interrupt-controller: marks the device as an interrupt controller. When + defined, interrupts, interrupt-parent and #interrupt-cells + are required. +- interrupt-cells: should be 2. + * first cell is the GPIO number you want to use as an IRQ source. + * second cell specifies the IRQ type, as defined in + <dt-bindings/interrupt-controller/irq.h>. + Currently only level sensitive IRQs are supported. + + +Example: + gpio0: gpio-controller@fd060000 { + compatible = "cdns,gpio-r1p02"; + reg =<0xfd060000 0x1000>; + + clocks = <&gpio_clk>; + + interrupt-parent = <&gic>; + interrupts = <0 5 IRQ_TYPE_LEVEL_HIGH>; + + gpio-controller; + #gpio-cells = <2>; + + interrupt-controller; + #interrupt-cells = <2>; + };
Signature · 1 line
2.15.0
PATCH v3 2/2 gpio: Add Cadence GPIO driver
In reply to Jan KotasThis patch adds a driver for Cadence GPIO controller.
It can be enabled with GPIO_CADENCE Kconfig option. It uses generic GPIO infrastructure and works as an interrupt controller.
At the moment it only supports level sensitive irqs.
--- drivers/gpio/Kconfig | 8 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-cadence.c | 291 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 300 insertions(+) create mode 100644 drivers/gpio/gpio-cadence.c
drivers/gpio/Kconfig +8 -0
@@ -160,6 +160,14 @@ config GPIO_BRCMSTB help Say yes here to enable GPIO support for Broadcom STB (BCM7XXX) SoCs. +config GPIO_CADENCE + tristate "Cadence GPIO support" + depends on OF_GPIO + select GPIO_GENERIC + select GPIOLIB_IRQCHIP + help + Say yes here to enable support for Cadence GPIO controller. + config GPIO_CLPS711X tristate "CLPS711X GPIO support" depends on ARCH_CLPS711X || COMPILE_TEST
drivers/gpio/Makefile +1 -0
@@ -37,6 +37,7 @@ obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o obj-$(CONFIG_GPIO_BD9571MWV) += gpio-bd9571mwv.o obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o +obj-$(CONFIG_GPIO_CADENCE) += gpio-cadence.o obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o obj-$(CONFIG_GPIO_CRYSTAL_COVE) += gpio-crystalcove.o
drivers/gpio/gpio-cadence.c new file +291 -0
291 lines not on this page · raw message
Signature · 1 line
2.15.0
Re: [PATCH v3 1/2] dt-bindings: gpio: Add bindings for Cadence GPIO
In reply to Jan KotasQuoted 4 lines · Jan Kotas
This patch adds a DT binding documentation for
Cadence GPIO controller.Signed-off-by Jan Kotas <[email protected]>
Patch applied stripping interrupt-parent as requested by Rob and applied his ACK from v2 (assume it's the same patch +/-).
Yours,
Linus Walleij
Re: [PATCH v3 2/2] gpio: Add Cadence GPIO driver
In reply to Jan KotasQuoted 8 lines · Jan Kotas
This patch adds a driver for Cadence GPIO controller.
It can be enabled with
GPIO_CADENCEKconfigoption. It uses generic GPIO infrastructure and works as an interrupt controller.
At the moment it only supports level sensitive irqs.Signed-off-by Jan Kotas <[email protected]>
Pulled out the v2 and applied this v3 instead.
Yours,
Linus Walleij