diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-04-18 14:12:50 -0400 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2014-05-04 03:03:31 -0400 |
commit | 16c675f9893fffd8a4fd408c42d9ff050e022e58 (patch) | |
tree | 5c9d2c43aed6289e72fe86b01d6db09874931b80 /drivers/pinctrl/sunxi | |
parent | 1c996176e725660bd6e0841ba066d9ff4fc21bba (diff) |
pinctrl: sunxi: Move Allwinner A31 special pins driver to a driver of its own
Move 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.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/pinctrl/sunxi')
-rw-r--r-- | drivers/pinctrl/sunxi/Makefile | 1 | ||||
-rw-r--r-- | drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c | 122 | ||||
-rw-r--r-- | drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h | 74 | ||||
-rw-r--r-- | drivers/pinctrl/sunxi/pinctrl-sunxi.c | 1 |
4 files changed, 123 insertions, 75 deletions
diff --git a/drivers/pinctrl/sunxi/Makefile b/drivers/pinctrl/sunxi/Makefile index d51890c5d34d..df22956ea680 100644 --- a/drivers/pinctrl/sunxi/Makefile +++ b/drivers/pinctrl/sunxi/Makefile | |||
@@ -6,3 +6,4 @@ obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun4i-a10.o | |||
6 | obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a10s.o | 6 | obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a10s.o |
7 | obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a13.o | 7 | obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun5i-a13.o |
8 | obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31.o | 8 | obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31.o |
9 | obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sun6i-a31-r.o | ||
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c new file mode 100644 index 000000000000..b896f7ba606e --- /dev/null +++ b/drivers/pinctrl/sunxi/pinctrl-sun6i-a31-r.c | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * Allwinner A31 SoCs special pins pinctrl driver. | ||
3 | * | ||
4 | * Copyright (C) 2014 Boris Brezillon | ||
5 | * Boris Brezillon <boris.brezillon@free-electrons.com> | ||
6 | * | ||
7 | * Copyright (C) 2014 Maxime Ripard | ||
8 | * Maxime Ripard <maxime.ripard@free-electrons.com> | ||
9 | * | ||
10 | * This file is licensed under the terms of the GNU General Public | ||
11 | * License version 2. This program is licensed "as is" without any | ||
12 | * warranty of any kind, whether express or implied. | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/of.h> | ||
18 | #include <linux/of_device.h> | ||
19 | #include <linux/pinctrl/pinctrl.h> | ||
20 | |||
21 | #include "pinctrl-sunxi.h" | ||
22 | |||
23 | static const struct sunxi_desc_pin sun6i_a31_r_pins[] = { | ||
24 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 0), | ||
25 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
26 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
27 | SUNXI_FUNCTION(0x2, "s_twi"), /* SCK */ | ||
28 | SUNXI_FUNCTION(0x3, "s_p2wi")), /* SCK */ | ||
29 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 1), | ||
30 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
31 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
32 | SUNXI_FUNCTION(0x2, "s_twi"), /* SDA */ | ||
33 | SUNXI_FUNCTION(0x3, "s_p2wi")), /* SDA */ | ||
34 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 2), | ||
35 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
36 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
37 | SUNXI_FUNCTION(0x2, "s_uart")), /* TX */ | ||
38 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 3), | ||
39 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
40 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
41 | SUNXI_FUNCTION(0x2, "s_uart")), /* RX */ | ||
42 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 4), | ||
43 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
44 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
45 | SUNXI_FUNCTION(0x2, "s_ir")), /* RX */ | ||
46 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 5), | ||
47 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
48 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
49 | SUNXI_FUNCTION(0x3, "s_jtag")), /* MS */ | ||
50 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 6), | ||
51 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
52 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
53 | SUNXI_FUNCTION(0x3, "s_jtag")), /* CK */ | ||
54 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 7), | ||
55 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
56 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
57 | SUNXI_FUNCTION(0x3, "s_jtag")), /* DO */ | ||
58 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 8), | ||
59 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
60 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
61 | SUNXI_FUNCTION(0x3, "s_jtag")), /* DI */ | ||
62 | /* Hole */ | ||
63 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 0), | ||
64 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
65 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
66 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 1), | ||
67 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
68 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
69 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 2), | ||
70 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
71 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
72 | SUNXI_FUNCTION(0x3, "1wire")), | ||
73 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 3), | ||
74 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
75 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
76 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 4), | ||
77 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
78 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
79 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 5), | ||
80 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
81 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
82 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 6), | ||
83 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
84 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
85 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 7), | ||
86 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
87 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
88 | SUNXI_FUNCTION(0x3, "rtc")), /* CLKO */ | ||
89 | }; | ||
90 | |||
91 | static const struct sunxi_pinctrl_desc sun6i_a31_r_pinctrl_data = { | ||
92 | .pins = sun6i_a31_r_pins, | ||
93 | .npins = ARRAY_SIZE(sun6i_a31_r_pins), | ||
94 | .pin_base = PL_BASE, | ||
95 | }; | ||
96 | |||
97 | static int sun6i_a31_r_pinctrl_probe(struct platform_device *pdev) | ||
98 | { | ||
99 | return sunxi_pinctrl_init(pdev, | ||
100 | &sun6i_a31_r_pinctrl_data); | ||
101 | } | ||
102 | |||
103 | static struct of_device_id sun6i_a31_r_pinctrl_match[] = { | ||
104 | { .compatible = "allwinner,sun6i-a31-r-pinctrl", }, | ||
105 | {} | ||
106 | }; | ||
107 | MODULE_DEVICE_TABLE(of, sun6i_a31_r_pinctrl_match); | ||
108 | |||
109 | static struct platform_driver sun6i_a31_r_pinctrl_driver = { | ||
110 | .probe = sun6i_a31_r_pinctrl_probe, | ||
111 | .driver = { | ||
112 | .name = "sun6i-a31-r-pinctrl", | ||
113 | .owner = THIS_MODULE, | ||
114 | .of_match_table = sun6i_a31_r_pinctrl_match, | ||
115 | }, | ||
116 | }; | ||
117 | module_platform_driver(sun6i_a31_r_pinctrl_driver); | ||
118 | |||
119 | MODULE_AUTHOR("Boris Brezillon <boris.brezillon@free-electrons.com"); | ||
120 | MODULE_AUTHOR("Maxime Ripard <maxime.ripard@free-electrons.com"); | ||
121 | MODULE_DESCRIPTION("Allwinner A31 R_PIO pinctrl driver"); | ||
122 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h b/drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h index 403f9c50ab99..13ec0172145b 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi-pins.h | |||
@@ -15,74 +15,6 @@ | |||
15 | 15 | ||
16 | #include "pinctrl-sunxi.h" | 16 | #include "pinctrl-sunxi.h" |
17 | 17 | ||
18 | static const struct sunxi_desc_pin sun6i_a31_r_pins[] = { | ||
19 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 0), | ||
20 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
21 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
22 | SUNXI_FUNCTION(0x2, "s_twi"), /* SCK */ | ||
23 | SUNXI_FUNCTION(0x3, "s_p2wi")), /* SCK */ | ||
24 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 1), | ||
25 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
26 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
27 | SUNXI_FUNCTION(0x2, "s_twi"), /* SDA */ | ||
28 | SUNXI_FUNCTION(0x3, "s_p2wi")), /* SDA */ | ||
29 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 2), | ||
30 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
31 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
32 | SUNXI_FUNCTION(0x2, "s_uart")), /* TX */ | ||
33 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 3), | ||
34 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
35 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
36 | SUNXI_FUNCTION(0x2, "s_uart")), /* RX */ | ||
37 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 4), | ||
38 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
39 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
40 | SUNXI_FUNCTION(0x2, "s_ir")), /* RX */ | ||
41 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 5), | ||
42 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
43 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
44 | SUNXI_FUNCTION(0x3, "s_jtag")), /* MS */ | ||
45 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 6), | ||
46 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
47 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
48 | SUNXI_FUNCTION(0x3, "s_jtag")), /* CK */ | ||
49 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 7), | ||
50 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
51 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
52 | SUNXI_FUNCTION(0x3, "s_jtag")), /* DO */ | ||
53 | SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 8), | ||
54 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
55 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
56 | SUNXI_FUNCTION(0x3, "s_jtag")), /* DI */ | ||
57 | /* Hole */ | ||
58 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 0), | ||
59 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
60 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
61 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 1), | ||
62 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
63 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
64 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 2), | ||
65 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
66 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
67 | SUNXI_FUNCTION(0x3, "1wire")), | ||
68 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 3), | ||
69 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
70 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
71 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 4), | ||
72 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
73 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
74 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 5), | ||
75 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
76 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
77 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 6), | ||
78 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
79 | SUNXI_FUNCTION(0x1, "gpio_out")), | ||
80 | SUNXI_PIN(SUNXI_PINCTRL_PIN(M, 7), | ||
81 | SUNXI_FUNCTION(0x0, "gpio_in"), | ||
82 | SUNXI_FUNCTION(0x1, "gpio_out"), | ||
83 | SUNXI_FUNCTION(0x3, "rtc")), /* CLKO */ | ||
84 | }; | ||
85 | |||
86 | static const struct sunxi_desc_pin sun7i_a20_pins[] = { | 18 | static const struct sunxi_desc_pin sun7i_a20_pins[] = { |
87 | SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 0), | 19 | SUNXI_PIN(SUNXI_PINCTRL_PIN(A, 0), |
88 | SUNXI_FUNCTION(0x0, "gpio_in"), | 20 | SUNXI_FUNCTION(0x0, "gpio_in"), |
@@ -1098,12 +1030,6 @@ static const struct sunxi_desc_pin sun7i_a20_pins[] = { | |||
1098 | SUNXI_FUNCTION(0x4, "hdmi")), /* HSDA */ | 1030 | SUNXI_FUNCTION(0x4, "hdmi")), /* HSDA */ |
1099 | }; | 1031 | }; |
1100 | 1032 | ||
1101 | static const struct sunxi_pinctrl_desc sun6i_a31_r_pinctrl_data = { | ||
1102 | .pins = sun6i_a31_r_pins, | ||
1103 | .npins = ARRAY_SIZE(sun6i_a31_r_pins), | ||
1104 | .pin_base = PL_BASE, | ||
1105 | }; | ||
1106 | |||
1107 | static const struct sunxi_pinctrl_desc sun7i_a20_pinctrl_data = { | 1033 | static const struct sunxi_pinctrl_desc sun7i_a20_pinctrl_data = { |
1108 | .pins = sun7i_a20_pins, | 1034 | .pins = sun7i_a20_pins, |
1109 | .npins = ARRAY_SIZE(sun7i_a20_pins), | 1035 | .npins = ARRAY_SIZE(sun7i_a20_pins), |
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c index 6596e262596b..bf56cd3feec2 100644 --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c | |||
@@ -674,7 +674,6 @@ static void sunxi_pinctrl_irq_handler(unsigned irq, struct irq_desc *desc) | |||
674 | } | 674 | } |
675 | 675 | ||
676 | static struct of_device_id sunxi_pinctrl_match[] = { | 676 | static struct of_device_id sunxi_pinctrl_match[] = { |
677 | { .compatible = "allwinner,sun6i-a31-r-pinctrl", .data = (void *)&sun6i_a31_r_pinctrl_data }, | ||
678 | { .compatible = "allwinner,sun7i-a20-pinctrl", .data = (void *)&sun7i_a20_pinctrl_data }, | 677 | { .compatible = "allwinner,sun7i-a20-pinctrl", .data = (void *)&sun7i_a20_pinctrl_data }, |
679 | {} | 678 | {} |
680 | }; | 679 | }; |