pinctrl: sunxi: Rework and cleanups
cover pinctrl: sunxi: Rework and cleanups
Hi,
This patchset does some rework and clean up on the Allwinner pinctrl driver.
The most noticable thing is that we split the huge header containing the pins into smaller independant drivers.
That brings two important things: now, you don't have the structures redefined as much time as there's an include of the header, which is not that great, and you can select each drivers independently, reducing the global size if you're interested only in a single SoC.
Maxime
Maxime Ripard (15):
pinctrl: sunxi: Add const qualifier to the pin descriptor
pinctrl: sunxi: Drop unused structure members
pinctrl: sunxi: Move the Allwinner pinctrl driver to its own directory
pinctrl: sunxi: Replace hardcoded pin defines by a macro
pinctrl: sunxi: Switch to devm_ioremap_resource
pinctrl: sunxi: Libraryse the driver
pinctrl: sunxi: Move Allwinner A10 pinctrl driver to a driver of its
own
pinctrl: sunxi: Move Allwinner A10s pinctrl driver to a driver of its
own
pinctrl: sunxi: Move Allwinner A13 pinctrl driver to a driver of its
own
pinctrl: sunxi: Move Allwinner A31 pinctrl driver to a driver of its
own
pinctrl: sunxi: Move Allwinner A31 special pins driver to a driver of
its own
pinctrl: sunxi: Move Allwinner A20 pinctrl driver to a driver of its
own
pinctrl: sunxi: Introduce per-driver Kconfig options
pinctrl: sunxi: Move the reset handling functions out of the core
ARM: sunxi: Update pinctrl Kconfig options
arch/arm/mach-sunxi/Kconfig | 7 +- drivers/pinctrl/Kconfig | 6 +- drivers/pinctrl/Makefile | 2 +- drivers/pinctrl/pinctrl-sunxi-pins.h | 3937 --------------------------- drivers/pinctrl/pinctrl-sunxi.c | 953 ------- drivers/pinctrl/pinctrl-sunxi.h | 617 ----- drivers/pinctrl/sunxi/Kconfig | 32 + drivers/pinctrl/sunxi/Makefile | 10 + drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1039 +++++++ drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c | 690 +++++ drivers/pinctrl/sunxi/pinctrl-sun5i-a13.c | 411 +++ drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c | 141 + drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 884 ++++++ drivers/pinctrl/sunxi/pinctrl-sun7i-a20.c | 1065 ++++++++ drivers/pinctrl/sunxi/pinctrl-sunxi.c | 913 +++++++ drivers/pinctrl/sunxi/pinctrl-sunxi.h | 258 ++ 16 files changed, 5451 insertions(+), 5514 deletions(-) delete mode 100644 drivers/pinctrl/pinctrl-sunxi-pins.h delete mode 100644 drivers/pinctrl/pinctrl-sunxi.c delete mode 100644 drivers/pinctrl/pinctrl-sunxi.h create mode 100644 drivers/pinctrl/sunxi/Kconfig create mode 100644 drivers/pinctrl/sunxi/Makefile create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun5i-a13.c create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun7i-a20.c create mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi.c create mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi.h
Signature · 1 line
1.9.1
PATCH 1/15 pinctrl: sunxi: Add const qualifier to the pin descriptor
The pins description structure were declared as const, but the of_device_id data magic was losing it silently.
Make sure we have it on both sides.
--- drivers/pinctrl/pinctrl-sunxi.c | 2 +- drivers/pinctrl/pinctrl-sunxi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-sunxi.c +1 -1
@@ -812,7 +812,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)if (!device)return -ENODEV ; - pctl->desc = (struct sunxi_pinctrl_desc *)device->data; + pctl->desc = (const struct sunxi_pinctrl_desc *)device->data; ret =sunxi_pinctrl_build_state (pdev);if (ret) {
drivers/pinctrl/pinctrl-sunxi.h +1 -1
@@ -468,7 +468,7 @@ struct sunxi_pinctrl_group {struct sunxi_pinctrl {void __iomem *membase;struct gpio_chip *chip; -struct sunxi_pinctrl_desc *desc; +const struct sunxi_pinctrl_desc *desc;struct device *dev;struct irq_domain *domain;struct sunxi_pinctrl_function *functions;
Signature · 1 line
1.9.1
PATCH 1/15 pinctrl: sunxi: Add const qualifier to the pin descriptor
Dear Maxime Ripard,
drivers/pinctrl/pinctrl-sunxi.c static int sunxi_pinctrl_probe(struct platform_device *pdev) · line 815
Quoted 2 lines · Maxime Ripard
drivers/pinctrl/pinctrl-sunxi.c +1
-1- pctl->desc = (struct sunxi_pinctrl_desc *)device->data; + pctl->desc = (const struct sunxi_pinctrl_desc *)device->data;
I believe you no longer need the cast here. You used to need a cast because you were putting a 'const void *' pointer into a non-const pointer. Now that pctl->desc is const, the cast has become useless, I believe.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 2/15 pinctrl: sunxi: Drop unused structure members
In reply to Maxime RipardThe ranges and nranges were never used. Remove them.
--- drivers/pinctrl/pinctrl-sunxi.h | 2 -- 1 file changed, 2 deletions(-)
drivers/pinctrl/pinctrl-sunxi.h +0 -2
@@ -448,8 +448,6 @@ struct sunxi_desc_pin {struct sunxi_pinctrl_desc {const struct sunxi_desc_pin *pins;int npins; -struct pinctrl_gpio_range *ranges; -int nranges;unsigned pin_base; };
Signature · 1 line
1.9.1
PATCH 5/15 pinctrl: sunxi: Switch to devm_ioremap_resource
In reply to Maxime RipardThe previous code was calling of_iomap, which doesn't do any resource management, and doesn't call request_mem_region either. Use devm_ioremap_resource that do both.
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +5 -3
@@ -794,6 +794,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)struct pinctrl_pin_desc *pins;struct sunxi_pinctrl *pctl;struct reset_control *rstc; +struct resource *res;int i, ret, last_pin;struct clk *clk;
@@ -804,9 +805,10 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)spin_lock_init (&pctl->lock); - pctl->membase =of_iomap (node,0 ); -if (!pctl->membase) -return -ENOMEM ; + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + pctl->membase =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (pctl->membase)) +return PTR_ERR (pctl->membase); device =of_match_device (sunxi_pinctrl_match, &pdev->dev);if (!device)
Signature · 1 line
1.9.1
PATCH 6/15 pinctrl: sunxi: Libraryse the driver
In reply to Maxime RipardThis will allow to have multiple drivers using the same core code, and eventually, retire pinctrl-sunxi-pins.h
--- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 22 +++++++++++++++------- drivers/pinctrl/sunxi/pinctrl-sunxi.h | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sunxi.c +15 -7
@@ -787,10 +787,10 @@ static int sunxi_pinctrl_build_state(struct platform_device *pdev)return 0 ; } -static int sunxi_pinctrl_probe (struct platform_device *pdev) +int sunxi_pinctrl_init (struct platform_device *pdev, +const struct sunxi_pinctrl_desc *desc) {struct device_node *node = pdev->dev.of_node; -const struct of_device_id *device;struct pinctrl_pin_desc *pins;struct sunxi_pinctrl *pctl;struct reset_control *rstc;
@@ -810,11 +810,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)if (IS_ERR (pctl->membase))return PTR_ERR (pctl->membase); - device =of_match_device (sunxi_pinctrl_match, &pdev->dev); -if (!device) -return -ENODEV ; - - pctl->desc = (const struct sunxi_pinctrl_desc *)device->data; + pctl->desc = desc; ret =sunxi_pinctrl_build_state (pdev);if (ret) {
@@ -940,6 +936,18 @@ pinctrl_error:return ret; } +static int sunxi_pinctrl_probe (struct platform_device *pdev) +{ +const struct of_device_id *device; + + device =of_match_device (sunxi_pinctrl_match, &pdev->dev); +if (!device) +return -ENODEV ; + +return sunxi_pinctrl_init (pdev, + (const struct sunxi_pinctrl_desc *)device->data); +} +static struct platform_driver sunxi_pinctrl_driver = { .probe = sunxi_pinctrl_probe, .driver = {
drivers/pinctrl/sunxi/pinctrl-sunxi.h +3 -0
@@ -252,4 +252,7 @@ static inline u32 sunxi_irq_status_offset(u16 irq) return irq_num * IRQ_STATUS_IRQ_BITS; } +int sunxi_pinctrl_init (struct platform_device *pdev, +const struct sunxi_pinctrl_desc *desc); +#endif /* __PINCTRL_SUNXI_H */
Signature · 1 line
1.9.1
PATCH 7/15 pinctrl: sunxi: Move Allwinner A10 pinctrl driver to a driver of its own
In reply to Maxime RipardMove the pin description to a driver specific to be. This is one more step toward retiring pinctrl-sunxi-pins.h that used to define all the pins for all the Allwinner SoCs in a single header, that would have in turn result in having these structures in the final binary as many times as the header was included.
--- drivers/pinctrl/sunxi/Makefile | 4 + drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c | 1039 ++++++++++++++++++++++++++++ drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h | 994 -------------------------- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 - 4 files changed, 1043 insertions(+), 995 deletions(-) create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c
drivers/pinctrl/sunxi/Makefile +4 -0
@@ -1 +1,5 @@ +# Core obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sunxi.o + +# SoC Drivers +obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun4i-a10.o
drivers/pinctrl/sunxi/pinctrl-sun4i-a10.c new file +1039 -0
1,039 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h +0 -994
1,006 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi.c +0 -1
@@ -674,7 +674,6 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) }static struct of_device_id sunxi_pinctrl_match[] = { - { .compatible ="allwinner,sun4i-a10-pinctrl" , .data = (void *)&sun4i_a10_pinctrl_data }, { .compatible ="allwinner,sun5i-a10s-pinctrl" , .data = (void *)&sun5i_a10s_pinctrl_data }, { .compatible ="allwinner,sun5i-a13-pinctrl" , .data = (void *)&sun5i_a13_pinctrl_data }, { .compatible ="allwinner,sun6i-a31-pinctrl" , .data = (void *)&sun6i_a31_pinctrl_data },
Signature · 1 line
1.9.1
PATCH 8/15 pinctrl: sunxi: Move Allwinner A10s pinctrl driver to a driver of its own
In reply to Maxime RipardMove the pin description to a driver specific to be. This is one more step toward retiring pinctrl-sunxi-pins.h that used to define all the pins for all the Allwinner SoCs in a single header, that would have in turn result in having these structures in the final binary as many times as the header was included.
--- drivers/pinctrl/sunxi/Makefile | 1 + drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c | 690 +++++++++++++++++++++++++++++ drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h | 645 --------------------------- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 - 4 files changed, 691 insertions(+), 646 deletions(-) create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c
drivers/pinctrl/sunxi/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sunxi.o # SoC Drivers obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun4i-a10.o +obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a10s.o
drivers/pinctrl/sunxi/pinctrl-sun5i-a10s.c new file +690 -0
690 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h +0 -645
657 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi.c +0 -1
@@ -674,7 +674,6 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) }static struct of_device_id sunxi_pinctrl_match[] = { - { .compatible ="allwinner,sun5i-a10s-pinctrl" , .data = (void *)&sun5i_a10s_pinctrl_data }, { .compatible ="allwinner,sun5i-a13-pinctrl" , .data = (void *)&sun5i_a13_pinctrl_data }, { .compatible ="allwinner,sun6i-a31-pinctrl" , .data = (void *)&sun6i_a31_pinctrl_data }, { .compatible ="allwinner,sun6i-a31-r-pinctrl" , .data = (void *)&sun6i_a31_r_pinctrl_data },
Signature · 1 line
1.9.1
PATCH 9/15 pinctrl: sunxi: Move Allwinner A13 pinctrl driver to a driver of its own
In reply to Maxime RipardMove the pin description to a driver specific to be. This is one more step toward retiring pinctrl-sunxi-pins.h that used to define all the pins for all the Allwinner SoCs in a single header, that would have in turn result in having these structures in the final binary as many times as the header was included.
--- drivers/pinctrl/sunxi/Makefile | 1 + drivers/pinctrl/sunxi/pinctrl-sun5i-a13.c | 411 +++++++++++++++++++++++++++++ drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h | 366 ------------------------- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 - 4 files changed, 412 insertions(+), 367 deletions(-) create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun5i-a13.c
drivers/pinctrl/sunxi/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sunxi.o # SoC Drivers obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun4i-a10.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a10s.o +obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a13.o
drivers/pinctrl/sunxi/pinctrl-sun5i-a13.c new file +411 -0
411 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h +0 -366
378 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi.c +0 -1
@@ -674,7 +674,6 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) }static struct of_device_id sunxi_pinctrl_match[] = { - { .compatible ="allwinner,sun5i-a13-pinctrl" , .data = (void *)&sun5i_a13_pinctrl_data }, { .compatible ="allwinner,sun6i-a31-pinctrl" , .data = (void *)&sun6i_a31_pinctrl_data }, { .compatible ="allwinner,sun6i-a31-r-pinctrl" , .data = (void *)&sun6i_a31_r_pinctrl_data }, { .compatible ="allwinner,sun7i-a20-pinctrl" , .data = (void *)&sun7i_a20_pinctrl_data },
Signature · 1 line
1.9.1
PATCH 10/15 pinctrl: sunxi: Move Allwinner A31 pinctrl driver to a driver of its own
In reply to Maxime RipardMove the pin description to a driver specific to be. This is one more step toward retiring pinctrl-sunxi-pins.h that used to define all the pins for all the Allwinner SoCs in a single header, that would have in turn result in having these structures in the final binary as many times as the header was included.
--- drivers/pinctrl/sunxi/Makefile | 1 + drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 865 +++++++++++++++++++++++++++++ drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h | 820 --------------------------- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 - 4 files changed, 866 insertions(+), 821 deletions(-) create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c
drivers/pinctrl/sunxi/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sunxi.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun4i-a10.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a10s.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a13.o +obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31.o
drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c new file +865 -0
865 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h +0 -820
832 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi.c +0 -1
@@ -674,7 +674,6 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) }static struct of_device_id sunxi_pinctrl_match[] = { - { .compatible ="allwinner,sun6i-a31-pinctrl" , .data = (void *)&sun6i_a31_pinctrl_data }, { .compatible ="allwinner,sun6i-a31-r-pinctrl" , .data = (void *)&sun6i_a31_r_pinctrl_data }, { .compatible ="allwinner,sun7i-a20-pinctrl" , .data = (void *)&sun7i_a20_pinctrl_data }, {}
Signature · 1 line
1.9.1
PATCH 11/15 pinctrl: sunxi: Move Allwinner A31 special pins driver to a driver of its own
In reply to Maxime RipardMove the pin description to a driver specific to be. This is one more step toward retiring pinctrl-sunxi-pins.h that used to define all the pins for all the Allwinner SoCs in a single header, that would have in turn result in having these structures in the final binary as many times as the header was included.
--- drivers/pinctrl/sunxi/Makefile | 1 + drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c | 122 ++++++++++++++++++++++++++++ drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h | 74 ----------------- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 - 4 files changed, 123 insertions(+), 75 deletions(-) create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c
drivers/pinctrl/sunxi/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun4i-a10.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a10s.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a13.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31.o +obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31-r.o
drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c new file +122 -0
122 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h +0 -74
86 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi.c +0 -1
@@ -674,7 +674,6 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) }static struct of_device_id sunxi_pinctrl_match[] = { - { .compatible ="allwinner,sun6i-a31-r-pinctrl" , .data = (void *)&sun6i_a31_r_pinctrl_data }, { .compatible ="allwinner,sun7i-a20-pinctrl" , .data = (void *)&sun7i_a20_pinctrl_data }, {} };
Signature · 1 line
1.9.1
PATCH 12/15 pinctrl: sunxi: Move Allwinner A20 pinctrl driver to a driver of its own
In reply to Maxime RipardMove the pin description to a driver specific to be.
This is the final step toward retiring pinctrl-sunxi-pins.h that used to define all the pins for all the Allwinner SoCs in a single header, that would have in turn result in having these structures in the final binary as many times as the header was included.
We can finally remove that header, and remove all the driver part of the pinctrl-sunxi core.
--- drivers/pinctrl/sunxi/Makefile | 1 + drivers/pinctrl/sunxi/pinctrl-sun7i-a20.c | 1065 ++++++++++++++++++++++++++++ drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h | 1038 --------------------------- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 33 - 4 files changed, 1066 insertions(+), 1071 deletions(-) create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun7i-a20.c delete mode 100644 drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h
drivers/pinctrl/sunxi/Makefile +1 -0
@@ -7,3 +7,4 @@ obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a10s.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a13.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31.o obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31-r.o +obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun7i-a20.o
drivers/pinctrl/sunxi/pinctrl-sun7i-a20.c new file +1065 -0
1,065 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h deleted +0 -1038
1,038 lines not on this page · raw message
drivers/pinctrl/sunxi/pinctrl-sunxi.c +0 -33
@@ -31,7 +31,6 @@#include "../core.h" #include "pinctrl-sunxi.h" -#include "pinctrl-sunxi-pins.h" static struct sunxi_pinctrl_group *sunxi_pinctrl_find_group_by_name (struct sunxi_pinctrl *pctl,const char *group)
@@ -673,12 +672,6 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) } } -static struct of_device_id sunxi_pinctrl_match[] = { - { .compatible ="allwinner,sun7i-a20-pinctrl" , .data = (void *)&sun7i_a20_pinctrl_data }, - {} -}; -MODULE_DEVICE_TABLE (of, sunxi_pinctrl_match); -static int sunxi_pinctrl_add_function (struct sunxi_pinctrl *pctl,const char *name) {
@@ -930,29 +923,3 @@ pinctrl_error:pinctrl_unregister (pctl->pctl_dev);return ret; } - -static int sunxi_pinctrl_probe (struct platform_device *pdev) -{ -const struct of_device_id *device; - - device =of_match_device (sunxi_pinctrl_match, &pdev->dev); -if (!device) -return -ENODEV ; - -return sunxi_pinctrl_init (pdev, - (const struct sunxi_pinctrl_desc *)device->data); -} - -static struct platform_driver sunxi_pinctrl_driver = { - .probe = sunxi_pinctrl_probe, - .driver = { - .name ="sunxi-pinctrl" , - .owner =THIS_MODULE , - .of_match_table = sunxi_pinctrl_match, - }, -}; -module_platform_driver (sunxi_pinctrl_driver); - -MODULE_AUTHOR ("Maxime Ripard <[email protected]" ); -MODULE_DESCRIPTION ("Allwinner A1X pinctrl driver" ); -MODULE_LICENSE ("GPL" );
Signature · 1 line
1.9.1
PATCH 13/15 pinctrl: sunxi: Introduce per-driver Kconfig options
In reply to Maxime RipardAdd one Kconfig option for each driver. This will allow to better control which driver is enabled, instead of having either all or nothing.
--- drivers/pinctrl/sunxi/Kconfig | 24 ++++++++++++++++++++++++ drivers/pinctrl/sunxi/Makefile | 12 ++++++------ 2 files changed, 30 insertions(+), 6 deletions(-)
drivers/pinctrl/sunxi/Kconfig +24 -0
@@ -5,4 +5,28 @@ config PINCTRL_SUNXI select PINMUX select GENERIC_PINCONF +config PINCTRL_SUN4I_A10 + bool + select PINCTRL_SUNXI + +config PINCTRL_SUN5I_A10S + bool + select PINCTRL_SUNXI + +config PINCTRL_SUN5I_A13 + bool + select PINCTRL_SUNXI + +config PINCTRL_SUN6I_A31 + bool + select PINCTRL_SUNXI + +config PINCTRL_SUN6I_A31_R + bool + select PINCTRL_SUNXI + +config PINCTRL_SUN7I_A20 + bool + select PINCTRL_SUNXI + endif
drivers/pinctrl/sunxi/Makefile +6 -6
@@ -2,9 +2,9 @@ obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sunxi.o # SoC Drivers -obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun4i-a10.o -obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a10s.o -obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a13.o -obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31.o -obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31-r.o -obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun7i-a20.o +obj-$(CONFIG_PINCTRL_SUN4I_A10) += pinctrl-sun4i-a10.o +obj-$(CONFIG_PINCTRL_SUN5I_A10S) += pinctrl-sun5i-a10s.o +obj-$(CONFIG_PINCTRL_SUN5I_A13) += pinctrl-sun5i-a13.o +obj-$(CONFIG_PINCTRL_SUN6I_A31) += pinctrl-sun6i-a31.o +obj-$(CONFIG_PINCTRL_SUN6I_A31_R) += pinctrl-sun6i-a31-r.o +obj-$(CONFIG_PINCTRL_SUN7I_A20) += pinctrl-sun7i-a20.o
Signature · 1 line
1.9.1
PATCH 14/15 pinctrl: sunxi: Move the reset handling functions out of the core
In reply to Maxime RipardThe way that reset is handled right now is that it is made optional for every pinctrl driver, while actually, it isn't used at all for the older Allwinner SoCs, and it's mandatory for the A31 and the upcoming A23.
Move the reset functions out of the core and in the drivers, where they can be made mandatory.
--- drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c | 23 +++++++++++++++++++++-- drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c | 23 +++++++++++++++++++++-- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 16 ++-------------- 3 files changed, 44 insertions(+), 18 deletions(-)
drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c +21 -2
@@ -17,6 +17,7 @@#include <linux/of.h> #include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> +#include <linux/reset.h> #include "pinctrl-sunxi.h"
@@ -96,8 +97,26 @@ static const struct sunxi_pinctrl_desc sun6i_a31_r_pinctrl_data = {static int sun6i_a31_r_pinctrl_probe (struct platform_device *pdev) { -return sunxi_pinctrl_init (pdev, - &sun6i_a31_r_pinctrl_data); +struct reset_control *rstc; +int ret; + + rstc =devm_reset_control_get (&pdev->dev,NULL ); +if (IS_ERR (rstc)) { +dev_err (&pdev->dev,"Reset controller missing\n" ); +return PTR_ERR (rstc); + } + + ret =reset_control_deassert (rstc); +if (ret) +return ret; + + ret =sunxi_pinctrl_init (pdev, + &sun6i_a31_r_pinctrl_data); + +if (ret) +reset_control_assert (rstc); + +return ret; }static struct of_device_id sun6i_a31_r_pinctrl_match[] = {
drivers/pinctrl/sunxi/pinctrl-sun6i-a31.c +21 -2
@@ -15,6 +15,7 @@#include <linux/of.h> #include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> +#include <linux/reset.h> #include "pinctrl-sunxi.h"
@@ -840,8 +841,26 @@ static const struct sunxi_pinctrl_desc sun6i_a31_pinctrl_data = {static int sun6i_a31_pinctrl_probe (struct platform_device *pdev) { -return sunxi_pinctrl_init (pdev, - &sun6i_a31_pinctrl_data); +struct reset_control *rstc; +int ret; + + rstc =devm_reset_control_get (&pdev->dev,NULL ); +if (IS_ERR (rstc)) { +dev_err (&pdev->dev,"Reset controller missing\n" ); +return PTR_ERR (rstc); + } + + ret =reset_control_deassert (rstc); +if (ret) +return ret; + + ret =sunxi_pinctrl_init (pdev, + &sun6i_a31_pinctrl_data); + +if (ret) +reset_control_assert (rstc); + +return ret; }static struct of_device_id sun6i_a31_pinctrl_match[] = {
drivers/pinctrl/sunxi/pinctrl-sunxi.c +2 -14
@@ -26,7 +26,6 @@#include <linux/pinctrl/pinconf-generic.h> #include <linux/pinctrl/pinmux.h> #include <linux/platform_device.h> -#include <linux/reset.h> #include <linux/slab.h> #include "../core.h"
@@ -781,7 +780,6 @@ int sunxi_pinctrl_init(struct platform_device *pdev,struct device_node *node = pdev->dev.of_node;struct pinctrl_pin_desc *pins;struct sunxi_pinctrl *pctl; -struct reset_control *rstc;struct resource *res;int i, ret, last_pin;struct clk *clk;
@@ -875,17 +873,10 @@ int sunxi_pinctrl_init(struct platform_device *pdev,if (ret) goto gpiochip_error; - rstc =devm_reset_control_get_optional (&pdev->dev,NULL ); -if (!IS_ERR (rstc)) { - ret =reset_control_deassert (rstc); -if (ret) - goto clk_error; - } - pctl->irq =irq_of_parse_and_map (node,0 );if (!pctl->irq) { ret = -EINVAL ; - goto rstc_error; + goto clk_error; } pctl->domain = irq_domain_add_linear(node, SUNXI_IRQ_NUMBER,
@@ -893,7 +884,7 @@ int sunxi_pinctrl_init(struct platform_device *pdev,if (!pctl->domain) {dev_err (&pdev->dev,"Couldn't register IRQ domain\n" ); ret = -ENOMEM ; - goto rstc_error; + goto clk_error; }for (i =0 ; i <SUNXI_IRQ_NUMBER ; i++) {
@@ -911,9 +902,6 @@ int sunxi_pinctrl_init(struct platform_device *pdev,return 0 ; -rstc_error: -if (!IS_ERR (rstc)) -reset_control_assert (rstc); clk_error:clk_disable_unprepare (clk); gpiochip_error:
Signature · 1 line
1.9.1
PATCH 15/15 ARM: sunxi: Update pinctrl Kconfig options
In reply to Maxime RipardInstead of relying on the global pinctrl option, select the matching pinctrl driver per each SoC.
--- arch/arm/mach-sunxi/Kconfig | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/Kconfig +6 -1
@@ -4,7 +4,6 @@ config ARCH_SUNXI select CLKSRC_MMIO select GENERIC_IRQ_CHIP select PINCTRL - select PINCTRL_SUNXI select SUN4I_TIMER if ARCH_SUNXI
@@ -13,15 +12,20 @@ menu "Allwinner SoCs variants" config MACH_SUN4I bool "Allwinner A10 (sun4i) SoCs support" + select PINCTRL_SUN4I_A10 config MACH_SUN5I bool "Allwinner A10s / A13 (sun5i) SoCs support" + select PINCTRL_SUN5I_A10S + select PINCTRL_SUN5I_A13 select SUN5I_HSTIMER config MACH_SUN6I bool "Allwinner A31 (sun6i) SoCs support" select ARCH_HAS_RESET_CONTROLLER select ARM_GIC + select PINCTRL_SUN6I_A31 + select PINCTRL_SUN6I_A31_R select RESET_CONTROLLER select SUN5I_HSTIMER
@@ -30,6 +34,7 @@ config MACH_SUN7I select ARM_GIC select ARM_PSCI select HAVE_ARM_ARCH_TIMER + select PINCTRL_SUN7I_A20 select SUN5I_HSTIMER endmenu
Signature · 1 line
1.9.1
cover pinctrl: sunxi: Rework and cleanups
In reply to Maxime RipardQuoted 2 lines · Maxime Ripard
This patchset does some rework and clean up on the Allwinner pinctrl driver.
This all looks good, but doesn't apply to the pinctrl devel branch.
Can you please:
1) Address Thomas' comment on patch 1
2) Provide me a branch, best if based on the pinctrl tree "devel" branch, that I can pull into the pinctrl tree for these 15 patches?
Yours,
Linus Walleij
cover pinctrl: sunxi: Rework and cleanups
Hi Linus,
Quoted 6 lines · Linus Walleij
Quoted 2 lines · Maxime Ripard
This patchset does some rework and clean up on the Allwinner pinctrl driver.
Quoted 8 lines
This all looks good, but doesn't apply to the pinctrl devel branch.
Can you please:
1) Address Thomas' comment on patch 1
2) Provide me a branch, best if based on the pinctrl tree "devel" branch, that I can pull into the pinctrl tree for these 15 patches?
Yep, sure. I'll send a pull request.
I've modified a few things in there:
- Addressed Thomas' comment
- Fixed an issue with patch 14. The main pin controller is not in reset on the A31. Removed the code that was making a reset controller mandatory for that driver.
- And I've dropped the latest patch that touches mach-sunxi/Kconfig. I'll merge it through my tree. That also means that I'll need to merge your branch. Are your branch stable?
Thanks,
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140504/a38a2618/attachment.sig>