Skip to contentSkip to conversation

Add ZTE ZX pinctrl driver support

PATCH New Shawn Guo 3 participants 6 messages Apr 24, 2017 – May 11, 2017

Subsystems (3)
lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

cover Add ZTE ZX pinctrl driver support

From: Shawn Guo <[email protected]>

This is basically a rewrite of Jun's ZTE ZX pinctrl driver. It has quite a few significant changes from Jun's version.

- It handles the relation between main and auxiliary controllers internally, and then we do not need to export core function pin_request().
- Update bindings document with a ASCII figure to illustrate how this 'hybrid' pin controller hardware works.
- Rather than making up pin name with the fake port name and pin number, name the pins in the exactly same way how hardware manual name them.
- Instead of encoding AON register data, calculate the offset and bit position from pin id.
- Utilize the generic groups and functions support from core to save quite some code in our driver.
- Simplify the data structures and add documents for important ones.
- Clean up some unnecessary function calls.

Shawn

[1] https://www.spinics.net/lists/linux-gpio/msg16147.html

Shawn Guo (2):
dt-bindings: add bindings doc for ZTE pinctrl
pinctrl: add ZTE ZX pinctrl driver support

 .../devicetree/bindings/pinctrl/pinctrl-zx.txt     |   85 ++
 drivers/pinctrl/Kconfig                            |    1 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/zte/Kconfig                        |   13 +
 drivers/pinctrl/zte/Makefile                       |    2 +
 drivers/pinctrl/zte/pinctrl-zx.c                   |  445 +++++++++
 drivers/pinctrl/zte/pinctrl-zx.h                   |  105 ++
 drivers/pinctrl/zte/pinctrl-zx296718.c             | 1027 ++++++++++++++++++++
 8 files changed, 1679 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-zx.txt
 create mode 100644 drivers/pinctrl/zte/Kconfig
 create mode 100644 drivers/pinctrl/zte/Makefile
 create mode 100644 drivers/pinctrl/zte/pinctrl-zx.c
 create mode 100644 drivers/pinctrl/zte/pinctrl-zx.h
 create mode 100644 drivers/pinctrl/zte/pinctrl-zx296718.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/2 dt-bindings: add bindings doc for ZTE pinctrl

From: Shawn Guo <[email protected]>

It adds device tree bindings for ZTE pin controller found on ZX2967xx family SoCs.

---
 .../devicetree/bindings/pinctrl/pinctrl-zx.txt     | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-zx.txt
Documentation/devicetree/bindings/pinctrl/pinctrl-zx.txt new file +85 -0
new file mode 100644
index 000000000000..e219849b21ca
@@ -0,0 +1,85 @@
+* ZTE ZX Pin Controller
+
+The pin controller on ZTE ZX platforms is kinda of hybrid.  It consists of
+a main controller and an auxiliary one.  For example, on ZX296718 SoC, the
+main controller is TOP_PMM and the auxiliary one is AON_IOCFG.  Both
+controllers work together to control pin multiplexing and configuration in
+the way illustrated as below.
+
+
+           GMII_RXD3 ---+
+                        |
+             DVI1_HS ---+----------------------------- GMII_RXD3 (TOP pin)
+                        |
+             BGPIO16 ---+                               ^
+                                                        | pinconf
+                        ^                               |
+                        | pinmux                        |
+                        |                               |
+
+                   TOP_PMM (main)           AON_IOCFG (aux)
+
+                        |                       |       |
+                        |                pinmux |       |
+                        | pinmux                v       |
+                        v                               | pinconf
+                                    KEY_ROW2 ---+       v
+        PORT1_LCD_TE ---+                       |
+                        |            AGPIO10 ---+------ KEY_ROW2 (AON pin)
+          I2S0_DOUT3 ---+                       |
+                        |-----------------------+
+            PWM_OUT3 ---+
+                        |
+             VGA_VS1 ---+
+
+
+For most of pins like GMII_RXD3 in the figure, the pinmux function is
+controlled by TOP_PMM block only, and this type of pins are meant by term
+'TOP pins'.  For pins like KEY_ROW2, the pinmux is controlled by both
+TOP_PMM and AON_IOCFG blocks, as the available multiplexing functions for
+the pin spread in both controllers.  This type of pins are called 'AON pins'.
+Though pinmux implementation is quite different, pinconf is same for both
+types of pins.  Both are controlled by auxiliary controller, i.e. AON_IOCFG
+on ZX296718.
+
+Required properties:
+- compatible: should be "zte,zx296718-pmm".
+- reg: the register physical address and length.
+- zte,auxiliary-controller: phandle to the auxiliary pin controller which
+  implements pinmux for AON pins and pinconf for all pins.
+
+The following pin configuration are supported. Please refer to
+pinctrl-bindings.txt in this directory for more details of the common
+pinctrl bindings used by client devices.
+
+- bias-pull-up
+- bias-pull-down
+- drive-strength
+- input-enable
+- slew-rate
+
+Examples:
+
+iocfg: pin-controller at 119000 {
+	compatible = "zte,zx296718-iocfg";
+	reg = <0x119000 0x1000>;
+};
+
+pmm: pin-controller at 1462000 {
+	compatible = "zte,zx296718-pmm";
+	reg = <0x1462000 0x1000>;
+	zte,auxiliary-controller = <&iocfg>;
+};
+
+&pmm {
+	vga_pins: vga {
+		pins = "KEY_COL1", "KEY_COL2", "KEY_ROW1", "KEY_ROW2";
+		function = "VGA";
+	};
+};
+
+&vga {
+	pinctrl-names = "default";
+	pinctrl-0 = <&vga_pins>;
+	status = "okay";
+};
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 2/2 pinctrl: add ZTE ZX pinctrl driver support

In reply to Shawn Guo

From: Shawn Guo <[email protected]>

The pin controller on ZTE ZX platforms is kinda of hybrid. It consists of a main controller and an auxiliary one. For example, on ZX296718 SoC, the main controller is TOP_PMM and the auxiliary one is AON_IOCFG. Both controllers work together to control pin multiplexing and configuration.

For most of pins, the pinmux function is controlled by main controller only, and this type of pins are meant by term 'TOP pins'. For other pins, the pinmux is controlled by both main and auxiliary controllers, as the available multiplexing functions for the pin spread in both controllers. This type of pins are called 'AON pins'. Though pinmux implementation is quite different, pinconf is same for both types of pins. Both are controlled by auxiliary controller, i.e. AON_IOCFG on ZX296718.

The patch adds the ZTE ZX core pinctrl driver to support this hybrid pin controller as well as ZX296718 SoC specific pin data.

---
 drivers/pinctrl/Kconfig                |    1 +
 drivers/pinctrl/Makefile               |    1 +
 drivers/pinctrl/zte/Kconfig            |   13 +
 drivers/pinctrl/zte/Makefile           |    2 +
 drivers/pinctrl/zte/pinctrl-zx.c       |  445 ++++++++++++++
 drivers/pinctrl/zte/pinctrl-zx.h       |  105 ++++
 drivers/pinctrl/zte/pinctrl-zx296718.c | 1027 ++++++++++++++++++++++++++++++++
 7 files changed, 1594 insertions(+)
 create mode 100644 drivers/pinctrl/zte/Kconfig
 create mode 100644 drivers/pinctrl/zte/Makefile
 create mode 100644 drivers/pinctrl/zte/pinctrl-zx.c
 create mode 100644 drivers/pinctrl/zte/pinctrl-zx.h
 create mode 100644 drivers/pinctrl/zte/pinctrl-zx296718.c
drivers/pinctrl/Kconfig +1 -0
index 8f8c2af45781..97c202ba9a7a 100644
@@ -304,6 +304,7 @@ source "drivers/pinctrl/ti/Kconfig"
 source "drivers/pinctrl/uniphier/Kconfig"
 source "drivers/pinctrl/vt8500/Kconfig"
 source "drivers/pinctrl/mediatek/Kconfig"
+source "drivers/pinctrl/zte/Kconfig"
 
 config PINCTRL_XWAY
 	bool
drivers/pinctrl/Makefile +1 -0
index a251f439626f..dce8ff892b23 100644
@@ -57,3 +57,4 @@ obj-y				+= ti/
 obj-$(CONFIG_PINCTRL_UNIPHIER)	+= uniphier/
 obj-$(CONFIG_ARCH_VT8500)	+= vt8500/
 obj-$(CONFIG_PINCTRL_MTK)	+= mediatek/
+obj-$(CONFIG_PINCTRL_ZX)	+= zte/
drivers/pinctrl/zte/Kconfig new file +13 -0
new file mode 100644
index 000000000000..0d97352a24ec
@@ -0,0 +1,13 @@
+config PINCTRL_ZX
+	bool
+	select PINMUX
+	select GENERIC_PINCONF
+	select GENERIC_PINCTRL_GROUPS
+	select GENERIC_PINMUX_FUNCTIONS
+
+config PINCTRL_ZX296718
+	bool "ZTE ZX296718 pinctrl driver"
+	depends on OF && ARCH_ZX
+	select PINCTRL_ZX
+	help
+	  Say Y here to enable the ZX296718 pinctrl driver
drivers/pinctrl/zte/Makefile new file +2 -0
new file mode 100644
index 000000000000..c42e651d7a73
@@ -0,0 +1,2 @@
+obj-$(CONFIG_PINCTRL_ZX)	+= pinctrl-zx.o
+obj-$(CONFIG_PINCTRL_ZX296718)	+= pinctrl-zx296718.o
drivers/pinctrl/zte/pinctrl-zx.c new file +445 -0

445 lines not on this page · raw message

drivers/pinctrl/zte/pinctrl-zx.h new file +105 -0

105 lines not on this page · raw message

drivers/pinctrl/zte/pinctrl-zx296718.c new file +1027 -0

1,027 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#2 lore raw

PATCH 1/2 dt-bindings: add bindings doc for ZTE pinctrl

In reply to Shawn Guo
Quoted 10 lines · Shawn Guo

From: Shawn Guo <[email protected]>

It adds device tree bindings for ZTE pin controller found on ZX2967xx family SoCs.

---
 .../devicetree/bindings/pinctrl/pinctrl-zx.txt     | 85 ++++++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-zx.txt
#5 lore raw

PATCH 2/2 pinctrl: add ZTE ZX pinctrl driver support

In reply to Shawn Guo
Quoted 16 lines · Shawn Guo

From: Shawn Guo <[email protected]>

The pin controller on ZTE ZX platforms is kinda of hybrid. It consists of a main controller and an auxiliary one. For example, on ZX296718 SoC, the main controller is TOP_PMM and the auxiliary one is AON_IOCFG. Both controllers work together to control pin multiplexing and configuration.

For most of pins, the pinmux function is controlled by main controller only, and this type of pins are meant by term 'TOP pins'. For other pins, the pinmux is controlled by both main and auxiliary controllers, as the available multiplexing functions for the pin spread in both controllers. This type of pins are called 'AON pins'. Though pinmux implementation is quite different, pinconf is same for both types of pins. Both are controlled by auxiliary controller, i.e. AON_IOCFG on ZX296718.

Quoted 4 lines

The patch adds the ZTE ZX core pinctrl driver to support this hybrid pin controller as well as ZX296718 SoC specific pin data.

Excellent work as usual Shawn.
Patch applied for v4.13.

Yours,
Linus Walleij