Amlogic Meson pinctrl driver
Subsystems (6)
v3 cover Amlogic Meson pinctrl driver
Hi,
this is the third version of the pinctrl driver for Amlogic Meson. It provides a common infrastructure than can be used by all the SoCs of the family and configuration data specific for Meson8. Adding support for other SoCs should be only matter of defining new pins and banks.
The driver uses generic DT properties for the definition of mux and configuration nodes; since there is an ongoing effort to centralize the parsing to generic code, I've reused the patch "pinctrl:
pinconf-generic: Infer map type from DT property" [1] posted a few days ago by Soren Brinkmann. I will update the series if that patch is going to change after the mailing list discussion.
[1] https://lkml.org/lkml/2014/11/3/704
Changes since v2 [ https://lkml.org/lkml/2014/10/14/423 ]
- move modifications to mach-meson Kconfig to a separate patch
- use regmap_mmio
- use generic gpio xlate function
- don't hardcode gpio base number
- use gpiochip_add_pin_range()
- add kerneldoc documentation
- use plain module_platform_driver() instead of postcore_initcall
- avoid unneeded copies of platform data
Changes since v1 [ https://lkml.org/lkml/2014/10/7/712 ]
- added missing checks of return values
- indentation fixes
- added missing definitions of groups and functions for Meson8
Beniamino Galvani (3):
pinctrl: meson: add device tree bindings documentation
pinctrl: add driver for Amlogic Meson SoCs
ARM: meson: select PINCTRL_MESON and ARCH_REQUIRE_GPIOLIB
.../devicetree/bindings/pinctrl/meson,pinctrl.txt | 97 ++ arch/arm/mach-meson/Kconfig | 3 + drivers/pinctrl/Kconfig | 8 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/meson/Makefile | 2 + drivers/pinctrl/meson/pinctrl-meson.c | 761 ++++++++++++++ drivers/pinctrl/meson/pinctrl-meson.h | 209 ++++ drivers/pinctrl/meson/pinctrl-meson8.c | 1087 ++++++++++++++++++++ include/dt-bindings/gpio/meson8-gpio.h | 157 +++ 9 files changed, 2325 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt create mode 100644 drivers/pinctrl/meson/Makefile create mode 100644 drivers/pinctrl/meson/pinctrl-meson.c create mode 100644 drivers/pinctrl/meson/pinctrl-meson.h create mode 100644 drivers/pinctrl/meson/pinctrl-meson8.c create mode 100644 include/dt-bindings/gpio/meson8-gpio.h
Signature · 1 line
1.9.1
PATCH v3 1/3 pinctrl: meson: add device tree bindings documentation
Add device tree bindings documentation for Amlogic Meson pin and GPIO controller.
--- .../devicetree/bindings/pinctrl/meson,pinctrl.txt | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt
Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt new file +97 -0
@@ -0,0 +1,97 @@ +== Amlogic Meson pinmux controller == + +Required properties for the root node: + - compatible: "amlogic,meson8-pinctrl" + - reg: address and size of registers controlling irq functionality + +=== GPIO sub-nodes === + +The 2 power domains of the controller (regular and always-on) are +represented as sub-nodes and each of them acts as a GPIO controller. + +Required properties for sub-nodes are: + - reg: should contain address and size for mux, pull-enable, pull and + gpio register sets + - reg-names: an array of strings describing the "reg" entries. Must + contain "mux", "pull" and "gpio". "pull-enable" is optional and + when it is missing the "pull" registers are used instead + - gpio-controller: identifies the node as a gpio controller + - #gpio-cells: must be 2 + +Valid sub-node names are: + - "banks" for the regular domain + - "ao-bank" for the always-on domain + +=== Other sub-nodes === + +Child nodes without the "gpio-controller" represent some desired +configuration for a pin or a group. Those nodes can be pinmux nodes or +configuration nodes. + +Required properties for pinmux nodes are: + - groups: a list of pinmux groups. The list of all available groups + depends on the SoC and can be found in driver sources. + - function: the name of a function to activate for the specified set + of groups. The list of all available functions depends on the SoC + and can be found in driver sources. + +Required properties for configuration nodes: + - pins: a list of pin names + +Configuration nodes support the generic properties "bias-disable", +"bias-pull-up" and "bias-pull-down", described in file +pinctrl-bindings.txt + +=== Example === + + pinctrl: pinctrl at c1109880 { + compatible = "amlogic,meson8-pinctrl"; + reg = <0xc1109880 0x10>; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + gpio: banks at c11080b0 { + reg = <0xc11080b0 0x28>, + <0xc11080e8 0x18>, + <0xc1108120 0x18>, + <0xc1108030 0x30>; + reg-names = "mux", "pull", "pull-enable", "gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + + gpio_ao: ao-bank at c1108030 { + reg = <0xc8100014 0x4>, + <0xc810002c 0x4>, + <0xc8100024 0x8>; + reg-names = "mux", "pull", "gpio"; + gpio-controller; + #gpio-cells = <2>; + }; + + nand { + mux { + groups = "nand_io", "nand_io_ce0", "nand_io_ce1", + "nand_io_rb0", "nand_ale", "nand_cle", + "nand_wen_clk", "nand_ren_clk", "nand_dqs", + "nand_ce2", "nand_ce3"; + function = "nand"; + }; + }; + + uart_ao_a { + mux { + groups = "uart_tx_ao_a", "uart_rx_ao_a", + "uart_cts_ao_a", "uart_rts_ao_a"; + function = "uart_ao"; + }; + + conf { + pins = "GPIOAO_0", "GPIOAO_1", + "GPIOAO_2", "GPIOAO_3"; + bias-disable; + }; + }; + }; +
Signature · 1 line
1.9.1
PATCH v3 2/3 pinctrl: add driver for Amlogic Meson SoCs
In reply to Beniamino GalvaniThis is a driver for the pinmux and GPIO controller available in Amlogic Meson SoCs. At the moment it only supports Meson8 devices, however other SoC families like Meson6 and Meson8b (the Cortex-A5 variant) appear to be similar, with just different sets of banks and registers.
GPIO interrupts are not supported at the moment due to lack of documentation.
--- drivers/pinctrl/Kconfig | 8 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/meson/Makefile | 2 + drivers/pinctrl/meson/pinctrl-meson.c | 761 ++++++++++++++++++++++ drivers/pinctrl/meson/pinctrl-meson.h | 209 ++++++ drivers/pinctrl/meson/pinctrl-meson8.c | 1087 ++++++++++++++++++++++++++++++++ include/dt-bindings/gpio/meson8-gpio.h | 157 +++++ 7 files changed, 2225 insertions(+) create mode 100644 drivers/pinctrl/meson/Makefile create mode 100644 drivers/pinctrl/meson/pinctrl-meson.c create mode 100644 drivers/pinctrl/meson/pinctrl-meson.h create mode 100644 drivers/pinctrl/meson/pinctrl-meson8.c create mode 100644 include/dt-bindings/gpio/meson8-gpio.h
drivers/pinctrl/Kconfig +8 -0
@@ -96,6 +96,14 @@ config PINCTRL_FALCON depends on SOC_FALCON depends on PINCTRL_LANTIQ +config PINCTRL_MESON + bool + select PINMUX + select PINCONF + select GENERIC_PINCONF + select OF_GPIO + select REGMAP_MMIO + config PINCTRL_ROCKCHIP bool select PINMUX
drivers/pinctrl/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o +obj-$(CONFIG_PINCTRL_MESON) += meson/ obj-$(CONFIG_PINCTRL_PALMAS) += pinctrl-palmas.o obj-$(CONFIG_PINCTRL_ROCKCHIP) += pinctrl-rockchip.o obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
drivers/pinctrl/meson/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-y += pinctrl-meson8.o +obj-y += pinctrl-meson.o
drivers/pinctrl/meson/pinctrl-meson.c new file +761 -0
761 lines not on this page · raw message
drivers/pinctrl/meson/pinctrl-meson.h new file +209 -0
209 lines not on this page · raw message
drivers/pinctrl/meson/pinctrl-meson8.c new file +1087 -0
1,087 lines not on this page · raw message
include/dt-bindings/gpio/meson8-gpio.h new file +157 -0
157 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 3/3 ARM: meson: select PINCTRL_MESON and ARCH_REQUIRE_GPIOLIB
In reply to Beniamino GalvaniMake sure that the Meson pinctrl driver is built whenever Meson support is enabled.
--- arch/arm/mach-meson/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/arm/mach-meson/Kconfig +3 -0
@@ -1,7 +1,10 @@ menuconfig ARCH_MESON bool "Amlogic Meson SoCs" if ARCH_MULTI_V7 + select ARCH_REQUIRE_GPIOLIB select GENERIC_IRQ_CHIP select ARM_GIC + select PINCTRL + select PINCTRL_MESON if ARCH_MESON
Signature · 1 line
1.9.1
Hi Beniamino,
Quoted 7 lines · Beniamino Galvani
Hi,
this is the third version of the pinctrl driver for Amlogic Meson. It provides a common infrastructure than can be used by all the SoCs of the family and configuration data specific for Meson8. Adding support for other SoCs should be only matter of defining new pins and banks.
Quoted 6 lines
The driver uses generic DT properties for the definition of mux and configuration nodes; since there is an ongoing effort to centralize the parsing to generic code, I've reused the patch "pinctrl:
pinconf-generic: Infer map type from DT property" [1] posted a few days ago by Soren Brinkmann. I will update the series if that patch is going to change after the mailing list discussion.
Looks really nice to me and it's great that you use my patch as basis. Looks like it works for more people than just me :)
I hope we can convince Linus to take that patch more or less as is. Even though "kludgy" I don't see an easy way for addressing Linus' comments without breaking current users of the interface. It may be easier/better to gradually migrate to the newly defined bindings and remove the kludgyness as user that rely on the current behavior disappear.
Thanks,
S?ren
Re: [PATCH v3 1/3] pinctrl: meson: add device tree bindings documentation
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Add device tree bindings documentation for Amlogic Meson pin and GPIO controller.
Signed-off-by Beniamino Galvani <[email protected]>
This is exactly how I want modern pin controller bindings to look when combining groups and functions, so patch applied.
Now let me look at the driver!
Yours,
Linus Walleij
Re: [PATCH v3 2/3] pinctrl: add driver for Amlogic Meson SoCs
In reply to Beniamino GalvaniQuoted 10 lines · Beniamino Galvani
This is a driver for the pinmux and GPIO controller available in Amlogic Meson SoCs. At the moment it only supports Meson8 devices, however other SoC families like Meson6 and Meson8b (the Cortex-A5 variant) appear to be similar, with just different sets of banks and registers.
GPIO interrupts are not supported at the moment due to lack of documentation.
Signed-off-by Beniamino Galvani <[email protected]>
This is dependent on S?ren's patches I guess?
OK I'll merge this once we have that other code sorted out.
Yours,
Linus Walleij
Re: [PATCH v3 3/3] ARM: meson: select PINCTRL_MESON and ARCH_REQUIRE_GPIOLIB
In reply to Beniamino GalvaniQuoted 4 lines · Beniamino Galvani
Make sure that the Meson pinctrl driver is built whenever Meson support is enabled.
Signed-off-by Beniamino Galvani <[email protected]>
(Given we can merge the pinctrl driver)
Please merge this through the ARM SoC tree.
Yours,
Linus Walleij
Re: [PATCH v3 2/3] pinctrl: add driver for Amlogic Meson SoCs
In reply to Linus WalleijQuoted 8 lines · Linus Walleij
Quoted 6 lines · Beniamino Galvani
This is a driver for the pinmux and GPIO controller available in Amlogic Meson SoCs. At the moment it only supports Meson8 devices, however other SoC families like Meson6 and Meson8b (the Cortex-A5 variant) appear to be similar, with just different sets of banks and registers.
Quoted 8 lines
Quoted 4 lines
GPIO interrupts are not supported at the moment due to lack of documentation.
Signed-off-by Beniamino Galvani <[email protected]>This is dependent on S?ren's patches I guess?
OK I'll merge this once we have that other code sorted out.
Yes, this depends on Soren's patches.
Thanks,
Beniamino
Re: [PATCH v3 2/3] pinctrl: add driver for Amlogic Meson SoCs
Quoted 12 lines · Beniamino Galvani
Quoted 11 lines · Linus Walleij
Quoted 9 lines · Beniamino Galvani
This is a driver for the pinmux and GPIO controller available in Amlogic Meson SoCs. At the moment it only supports Meson8 devices, however other SoC families like Meson6 and Meson8b (the Cortex-A5 variant) appear to be similar, with just different sets of banks and registers.
GPIO interrupts are not supported at the moment due to lack of documentation.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Beniamino Galvani <[email protected]>This is dependent on S?ren's patches I guess?
OK I'll merge this once we have that other code sorted out.
Yes, this depends on Soren's patches.
Hi Beniamino,
sorry for the delay to merging S?ren's patches.
Can you rebase this patch on top of the pin control "devel" branch:
https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-pinctrl.git/log/?h=devel
Some stuff like structs and functions were renamed by me since it was not generic enough.
Yours,
Linus Walleij
Re: [PATCH v3 2/3] pinctrl: add driver for Amlogic Meson SoCs
Quoted 6 lines · Linus Walleij
Hi Beniamino,
sorry for the delay to merging S?ren's patches.
Can you rebase this patch on top of the pin control "devel" branch:
https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-pinctrl.git/log/?h=devel
I will rebase and submit the patch in the next days.
Thanks,
Beniamino