Skip to contentSkip to conversation

drivers/gpio: Altera soft IP GPIO driver

PATCH Superseded [email protected] 3 participants 4 messages Oct 24, 2013

Subsystems (3)

v3 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 drivers/gpio: Altera soft IP GPIO driver

From: Tien Hock Loh <[email protected]>

Add driver support for Altera GPIO soft IP, including interrupts and I/O. Tested on Altera CV SoC board using dipsw and LED using LED framework.

---
 .../devicetree/bindings/gpio/gpio-altera.txt       |  34 ++
 drivers/gpio/Kconfig                               |   7 +
 drivers/gpio/Makefile                              |   1 +
 drivers/gpio/gpio-altera.c                         | 395 +++++++++++++++++++++
 4 files changed, 437 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-altera.txt
 create mode 100644 drivers/gpio/gpio-altera.c
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +34 -0
new file mode 100644
index 0000000..641cec2
@@ -0,0 +1,34 @@
+Altera GPIO controller bindings
+
+Required properties:
+- compatible:
+  - "altr,pio-1.0"
+- reg: Physical base address and length of the controller's registers.
+- #gpio-cells : Should be 1
+  - first cell is the gpio offset number
+- gpio-controller : Marks the device node as a GPIO controller.
+- #interrupt-cells : Should be 1.
+- interrupts: Specify the interrupt.
+- interrupt-controller: Mark the device node as an interrupt controller
+  The first cell is the local interrupt offset number to the GPIO controller.
+
+Altera GPIO specific properties:
+- width: Width of the GPIO bank, range from 1-32
+- interrupt_trigger: Specifies the interrupt trigger type the GPIO hardware is
+  synthesized. This field is required if the Altera GPIO controller used has
+  IRQ enabled as the interrupt type is not software controlled, but hardware
+  synthesized.
+
+Example:
+
+gpio_altr: gpio_altr {
+    compatible = "altr,pio-1.0";
+    reg = <0xff200000 0x10>;
+    interrupts = <0 45 4>;
+    width = <32>;
+    interrupt_trigger = <0>;
+    #gpio-cells = <1>;
+    gpio-controller;
+    #interrupt-cells = <1>;
+    interrupt-controller;
+};
drivers/gpio/Kconfig +7 -0
index b6ed304..42ae827 100644
@@ -121,6 +121,13 @@ config GPIO_GENERIC_PLATFORM
 	help
 	  Say yes here to support basic platform_device memory-mapped GPIO controllers.
 
+config GPIO_ALTERA
+       tristate "Altera GPIO"
+       select IRQ_DOMAIN
+       depends on OF_GPIO
+       help
+         Say yes here to support the Altera PIO device.
+
 config GPIO_IT8761E
 	tristate "IT8761E GPIO support"
 	depends on X86  # unconditional access to IO space.
drivers/gpio/Makefile +1 -0
index 98e23eb..72e560e 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_GPIO_74X164)	+= gpio-74x164.o
 obj-$(CONFIG_GPIO_ADNP)		+= gpio-adnp.o
 obj-$(CONFIG_GPIO_ADP5520)	+= gpio-adp5520.o
 obj-$(CONFIG_GPIO_ADP5588)	+= gpio-adp5588.o
+obj-$(CONFIG_GPIO_ALTERA)  	+= gpio-altera.o
 obj-$(CONFIG_GPIO_AMD8111)	+= gpio-amd8111.o
 obj-$(CONFIG_GPIO_ARIZONA)	+= gpio-arizona.o
 obj-$(CONFIG_GPIO_BT8XX)	+= gpio-bt8xx.o
drivers/gpio/gpio-altera.c new file +395 -0

395 lines not on this page · raw message

Signature · 1 line
1.7.11.GIT
#1 lore raw
Quoted 21 lines · On Oct 23, 2013, at 9:44 PM, [email protected] wrote:

From: Tien Hock Loh <[email protected]>

Add driver support for Altera GPIO soft IP, including interrupts and I/O. Tested on Altera CV SoC board using dipsw and LED using LED framework.

---

.../devicetree/bindings/gpio/gpio-altera.txt       |  34 ++
drivers/gpio/Kconfig                               |   7 +
drivers/gpio/Makefile                              |   1 +
drivers/gpio/gpio-altera.c                         | 395 +++++++++++++++++++++
4 files changed, 437 insertions(+)

create mode 100644 Documentation/devicetree/bindings/gpio/gpio-altera.txt create mode 100644 drivers/gpio/gpio-altera.c

Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +0 -0
new file mode 100644
index 0000000..641cec2

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 5

Quoted 5 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +5 -0
@@ -0,0 +1,34 @@
+Altera GPIO controller bindings
+
+Required properties:
+- compatible:
+  - "altr,pio-1.0"

any reason not to be "altr,gpio-1.0"?

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

Quoted 11 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +11 -0
+- reg: Physical base address and length of the controller's registers.
+- #gpio-cells : Should be 1
+  - first cell is the gpio offset number
+- gpio-controller : Marks the device node as a GPIO controller.
+- #interrupt-cells : Should be 1.
+- interrupts: Specify the interrupt.
+- interrupt-controller: Mark the device node as an interrupt controller
+  The first cell is the local interrupt offset number to the GPIO controller.
+
+Altera GPIO specific properties:
+- width: Width of the GPIO bank, range from 1-32

This description isn't terrible helpful. I'm not at all sure what this means.

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +4 -0
+- interrupt_trigger: Specifies the interrupt trigger type the GPIO hardware is
+  synthesized. This field is required if the Altera GPIO controller used has
+  IRQ enabled as the interrupt type is not software controlled, but hardware
+  synthesized.

Any vendor specific properties should be vendor prefixed:

"altr,width"
"altr,interrupt_trigger"

I'd also recommend that "altr,width" be a bit more specific like "altr,gpio-bank-width"

Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +4 -0
+
+Example:
+
+gpio_altr: gpio_altr {

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 34

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +10 -0
+    compatible = "altr,pio-1.0";
+    reg = <0xff200000 0x10>;
+    interrupts = <0 45 4>;
+    width = <32>;
+    interrupt_trigger = <0>;
+    #gpio-cells = <1>;
+    gpio-controller;
+    #interrupt-cells = <1>;
+    interrupt-controller;
+};

- k

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
#2 lore raw
Quoted 18 lines · Kumar Gala
Quoted 15 lines · On Oct 23, 2013, at 9:44 PM, [email protected] wrote:

From: Tien Hock Loh <[email protected]>

Add driver support for Altera GPIO soft IP, including interrupts and I/O. Tested on Altera CV SoC board using dipsw and LED using LED framework.

---

.../devicetree/bindings/gpio/gpio-altera.txt       |  34 ++
drivers/gpio/Kconfig                               |   7 +
drivers/gpio/Makefile                              |   1 +
drivers/gpio/gpio-altera.c                         | 395 +++++++++++++++++++++
4 files changed, 437 insertions(+)

create mode 100644 Documentation/devicetree/bindings/gpio/gpio-altera.txt create mode 100644 drivers/gpio/gpio-altera.c

Quoted 13 lines

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 5

Quoted 11 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +5 -0
new file mode 100644
index 0000000..641cec2
@@ -0,0 +1,34 @@
+Altera GPIO controller bindings
+
+Required properties:
+- compatible:
+  - "altr,pio-1.0"

any reason not to be "altr,gpio-1.0"?

The compatible field was following the name of the component generated by the verilog generator, thus pio-1.0 instead of gpio-1.0. Does it need to be gpio?

Quoted 15 lines

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

Quoted 12 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +11 -0
+- reg: Physical base address and length of the controller's registers.
+- #gpio-cells : Should be 1
+  - first cell is the gpio offset number
+- gpio-controller : Marks the device node as a GPIO controller.
+- #interrupt-cells : Should be 1.
+- interrupts: Specify the interrupt.
+- interrupt-controller: Mark the device node as an interrupt controller
+  The first cell is the local interrupt offset number to the GPIO controller.
+
+Altera GPIO specific properties:
+- width: Width of the GPIO bank, range from 1-32

This description isn't terrible helpful. I'm not at all sure what this means.

The number of pins of the GPIO bank, I'll update the document

Quoted 11 lines

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +4 -0
+- interrupt_trigger: Specifies the interrupt trigger type the GPIO hardware is
+  synthesized. This field is required if the Altera GPIO controller used has
+  IRQ enabled as the interrupt type is not software controlled, but hardware
+  synthesized.

Any vendor specific properties should be vendor prefixed:

"altr,width"
"altr,interrupt_trigger"

I'd also recommend that "altr,width" be a bit more specific like "altr,gpio-bank-width"

OK, will do in patch v4. Thanks for the advice.

Quoted 22 lines
Quoted 5 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +4 -0
+
+Example:
+
+gpio_altr: gpio_altr {

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 34

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +10 -0
+    compatible = "altr,pio-1.0";
+    reg = <0xff200000 0x10>;
+    interrupts = <0 45 4>;
+    width = <32>;
+    interrupt_trigger = <0>;
+    #gpio-cells = <1>;
+    gpio-controller;
+    #interrupt-cells = <1>;
+    interrupt-controller;
+};

- k

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

#3 lore raw
Quoted 33 lines · Tien Hock Loh
Quoted 18 lines · Kumar Gala
Quoted 15 lines · On Oct 23, 2013, at 9:44 PM, [email protected] wrote:

From: Tien Hock Loh <[email protected]>

Add driver support for Altera GPIO soft IP, including interrupts and I/O. Tested on Altera CV SoC board using dipsw and LED using LED framework.

---

.../devicetree/bindings/gpio/gpio-altera.txt       |  34 ++
drivers/gpio/Kconfig                               |   7 +
drivers/gpio/Makefile                              |   1 +
drivers/gpio/gpio-altera.c                         | 395 +++++++++++++++++++++
4 files changed, 437 insertions(+)

create mode 100644 Documentation/devicetree/bindings/gpio/gpio-altera.txt create mode 100644 drivers/gpio/gpio-altera.c

Quoted 13 lines

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 5

Quoted 11 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +5 -0
new file mode 100644
index 0000000..641cec2
@@ -0,0 +1,34 @@
+Altera GPIO controller bindings
+
+Required properties:
+- compatible:
+  - "altr,pio-1.0"

any reason not to be "altr,gpio-1.0"?

Quoted 3 lines

The compatible field was following the name of the component generated by the verilog generator, thus pio-1.0 instead of gpio-1.0. Does it need to be gpio?

Its fine if its based on an auto generator.

Quoted 51 lines
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +5 -0
+- reg: Physical base address and length of the controller's registers.
+- #gpio-cells : Should be 1
+  - first cell is the gpio offset number
+- gpio-controller : Marks the device node as a GPIO controller.
+- #interrupt-cells : Should be 1.
Quoted 9 lines

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

Quoted 6 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +6 -0
+- interrupts: Specify the interrupt.
+- interrupt-controller: Mark the device node as an interrupt controller
+  The first cell is the local interrupt offset number to the GPIO controller.
+
+Altera GPIO specific properties:
+- width: Width of the GPIO bank, range from 1-32

This description isn't terrible helpful. I'm not at all sure what this means.

The number of pins of the GPIO bank, I'll update the document

Quoted 11 lines

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 20

Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +4 -0
+- interrupt_trigger: Specifies the interrupt trigger type the GPIO hardware is
+  synthesized. This field is required if the Altera GPIO controller used has
+  IRQ enabled as the interrupt type is not software controlled, but hardware
+  synthesized.

Any vendor specific properties should be vendor prefixed:

"altr,width"
"altr,interrupt_trigger"

I'd also recommend that "altr,width" be a bit more specific like "altr,gpio-bank-width"

OK, will do in patch v4. Thanks for the advice.

Quoted 22 lines
Quoted 5 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +4 -0
+
+Example:
+
+gpio_altr: gpio_altr {

Documentation/devicetree/bindings/gpio/gpio-altera.txt line 34

Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-altera.txt new file +10 -0
+    compatible = "altr,pio-1.0";
+    reg = <0xff200000 0x10>;
+    interrupts = <0 45 4>;
+    width = <32>;
+    interrupt_trigger = <0>;
+    #gpio-cells = <1>;
+    gpio-controller;
+    #interrupt-cells = <1>;
+    interrupt-controller;
+};

- k

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Signature · 2 lines
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation