Skip to contentSkip to conversation

gpio: Add device driver for GRGPIO cores

PATCH In review Andreas Larsson 2 participants 6 messages Apr 17, 2013 – Apr 26, 2013

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

v6 cover gpio: Add device driver for GRGPIO cores

Changes since v5:
- register accesses via base + constant
- no base irq number from device tree
- no empty irq-handler in patch 1
- change multi line comment style
- no talk of "virtual" irq or virq
- better description of the situation with irqs and underlying irqs
- add missing lock in irq-handler
- add warning printout in irq-handler if no gpio line matches irq

Andreas Larsson (2):
gpio: grgpio: Add device driver for GRGPIO cores
gpio: grgpio: Add irq support

 .../devicetree/bindings/gpio/gpio-grgpio.txt       |   26 +
 drivers/gpio/Kconfig                               |    9 +
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-grgpio.c                         |  505 ++++++++++++++++++++
 4 files changed, 541 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-grgpio.txt
 create mode 100644 drivers/gpio/gpio-grgpio.c
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v6 1/2 gpio: grgpio: Add device driver for GRGPIO cores

This driver supports GRGPIO gpio cores available in the GRLIB VHDL IP core library from Aeroflex Gaisler.

---

Changes since v5:
- register accesses via base + constant
- no base irq number from device tree
- no empty irq-handler

 .../devicetree/bindings/gpio/gpio-grgpio.txt       |   21 +++
 drivers/gpio/Kconfig                               |    9 ++
 drivers/gpio/Makefile                              |    1 +
 drivers/gpio/gpio-grgpio.c                         |  149 ++++++++++++++++++++
 4 files changed, 180 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-grgpio.txt
 create mode 100644 drivers/gpio/gpio-grgpio.c
Documentation/devicetree/bindings/gpio/gpio-grgpio.txt new file +21 -0
new file mode 100644
index 0000000..1ec46fd
@@ -0,0 +1,21 @@
+Aeroflex Gaisler GRGPIO General Purpose I/O cores.
+
+The GRGPIO GPIO core is available in the GRLIB VHDL IP core library.
+
+Note: In the ordinary environment for the GRGPIO core, a Leon SPARC system,
+these properties are built from information in the AMBA plug&play.
+
+Required properties:
+
+- name : Should be "GAISLER_GPIO" or "01_01a"
+
+- reg : Address and length of the register set for the device
+
+- interrupts : Interrupt numbers for this device
+
+Optional properties:
+
+- nbits : The number of gpio lines. If not present driver assumes 32 lines.
+
+For further information look in the documentation for the GLIB IP core library:
+http://www.gaisler.com/products/grlib/grip.pdf
drivers/gpio/Kconfig +9 -0
index 93aaadf..32f068d 100644
@@ -309,6 +309,15 @@ config GPIO_LYNXPOINT
 	  driver for GPIO functionality on Intel Lynxpoint PCH chipset
 	  Requires ACPI device enumeration code to set up a platform device.
 
+config GPIO_GRGPIO
+	tristate "Aeroflex Gaisler GRGPIO support"
+	depends on OF
+	select GPIO_GENERIC
+	select IRQ_DOMAIN
+	help
+	  Select this to support Aeroflex Gaisler GRGPIO cores from the GRLIB
+	  VHDL IP core library.
+
 comment "I2C GPIO expanders:"
 
 config GPIO_ARIZONA
drivers/gpio/Makefile +1 -0
index 22e07bc..3e6be51 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_ARCH_DAVINCI)	+= gpio-davinci.o
 obj-$(CONFIG_GPIO_EM)		+= gpio-em.o
 obj-$(CONFIG_GPIO_EP93XX)	+= gpio-ep93xx.o
 obj-$(CONFIG_GPIO_GE_FPGA)	+= gpio-ge.o
+obj-$(CONFIG_GPIO_GRGPIO)	+= gpio-grgpio.o
 obj-$(CONFIG_GPIO_ICH)		+= gpio-ich.o
 obj-$(CONFIG_GPIO_IT8761E)	+= gpio-it8761e.o
 obj-$(CONFIG_GPIO_JANZ_TTL)	+= gpio-janz-ttl.o
drivers/gpio/gpio-grgpio.c new file +149 -0

149 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v6 2/2 gpio: grgpio: Add irq support

In reply to Andreas Larsson

The drivers sets up an irq domain and hands out unique irqs to irq capable gpio lines regardless of how underlying irq maps to gpio lines. Any gpio line can map to any one or none of the irqs of the core, independently of each other.

---

Changes since v5:
- register accesses via base + constant
- change multi line comment style
- no talk of "virtual" irq or virq
- better description of the situation with irqs and underlying irqs
- add missing lock in irq-handler
- add warning printout in irq-handler if no gpio line matches irq

 .../devicetree/bindings/gpio/gpio-grgpio.txt       |    5 +
 drivers/gpio/gpio-grgpio.c                         |  362 +++++++++++++++++++-
 2 files changed, 364 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/gpio/gpio-grgpio.txt +5 -0
index 1ec46fd..e466598 100644
@@ -17,5 +17,10 @@ Optional properties:
 
 - nbits : The number of gpio lines. If not present driver assumes 32 lines.
 
+- irqmap : An array with an index for each gpio line. An index is either a valid
+	index into the interrupts property array, or 0xffffffff that indicates
+	no irq for that line. Driver provides no interrupt support if not
+	present.
+
 For further information look in the documentation for the GLIB IP core library:
 http://www.gaisler.com/products/grlib/grip.pdf
drivers/gpio/gpio-grgpio.c +359 -3

420 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#5 lore raw

Re: [PATCH v6 2/2] gpio: grgpio: Add irq support

In reply to Andreas Larsson
Quoted 6 lines · Andreas Larsson

The drivers sets up an irq domain and hands out unique irqs to irq capable gpio lines regardless of how underlying irq maps to gpio lines. Any gpio line can map to any one or none of the irqs of the core, independently of each other.

Patch applied, looking good, thanks!

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH v6 1/2] gpio: grgpio: Add device driver for GRGPIO cores

In reply to Linus Walleij
Quoted 7 lines · Linus Walleij
Quoted 4 lines · Andreas Larsson

This driver supports GRGPIO gpio cores available in the GRLIB VHDL IP core library from Aeroflex Gaisler.

Quoted 8 lines

Patch applied.

It's late in the merge cycle but this is a new driver and you have done a terrific job, so merging.

Yours,
Linus Walleij

Thanks! And thank you for all the feedback!

Cheers,
Andreas Larsson