pinctrl: add a gpio and pinctrl driver for samsung io-pad controllers
Subsystems (2)
PATCH 1/1 pinctrl: add a gpio and pinctrl driver for samsung io-pad controllers
Add a combined gpio and pinctrl io-pad driver for Samsung platforms.
---
This driver supports gpio, pinctrl and pinmux functionality. At present, all the possible pin groups and pin functions have not been added. This driver is designed to be reusable across all Samsung SoC's and when this implemtation is complete, the gpio driver in driver/gpio for samsung platforms can be phased out. Features like GPIO interrupt support and pin-config support are yet to be added.
drivers/pinctrl/Kconfig | 6 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-samsung.c | 688 +++++++++++++++++++++++++++++++++++++ 3 files changed, 695 insertions(+), 0 deletions(-) create mode 100644 drivers/pinctrl/pinctrl-samsung.c
drivers/pinctrl/Kconfig +6 -0
@@ -30,6 +30,12 @@ config PINMUX_U300 depends on ARCH_U300 select PINMUX +config PINCTRL_SAMSUNG + bool "Samsung pinctrl driver" + default y + depends on PLAT_SAMSUNG + select PINMUX + endmenu endif
drivers/pinctrl/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_PINCTRL) += core.o obj-$(CONFIG_PINMUX) += pinmux.o obj-$(CONFIG_PINMUX_SIRF) += pinmux-sirf.o obj-$(CONFIG_PINMUX_U300) += pinmux-u300.o +obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o
drivers/pinctrl/pinctrl-samsung.c new file +688 -0
688 lines not on this page · raw message
Signature · 1 line
1.6.6.rc2
drivers/pinctrl/pinctrl-samsung.c line 137
Quoted 4 lines · Thomas Abraham
drivers/pinctrl/pinctrl-samsung.c new file +4
-0+/* Note: The pin group list needs to be further populated */ +static unsigned int exynos4210_spi0_pins[] = { +EXYNOS4_GPB (0 ),EXYNOS4_GPB (1 ),EXYNOS4_GPB (2 ),EXYNOS4_GPB (3 ), +};
Given the large number of SoCs in play here might it not be better to arrange things so that the data part can go in the SoC directory, or at least in a file separate to the main driver. Otherwise the file is going to get enormous but that's mostly going to be data tables.
Also, I'd expect these pin lists to include information on the function number.
Quoted 11 lines · Mark Brown
drivers/pinctrl/pinctrl-samsung.c line 137
Quoted 4 lines · Thomas Abraham
drivers/pinctrl/pinctrl-samsung.c new file +4
-0+/* Note: The pin group list needs to be further populated */ +static unsigned int exynos4210_spi0_pins[] = { + EXYNOS4_GPB(0), EXYNOS4_GPB(1), EXYNOS4_GPB(2), EXYNOS4_GPB(3), +};Given the large number of SoCs in play here might it not be better to arrange things so that the data part can go in the SoC directory, or at least in a file separate to the main driver. Otherwise the file is going to get enormous but that's mostly going to be data tables.
I share the same concern here and listed a todo in the driver file to handle this case. As you said, a separate file to hold this data would be needed until all the samsung platforms switch to using device tree.
Quoted 4 lines
Also, I'd expect these pin lists to include information on the function number.
Yes, the function number is included for all the pins. It is in 'struct samsung_pin_group' with the member name 'func'. The function number is expected to be same for all the pins in a group (atleast, that works for exynos4). If pins in a group need different function numbers, then I modify this.
Thank you Mark for having a look.
Regards,
Thomas.
Quoted 5 lines · Thomas Abraham
This driver supports gpio, pinctrl and pinmux functionality. At present, all the possible pin groups and pin functions have not been added. This driver is designed to be reusable across all Samsung SoC's and when this implemtation is complete, the gpio driver in driver/gpio for samsung platforms can be phased out. Features like GPIO interrupt support and pin-config support are yet to be added.
I would prefer if we have this driver on ice or in the drivers/staging/* hierarchy until it can completely replace the GPIO driver and the platform variant.
I am aware that you need more support from the pinctrl subsystem before you can do this, I'm working on the things I can provide...
Overall the driver looks good!
Pretty massive with three controller instances, but it looks all manageable.
Yours,
Linus Walleij