Skip to contentSkip to conversation

pinctrl: Oxford Semiconductor OXNAS pinctrl and gpio support

PATCH In review Neil Armstrong 3 participants 8 messages May 11, 2016 – May 24, 2016

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

v2 cover pinctrl: Oxford Semiconductor OXNAS pinctrl and gpio support

This patchset includes support for the pinctrl and gpio controller of the Oxford Semiconductor OXNAS SoC Family.

Changes since v1 : http://lkml.kernel.org/r/1459689969-5326-1-git-send-email-narmstrong at baylibre.com
- Fix gpio bindings
- remove irqd_to_bank abstraction

It was originally posted part of a platform patchset available here :
http://lkml.kernel.org/r/1458838215-23314-1-git-send-email-narmstrong at baylibre.com

Changes since v3 global patchset :
- Get rid of PLX Technology, replace by Oxford Semiconductor
- Get rid of gpio-bank and ngpios properties, now using gpio-ranges

Neil Armstrong (2):
pinctrl: Add Oxford Semiconductor OXNAS pinctrl and gpio driver
dt-bindings: Add Oxford Semiconductor OXNAS pinctrl and gpio bindings

 .../devicetree/bindings/gpio/gpio_oxnas.txt        |  47 ++
 .../devicetree/bindings/pinctrl/oxnas,pinctrl.txt  |  57 ++
 drivers/pinctrl/Kconfig                            |  11 +
 drivers/pinctrl/Makefile                           |   1 +
 drivers/pinctrl/pinctrl-oxnas.c                    | 835 +++++++++++++++++++++
 5 files changed, 951 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio_oxnas.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/oxnas,pinctrl.txt
 create mode 100644 drivers/pinctrl/pinctrl-oxnas.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/2 pinctrl: Add Oxford Semiconductor OXNAS pinctrl and gpio driver

Add pinctrl and gpio control support to Oxford Semiconductor OXNAS SoC Family. This version supports the ARM926EJ-S based OX810SE SoC with 34 IO pins.

---
 drivers/pinctrl/Kconfig         |  11 +
 drivers/pinctrl/Makefile        |   1 +
 drivers/pinctrl/pinctrl-oxnas.c | 835 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 847 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-oxnas.c
drivers/pinctrl/Kconfig +11 -0
index fb8200b..f06589c 100644
@@ -129,6 +129,17 @@ config PINCTRL_MESON
 	select OF_GPIO
 	select REGMAP_MMIO
 
+config PINCTRL_OXNAS
+	bool
+	depends on OF
+	select PINMUX
+	select PINCONF
+	select GENERIC_PINCONF
+	select GPIOLIB
+	select OF_GPIO
+	select GPIOLIB_IRQCHIP
+	select MFD_SYSCON
+
 config PINCTRL_ROCKCHIP
 	bool
 	select PINMUX
drivers/pinctrl/Makefile +1 -0
index e4bc115..f678343 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_AMD)	+= pinctrl-amd.o
 obj-$(CONFIG_PINCTRL_DIGICOLOR)	+= pinctrl-digicolor.o
 obj-$(CONFIG_PINCTRL_FALCON)	+= pinctrl-falcon.o
 obj-$(CONFIG_PINCTRL_MESON)	+= meson/
+obj-$(CONFIG_PINCTRL_OXNAS)	+= pinctrl-oxnas.o
 obj-$(CONFIG_PINCTRL_PALMAS)	+= pinctrl-palmas.o
 obj-$(CONFIG_PINCTRL_PIC32)	+= pinctrl-pic32.o
 obj-$(CONFIG_PINCTRL_PISTACHIO)	+= pinctrl-pistachio.o
drivers/pinctrl/pinctrl-oxnas.c new file +835 -0

835 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH v2 2/2 dt-bindings: Add Oxford Semiconductor OXNAS pinctrl and gpio bindings

In reply to Neil Armstrong

Add pinctrl and gpio DT bindings for Oxford Semiconductor OXNAS SoC Family. This version supports the ARM926EJ-S based OX810SE SoC with 34 IO pins.

---
 .../devicetree/bindings/gpio/gpio_oxnas.txt        | 47 ++++++++++++++++++
 .../devicetree/bindings/pinctrl/oxnas,pinctrl.txt  | 57 ++++++++++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio_oxnas.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/oxnas,pinctrl.txt
Documentation/devicetree/bindings/gpio/gpio_oxnas.txt new file +47 -0
new file mode 100644
index 0000000..928ed4f
@@ -0,0 +1,47 @@
+* Oxford Semiconductor OXNAS SoC GPIO Controller
+
+Please refer to gpio.txt for generic information regarding GPIO bindings.
+
+Required properties:
+ - compatible: "oxsemi,ox810se-gpio"
+ - reg: Base address and length for the device.
+ - interrupts: The port interrupt shared by all pins.
+ - gpio-controller: Marks the port as GPIO controller.
+ - #gpio-cells: Two. The first cell is the pin number and
+   the second cell is used to specify the gpio polarity as defined in
+   defined in <dt-bindings/gpio/gpio.h>:
+      0 = GPIO_ACTIVE_HIGH
+      1 = GPIO_ACTIVE_LOW
+ - interrupt-controller: Marks the device node as an interrupt controller.
+ - #interrupt-cells: Two. The first cell is the GPIO number and second cell
+   is used to specify the trigger type as defined in
+   <dt-bindings/interrupt-controller/irq.h>:
+      IRQ_TYPE_EDGE_RISING
+      IRQ_TYPE_EDGE_FALLING
+      IRQ_TYPE_EDGE_BOTH
+ - gpio-ranges: Interaction with the PINCTRL subsystem, it also specifies the
+   gpio base and count, should be in the format of numeric-gpio-range as
+   specified in the gpio.txt file.
+
+Example:
+
+gpio0: gpio at 0 {
+	compatible = "oxsemi,ox810se-gpio";
+	reg = <0x000000 0x100000>;
+	interrupts = <21>;
+	#gpio-cells = <2>;
+	gpio-controller;
+	interrupt-controller;
+	#interrupt-cells = <2>;
+	gpio-ranges = <&pinctrl 0 0 32>;
+};
+
+keys {
+	...
+
+	button-esc {
+		label = "ESC";
+		linux,code = <1>;
+		gpios = <&gpio0 12 0>;
+	};
+};
Documentation/devicetree/bindings/pinctrl/oxnas,pinctrl.txt new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer Acked-by on v2 2/2
#6 lore raw

Re: [PATCH v2 2/2] dt-bindings: Add Oxford Semiconductor OXNAS pinctrl and gpio bindings

Quoted 10 lines · Neil Armstrong

Add pinctrl and gpio DT bindings for Oxford Semiconductor OXNAS SoC Family. This version supports the ARM926EJ-S based OX810SE SoC with 34 IO pins.

---
 .../devicetree/bindings/gpio/gpio_oxnas.txt        | 47 ++++++++++++++++++
 .../devicetree/bindings/pinctrl/oxnas,pinctrl.txt  | 57 ++++++++++++++++++++++
 2 files changed, 104 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio_oxnas.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/oxnas,pinctrl.txt
#2 lore raw

Re: [PATCH v2 1/2] pinctrl: Add Oxford Semiconductor OXNAS pinctrl and gpio driver

In reply to Neil Armstrong
Quoted 4 lines · Neil Armstrong

Add pinctrl and gpio control support to Oxford Semiconductor OXNAS SoC Family. This version supports the ARM926EJ-S based OX810SE SoC with 34 IO pins.

Patch applied for the next kernel cycle.
Looks clean and nice.

Yours,
Linus Walleij

#7 lore raw

Re: [PATCH v2 2/2] dt-bindings: Add Oxford Semiconductor OXNAS pinctrl and gpio bindings

In reply to Neil Armstrong
Quoted 4 lines · Neil Armstrong

Add pinctrl and gpio DT bindings for Oxford Semiconductor OXNAS SoC Family. This version supports the ARM926EJ-S based OX810SE SoC with 34 IO pins.

Patch applied with Rob's ACK.

Yours,
Linus Walleij

#3 lore raw

Re: [PATCH v2 1/2] pinctrl: Add Oxford Semiconductor OXNAS pinctrl and gpio driver

In reply to Neil Armstrong
Quoted 4 lines · Neil Armstrong

Add pinctrl and gpio control support to Oxford Semiconductor OXNAS SoC Family. This version supports the ARM926EJ-S based OX810SE SoC with 34 IO pins.

I tried implementing a .get_direction() callback for the Oxnas GPIO (this is good to have, for debugfs and for the new userspace ABI).

However:

drivers/pinctrl/pinctrl-oxnas.c line 58

Quoted 9 lines
drivers/pinctrl/pinctrl-oxnas.c new file +9 -0
+/* GPIO Registers */
+#define INPUT_VALUE    0x00
+#define IRQ_PENDING    0x0c
+#define OUTPUT_SET     0x14
+#define OUTPUT_CLEAR   0x18
+#define OUTPUT_EN_SET  0x1c
+#define OUTPUT_EN_CLEAR        0x20
+#define RE_IRQ_ENABLE  0x28
+#define FE_IRQ_ENABLE  0x2c

No pure OUTPUT_EN register to read the direction from? Or is it one of the undocumented ones?

Could you take a stab at implementing .get_direction() and send a patch?

Yours,
Linus Walleij

#4 lore raw

Re: [PATCH v2 1/2] pinctrl: Add Oxford Semiconductor OXNAS pinctrl and gpio driver

Quoted 12 lines · Linus Walleij
Quoted 4 lines · Neil Armstrong

Add pinctrl and gpio control support to Oxford Semiconductor OXNAS SoC Family. This version supports the ARM926EJ-S based OX810SE SoC with 34 IO pins.

I tried implementing a .get_direction() callback for the Oxnas GPIO (this is good to have, for debugfs and for the new userspace ABI).

However:

Quoted 12 lines

drivers/pinctrl/pinctrl-oxnas.c line 58

Quoted 9 lines
drivers/pinctrl/pinctrl-oxnas.c new file +9 -0
+/* GPIO Registers */
+#define INPUT_VALUE    0x00
+#define IRQ_PENDING    0x0c
+#define OUTPUT_SET     0x14
+#define OUTPUT_CLEAR   0x18
+#define OUTPUT_EN_SET  0x1c
+#define OUTPUT_EN_CLEAR        0x20
+#define RE_IRQ_ENABLE  0x28
+#define FE_IRQ_ENABLE  0x2c

No pure OUTPUT_EN register to read the direction from? Or is it one of the undocumented ones?

I'm not sure it was documented, I can have a look further.

Quoted 3 lines

Could you take a stab at implementing .get_direction() and send a patch?

I can have a look ASAP.

Neil

Quoted 4 lines

Yours,
Linus Walleij