aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 12:40:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 12:40:35 -0400
commit000a74f41e601bc4e36a760aa42f219a019c5391 (patch)
tree6ff200c5112af40ef97afacac07f862aa428edb9
parent8127b39e700f965a60fca443d23f3e171bf7c3a9 (diff)
parent42fed7ba44e4e8c1fb27b28ad14490cb1daff3c7 (diff)
Merge tag 'pinctrl-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pinctrl update from Linus Walleij: "These are the pinctrl changes for v3.10: - Patrice Chotard contributed a new configuration debugfs interface and reintroduced fine-grained locking into the core: instead of having a "big pinctrl lock" we have a per-controller lock and specialized locks for the global controller and pinctrl handle lists. - Haoijan Zhuang deleted all the PXA and MMP2 pinctrl drivers and replaced them with pinctrl-single (which is also used by other SoCs) so we are gaining consolidation. The platform particulars now come in through the device tree. - Haoijan also added support for generic pin config into the pinctrl-single driver which is another big consolidation win. - Finally also GPIO ranges are now supported by the pinctrl-single driver. - Tomasz Figa contributed a new Samsung S3C pinctrl driver, bringing more of the older Samsung platforms under the pinctrl umbrella and out of arch/arm. - Maxime Ripard contributed new Allwinner A10/A13 drivers. - Sachin Kamat, Wei Yongjun and Axel Lin did a lot of cleanups." * tag 'pinctrl-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (66 commits) pinctrl: move subsystem mutex to pinctrl_dev struct pinctrl/pinconfig: fix misplaced goto pinctrl: s3c64xx: Fix build error caused by undefined chained_irq_enter pinctrl/pinconfig: add debug interface pinctrl: abx500: fix issue when no pdata pinctrl: pinctrl-single: add missing double quote pinctrl: sunxi: Rename wemac functions to emac pinctrl: exynos5440: add gpio interrupt support pinctrl: exynos5440: fix probe failure due to missing pin-list in config nodes pinctrl: ab8505: Staticize some symbols pinctrl: ab8540: Staticize some symbols pinctrl: ab9540: Staticize some symbols pinctrl: ab8500: Staticize some symbols pinctrl: abx500: Staticize some symbols pinctrl: Add pinctrl-s3c64xx driver pinctrl: samsung: Handle banks with two configuration registers pinctrl: samsung: Remove hardcoded register offsets pinctrl: samsung: Split pin bank description into two structures pinctrl: samsung: Include pinctrl-exynos driver data conditionally pinctrl: samsung: Protect bank registers with a spinlock ...
-rw-r--r--Documentation/devicetree/bindings/gpio/gpio.txt6
-rw-r--r--Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt109
-rw-r--r--Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt3
-rw-r--r--Documentation/pinctrl.txt112
-rw-r--r--arch/arm/boot/dts/spear1310.dtsi4
-rw-r--r--arch/arm/boot/dts/spear1340.dtsi4
-rw-r--r--arch/arm/boot/dts/spear310.dtsi4
-rw-r--r--arch/arm/boot/dts/spear320.dtsi4
-rw-r--r--drivers/gpio/gpio-pl061.c125
-rw-r--r--drivers/gpio/gpiolib-of.c15
-rw-r--r--drivers/pinctrl/Kconfig25
-rw-r--r--drivers/pinctrl/Makefile5
-rw-r--r--drivers/pinctrl/core.c359
-rw-r--r--drivers/pinctrl/core.h8
-rw-r--r--drivers/pinctrl/devicetree.c19
-rw-r--r--drivers/pinctrl/mvebu/pinctrl-mvebu.c39
-rw-r--r--drivers/pinctrl/pinconf-generic.c20
-rw-r--r--drivers/pinctrl/pinconf.c335
-rw-r--r--drivers/pinctrl/pinconf.h8
-rw-r--r--drivers/pinctrl/pinctrl-ab8500.c5
-rw-r--r--drivers/pinctrl/pinctrl-ab8505.c7
-rw-r--r--drivers/pinctrl/pinctrl-ab8540.c5
-rw-r--r--drivers/pinctrl/pinctrl-ab9540.c7
-rw-r--r--drivers/pinctrl/pinctrl-abx500.c18
-rw-r--r--drivers/pinctrl/pinctrl-at91.c27
-rw-r--r--drivers/pinctrl/pinctrl-bcm2835.c6
-rw-r--r--drivers/pinctrl/pinctrl-coh901.c9
-rw-r--r--drivers/pinctrl/pinctrl-exynos.c36
-rw-r--r--drivers/pinctrl/pinctrl-exynos.h16
-rw-r--r--drivers/pinctrl/pinctrl-exynos5440.c159
-rw-r--r--drivers/pinctrl/pinctrl-falcon.c2
-rw-r--r--drivers/pinctrl/pinctrl-imx.c6
-rw-r--r--drivers/pinctrl/pinctrl-lantiq.c4
-rw-r--r--drivers/pinctrl/pinctrl-mmp2.c722
-rw-r--r--drivers/pinctrl/pinctrl-mxs.c6
-rw-r--r--drivers/pinctrl/pinctrl-nomadik-db8500.c4
-rw-r--r--drivers/pinctrl/pinctrl-nomadik-stn8815.c2
-rw-r--r--drivers/pinctrl/pinctrl-nomadik.c16
-rw-r--r--drivers/pinctrl/pinctrl-pxa168.c651
-rw-r--r--drivers/pinctrl/pinctrl-pxa3xx.c227
-rw-r--r--drivers/pinctrl/pinctrl-pxa3xx.h262
-rw-r--r--drivers/pinctrl/pinctrl-pxa910.c1007
-rw-r--r--drivers/pinctrl/pinctrl-s3c64xx.c816
-rw-r--r--drivers/pinctrl/pinctrl-samsung.c105
-rw-r--r--drivers/pinctrl/pinctrl-samsung.h42
-rw-r--r--drivers/pinctrl/pinctrl-single.c515
-rw-r--r--drivers/pinctrl/pinctrl-sirf.c14
-rw-r--r--drivers/pinctrl/pinctrl-sunxi.c986
-rw-r--r--drivers/pinctrl/pinctrl-tegra.c6
-rw-r--r--drivers/pinctrl/pinctrl-u300.c6
-rw-r--r--drivers/pinctrl/pinctrl-xway.c2
-rw-r--r--drivers/pinctrl/pinmux.c8
-rw-r--r--drivers/pinctrl/spear/pinctrl-spear.c4
-rw-r--r--include/linux/pinctrl/pinconf.h6
-rw-r--r--include/linux/pinctrl/pinctrl.h6
55 files changed, 3228 insertions, 3696 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio.txt b/Documentation/devicetree/bindings/gpio/gpio.txt
index a33628759d36..d933af370697 100644
--- a/Documentation/devicetree/bindings/gpio/gpio.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio.txt
@@ -98,7 +98,7 @@ announce the pinrange to the pin ctrl subsystem. For example,
98 compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank"; 98 compatible = "fsl,qe-pario-bank-e", "fsl,qe-pario-bank";
99 reg = <0x1460 0x18>; 99 reg = <0x1460 0x18>;
100 gpio-controller; 100 gpio-controller;
101 gpio-ranges = <&pinctrl1 20 10>, <&pinctrl2 50 20>; 101 gpio-ranges = <&pinctrl1 0 20 10>, <&pinctrl2 10 50 20>;
102 102
103 } 103 }
104 104
@@ -107,8 +107,8 @@ where,
107 107
108 Next values specify the base pin and number of pins for the range 108 Next values specify the base pin and number of pins for the range
109 handled by 'qe_pio_e' gpio. In the given example from base pin 20 to 109 handled by 'qe_pio_e' gpio. In the given example from base pin 20 to
110 pin 29 under pinctrl1 and pin 50 to pin 69 under pinctrl2 is handled 110 pin 29 under pinctrl1 with gpio offset 0 and pin 50 to pin 69 under
111 by this gpio controller. 111 pinctrl2 with gpio offset 10 is handled by this gpio controller.
112 112
113The pinctrl node must have "#gpio-range-cells" property to show number of 113The pinctrl node must have "#gpio-range-cells" property to show number of
114arguments to pass with phandle from gpio controllers node. 114arguments to pass with phandle from gpio controllers node.
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
index 2c81e45f1374..08f0c3d01575 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-single.txt
@@ -1,7 +1,9 @@
1One-register-per-pin type device tree based pinctrl driver 1One-register-per-pin type device tree based pinctrl driver
2 2
3Required properties: 3Required properties:
4- compatible : "pinctrl-single" 4- compatible : "pinctrl-single" or "pinconf-single".
5 "pinctrl-single" means that pinconf isn't supported.
6 "pinconf-single" means that generic pinconf is supported.
5 7
6- reg : offset and length of the register set for the mux registers 8- reg : offset and length of the register set for the mux registers
7 9
@@ -14,9 +16,61 @@ Optional properties:
14- pinctrl-single,function-off : function off mode for disabled state if 16- pinctrl-single,function-off : function off mode for disabled state if
15 available and same for all registers; if not specified, disabling of 17 available and same for all registers; if not specified, disabling of
16 pin functions is ignored 18 pin functions is ignored
19
17- pinctrl-single,bit-per-mux : boolean to indicate that one register controls 20- pinctrl-single,bit-per-mux : boolean to indicate that one register controls
18 more than one pin 21 more than one pin
19 22
23- pinctrl-single,drive-strength : array of value that are used to configure
24 drive strength in the pinmux register. They're value of drive strength
25 current and drive strength mask.
26
27 /* drive strength current, mask */
28 pinctrl-single,power-source = <0x30 0xf0>;
29
30- pinctrl-single,bias-pullup : array of value that are used to configure the
31 input bias pullup in the pinmux register.
32
33 /* input, enabled pullup bits, disabled pullup bits, mask */
34 pinctrl-single,bias-pullup = <0 1 0 1>;
35
36- pinctrl-single,bias-pulldown : array of value that are used to configure the
37 input bias pulldown in the pinmux register.
38
39 /* input, enabled pulldown bits, disabled pulldown bits, mask */
40 pinctrl-single,bias-pulldown = <2 2 0 2>;
41
42 * Two bits to control input bias pullup and pulldown: User should use
43 pinctrl-single,bias-pullup & pinctrl-single,bias-pulldown. One bit means
44 pullup, and the other one bit means pulldown.
45 * Three bits to control input bias enable, pullup and pulldown. User should
46 use pinctrl-single,bias-pullup & pinctrl-single,bias-pulldown. Input bias
47 enable bit should be included in pullup or pulldown bits.
48 * Although driver could set PIN_CONFIG_BIAS_DISABLE, there's no property as
49 pinctrl-single,bias-disable. Because pinctrl single driver could implement
50 it by calling pulldown, pullup disabled.
51
52- pinctrl-single,input-schmitt : array of value that are used to configure
53 input schmitt in the pinmux register. In some silicons, there're two input
54 schmitt value (rising-edge & falling-edge) in the pinmux register.
55
56 /* input schmitt value, mask */
57 pinctrl-single,input-schmitt = <0x30 0x70>;
58
59- pinctrl-single,input-schmitt-enable : array of value that are used to
60 configure input schmitt enable or disable in the pinmux register.
61
62 /* input, enable bits, disable bits, mask */
63 pinctrl-single,input-schmitt-enable = <0x30 0x40 0 0x70>;
64
65- pinctrl-single,gpio-range : list of value that are used to configure a GPIO
66 range. They're value of subnode phandle, pin base in pinctrl device, pin
67 number in this range, GPIO function value of this GPIO range.
68 The number of parameters is depend on #pinctrl-single,gpio-range-cells
69 property.
70
71 /* pin base, nr pins & gpio function */
72 pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1>;
73
20This driver assumes that there is only one register for each pin (unless the 74This driver assumes that there is only one register for each pin (unless the
21pinctrl-single,bit-per-mux is set), and uses the common pinctrl bindings as 75pinctrl-single,bit-per-mux is set), and uses the common pinctrl bindings as
22specified in the pinctrl-bindings.txt document in this directory. 76specified in the pinctrl-bindings.txt document in this directory.
@@ -42,6 +96,20 @@ Where 0xdc is the offset from the pinctrl register base address for the
42device pinctrl register, 0x18 is the desired value, and 0xff is the sub mask to 96device pinctrl register, 0x18 is the desired value, and 0xff is the sub mask to
43be used when applying this change to the register. 97be used when applying this change to the register.
44 98
99
100Optional sub-node: In case some pins could be configured as GPIO in the pinmux
101register, those pins could be defined as a GPIO range. This sub-node is required
102by pinctrl-single,gpio-range property.
103
104Required properties in sub-node:
105- #pinctrl-single,gpio-range-cells : the number of parameters after phandle in
106 pinctrl-single,gpio-range property.
107
108 range: gpio-range {
109 #pinctrl-single,gpio-range-cells = <3>;
110 };
111
112
45Example: 113Example:
46 114
47/* SoC common file */ 115/* SoC common file */
@@ -58,7 +126,7 @@ pmx_core: pinmux@4a100040 {
58 126
59/* second controller instance for pins in wkup domain */ 127/* second controller instance for pins in wkup domain */
60pmx_wkup: pinmux@4a31e040 { 128pmx_wkup: pinmux@4a31e040 {
61 compatible = "pinctrl-single; 129 compatible = "pinctrl-single";
62 reg = <0x4a31e040 0x0038>; 130 reg = <0x4a31e040 0x0038>;
63 #address-cells = <1>; 131 #address-cells = <1>;
64 #size-cells = <0>; 132 #size-cells = <0>;
@@ -76,6 +144,29 @@ control_devconf0: pinmux@48002274 {
76 pinctrl-single,function-mask = <0x5F>; 144 pinctrl-single,function-mask = <0x5F>;
77}; 145};
78 146
147/* third controller instance for pins in gpio domain */
148pmx_gpio: pinmux@d401e000 {
149 compatible = "pinconf-single";
150 reg = <0xd401e000 0x0330>;
151 #address-cells = <1>;
152 #size-cells = <1>;
153 ranges;
154
155 pinctrl-single,register-width = <32>;
156 pinctrl-single,function-mask = <7>;
157
158 /* sparse GPIO range could be supported */
159 pinctrl-single,gpio-range = <&range 0 3 0 &range 3 9 1
160 &range 12 1 0 &range 13 29 1
161 &range 43 1 0 &range 44 49 1
162 &range 94 1 1 &range 96 2 1>;
163
164 range: gpio-range {
165 #pinctrl-single,gpio-range-cells = <3>;
166 };
167};
168
169
79/* board specific .dts file */ 170/* board specific .dts file */
80 171
81&pmx_core { 172&pmx_core {
@@ -96,6 +187,15 @@ control_devconf0: pinmux@48002274 {
96 >; 187 >;
97 }; 188 };
98 189
190 uart0_pins: pinmux_uart0_pins {
191 pinctrl-single,pins = <
192 0x208 0 /* UART0_RXD (IOCFG138) */
193 0x20c 0 /* UART0_TXD (IOCFG139) */
194 >;
195 pinctrl-single,bias-pulldown = <0 2 2>;
196 pinctrl-single,bias-pullup = <0 1 1>;
197 };
198
99 /* map uart2 pins */ 199 /* map uart2 pins */
100 uart2_pins: pinmux_uart2_pins { 200 uart2_pins: pinmux_uart2_pins {
101 pinctrl-single,pins = < 201 pinctrl-single,pins = <
@@ -122,6 +222,11 @@ control_devconf0: pinmux@48002274 {
122 222
123}; 223};
124 224
225&uart1 {
226 pinctrl-names = "default";
227 pinctrl-0 = <&uart0_pins>;
228};
229
125&uart2 { 230&uart2 {
126 pinctrl-names = "default"; 231 pinctrl-names = "default";
127 pinctrl-0 = <&uart2_pins>; 232 pinctrl-0 = <&uart2_pins>;
diff --git a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
index 4598a47aa0cd..c70fca146e91 100644
--- a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
@@ -7,6 +7,7 @@ on-chip controllers onto these pads.
7 7
8Required Properties: 8Required Properties:
9- compatible: should be one of the following. 9- compatible: should be one of the following.
10 - "samsung,s3c64xx-pinctrl": for S3C64xx-compatible pin-controller,
10 - "samsung,exynos4210-pinctrl": for Exynos4210 compatible pin-controller. 11 - "samsung,exynos4210-pinctrl": for Exynos4210 compatible pin-controller.
11 - "samsung,exynos4x12-pinctrl": for Exynos4x12 compatible pin-controller. 12 - "samsung,exynos4x12-pinctrl": for Exynos4x12 compatible pin-controller.
12 - "samsung,exynos5250-pinctrl": for Exynos5250 compatible pin-controller. 13 - "samsung,exynos5250-pinctrl": for Exynos5250 compatible pin-controller.
@@ -105,6 +106,8 @@ B. External Wakeup Interrupts: For supporting external wakeup interrupts, a
105 106
106 - compatible: identifies the type of the external wakeup interrupt controller 107 - compatible: identifies the type of the external wakeup interrupt controller
107 The possible values are: 108 The possible values are:
109 - samsung,s3c64xx-wakeup-eint: represents wakeup interrupt controller
110 found on Samsung S3C64xx SoCs,
108 - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller 111 - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller
109 found on Samsung Exynos4210 SoC. 112 found on Samsung Exynos4210 SoC.
110 - interrupt-parent: phandle of the interrupt parent to which the external 113 - interrupt-parent: phandle of the interrupt parent to which the external
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
index a2b57e0a1db0..447fd4cd54ec 100644
--- a/Documentation/pinctrl.txt
+++ b/Documentation/pinctrl.txt
@@ -736,6 +736,13 @@ All the above functions are mandatory to implement for a pinmux driver.
736Pin control interaction with the GPIO subsystem 736Pin control interaction with the GPIO subsystem
737=============================================== 737===============================================
738 738
739Note that the following implies that the use case is to use a certain pin
740from the Linux kernel using the API in <linux/gpio.h> with gpio_request()
741and similar functions. There are cases where you may be using something
742that your datasheet calls "GPIO mode" but actually is just an electrical
743configuration for a certain device. See the section below named
744"GPIO mode pitfalls" for more details on this scenario.
745
739The public pinmux API contains two functions named pinctrl_request_gpio() 746The public pinmux API contains two functions named pinctrl_request_gpio()
740and pinctrl_free_gpio(). These two functions shall *ONLY* be called from 747and pinctrl_free_gpio(). These two functions shall *ONLY* be called from
741gpiolib-based drivers as part of their gpio_request() and 748gpiolib-based drivers as part of their gpio_request() and
@@ -774,6 +781,111 @@ obtain the function "gpioN" where "N" is the global GPIO pin number if no
774special GPIO-handler is registered. 781special GPIO-handler is registered.
775 782
776 783
784GPIO mode pitfalls
785==================
786
787Sometime the developer may be confused by a datasheet talking about a pin
788being possible to set into "GPIO mode". It appears that what hardware
789engineers mean with "GPIO mode" is not necessarily the use case that is
790implied in the kernel interface <linux/gpio.h>: a pin that you grab from
791kernel code and then either listen for input or drive high/low to
792assert/deassert some external line.
793
794Rather hardware engineers think that "GPIO mode" means that you can
795software-control a few electrical properties of the pin that you would
796not be able to control if the pin was in some other mode, such as muxed in
797for a device.
798
799Example: a pin is usually muxed in to be used as a UART TX line. But during
800system sleep, we need to put this pin into "GPIO mode" and ground it.
801
802If you make a 1-to-1 map to the GPIO subsystem for this pin, you may start
803to think that you need to come up with something real complex, that the
804pin shall be used for UART TX and GPIO at the same time, that you will grab
805a pin control handle and set it to a certain state to enable UART TX to be
806muxed in, then twist it over to GPIO mode and use gpio_direction_output()
807to drive it low during sleep, then mux it over to UART TX again when you
808wake up and maybe even gpio_request/gpio_free as part of this cycle. This
809all gets very complicated.
810
811The solution is to not think that what the datasheet calls "GPIO mode"
812has to be handled by the <linux/gpio.h> interface. Instead view this as
813a certain pin config setting. Look in e.g. <linux/pinctrl/pinconf-generic.h>
814and you find this in the documentation:
815
816 PIN_CONFIG_OUTPUT: this will configure the pin in output, use argument
817 1 to indicate high level, argument 0 to indicate low level.
818
819So it is perfectly possible to push a pin into "GPIO mode" and drive the
820line low as part of the usual pin control map. So for example your UART
821driver may look like this:
822
823#include <linux/pinctrl/consumer.h>
824
825struct pinctrl *pinctrl;
826struct pinctrl_state *pins_default;
827struct pinctrl_state *pins_sleep;
828
829pins_default = pinctrl_lookup_state(uap->pinctrl, PINCTRL_STATE_DEFAULT);
830pins_sleep = pinctrl_lookup_state(uap->pinctrl, PINCTRL_STATE_SLEEP);
831
832/* Normal mode */
833retval = pinctrl_select_state(pinctrl, pins_default);
834/* Sleep mode */
835retval = pinctrl_select_state(pinctrl, pins_sleep);
836
837And your machine configuration may look like this:
838--------------------------------------------------
839
840static unsigned long uart_default_mode[] = {
841 PIN_CONF_PACKED(PIN_CONFIG_DRIVE_PUSH_PULL, 0),
842};
843
844static unsigned long uart_sleep_mode[] = {
845 PIN_CONF_PACKED(PIN_CONFIG_OUTPUT, 0),
846};
847
848static struct pinctrl_map __initdata pinmap[] = {
849 PIN_MAP_MUX_GROUP("uart", PINCTRL_STATE_DEFAULT, "pinctrl-foo",
850 "u0_group", "u0"),
851 PIN_MAP_CONFIGS_PIN("uart", PINCTRL_STATE_DEFAULT, "pinctrl-foo",
852 "UART_TX_PIN", uart_default_mode),
853 PIN_MAP_MUX_GROUP("uart", PINCTRL_STATE_SLEEP, "pinctrl-foo",
854 "u0_group", "gpio-mode"),
855 PIN_MAP_CONFIGS_PIN("uart", PINCTRL_STATE_SLEEP, "pinctrl-foo",
856 "UART_TX_PIN", uart_sleep_mode),
857};
858
859foo_init(void) {
860 pinctrl_register_mappings(pinmap, ARRAY_SIZE(pinmap));
861}
862
863Here the pins we want to control are in the "u0_group" and there is some
864function called "u0" that can be enabled on this group of pins, and then
865everything is UART business as usual. But there is also some function
866named "gpio-mode" that can be mapped onto the same pins to move them into
867GPIO mode.
868
869This will give the desired effect without any bogus interaction with the
870GPIO subsystem. It is just an electrical configuration used by that device
871when going to sleep, it might imply that the pin is set into something the
872datasheet calls "GPIO mode" but that is not the point: it is still used
873by that UART device to control the pins that pertain to that very UART
874driver, putting them into modes needed by the UART. GPIO in the Linux
875kernel sense are just some 1-bit line, and is a different use case.
876
877How the registers are poked to attain the push/pull and output low
878configuration and the muxing of the "u0" or "gpio-mode" group onto these
879pins is a question for the driver.
880
881Some datasheets will be more helpful and refer to the "GPIO mode" as
882"low power mode" rather than anything to do with GPIO. This often means
883the same thing electrically speaking, but in this latter case the
884software engineers will usually quickly identify that this is some
885specific muxing/configuration rather than anything related to the GPIO
886API.
887
888
777Board/machine configuration 889Board/machine configuration
778================================== 890==================================
779 891
diff --git a/arch/arm/boot/dts/spear1310.dtsi b/arch/arm/boot/dts/spear1310.dtsi
index 1513c1927cc8..122ae94076c8 100644
--- a/arch/arm/boot/dts/spear1310.dtsi
+++ b/arch/arm/boot/dts/spear1310.dtsi
@@ -89,7 +89,7 @@
89 pinmux: pinmux@e0700000 { 89 pinmux: pinmux@e0700000 {
90 compatible = "st,spear1310-pinmux"; 90 compatible = "st,spear1310-pinmux";
91 reg = <0xe0700000 0x1000>; 91 reg = <0xe0700000 0x1000>;
92 #gpio-range-cells = <2>; 92 #gpio-range-cells = <3>;
93 }; 93 };
94 94
95 apb { 95 apb {
@@ -212,7 +212,7 @@
212 interrupt-controller; 212 interrupt-controller;
213 gpio-controller; 213 gpio-controller;
214 #gpio-cells = <2>; 214 #gpio-cells = <2>;
215 gpio-ranges = <&pinmux 0 246>; 215 gpio-ranges = <&pinmux 0 0 246>;
216 status = "disabled"; 216 status = "disabled";
217 217
218 st-plgpio,ngpio = <246>; 218 st-plgpio,ngpio = <246>;
diff --git a/arch/arm/boot/dts/spear1340.dtsi b/arch/arm/boot/dts/spear1340.dtsi
index 34da11aa6795..c511c4772efd 100644
--- a/arch/arm/boot/dts/spear1340.dtsi
+++ b/arch/arm/boot/dts/spear1340.dtsi
@@ -63,7 +63,7 @@
63 pinmux: pinmux@e0700000 { 63 pinmux: pinmux@e0700000 {
64 compatible = "st,spear1340-pinmux"; 64 compatible = "st,spear1340-pinmux";
65 reg = <0xe0700000 0x1000>; 65 reg = <0xe0700000 0x1000>;
66 #gpio-range-cells = <2>; 66 #gpio-range-cells = <3>;
67 }; 67 };
68 68
69 pwm: pwm@e0180000 { 69 pwm: pwm@e0180000 {
@@ -127,7 +127,7 @@
127 interrupt-controller; 127 interrupt-controller;
128 gpio-controller; 128 gpio-controller;
129 #gpio-cells = <2>; 129 #gpio-cells = <2>;
130 gpio-ranges = <&pinmux 0 252>; 130 gpio-ranges = <&pinmux 0 0 252>;
131 status = "disabled"; 131 status = "disabled";
132 132
133 st-plgpio,ngpio = <250>; 133 st-plgpio,ngpio = <250>;
diff --git a/arch/arm/boot/dts/spear310.dtsi b/arch/arm/boot/dts/spear310.dtsi
index ab45b8c81982..95372080eea6 100644
--- a/arch/arm/boot/dts/spear310.dtsi
+++ b/arch/arm/boot/dts/spear310.dtsi
@@ -25,7 +25,7 @@
25 pinmux: pinmux@b4000000 { 25 pinmux: pinmux@b4000000 {
26 compatible = "st,spear310-pinmux"; 26 compatible = "st,spear310-pinmux";
27 reg = <0xb4000000 0x1000>; 27 reg = <0xb4000000 0x1000>;
28 #gpio-range-cells = <2>; 28 #gpio-range-cells = <3>;
29 }; 29 };
30 30
31 fsmc: flash@44000000 { 31 fsmc: flash@44000000 {
@@ -102,7 +102,7 @@
102 interrupt-controller; 102 interrupt-controller;
103 gpio-controller; 103 gpio-controller;
104 #gpio-cells = <2>; 104 #gpio-cells = <2>;
105 gpio-ranges = <&pinmux 0 102>; 105 gpio-ranges = <&pinmux 0 0 102>;
106 status = "disabled"; 106 status = "disabled";
107 107
108 st-plgpio,ngpio = <102>; 108 st-plgpio,ngpio = <102>;
diff --git a/arch/arm/boot/dts/spear320.dtsi b/arch/arm/boot/dts/spear320.dtsi
index caa5520b1fd4..ffea342aeec9 100644
--- a/arch/arm/boot/dts/spear320.dtsi
+++ b/arch/arm/boot/dts/spear320.dtsi
@@ -24,7 +24,7 @@
24 pinmux: pinmux@b3000000 { 24 pinmux: pinmux@b3000000 {
25 compatible = "st,spear320-pinmux"; 25 compatible = "st,spear320-pinmux";
26 reg = <0xb3000000 0x1000>; 26 reg = <0xb3000000 0x1000>;
27 #gpio-range-cells = <2>; 27 #gpio-range-cells = <3>;
28 }; 28 };
29 29
30 clcd@90000000 { 30 clcd@90000000 {
@@ -130,7 +130,7 @@
130 interrupt-controller; 130 interrupt-controller;
131 gpio-controller; 131 gpio-controller;
132 #gpio-cells = <2>; 132 #gpio-cells = <2>;
133 gpio-ranges = <&pinmux 0 102>; 133 gpio-ranges = <&pinmux 0 0 102>;
134 status = "disabled"; 134 status = "disabled";
135 135
136 st-plgpio,ngpio = <102>; 136 st-plgpio,ngpio = <102>;
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index b820869ca93c..d7008dfdd6f0 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/irqdomain.h>
18#include <linux/bitops.h> 19#include <linux/bitops.h>
19#include <linux/workqueue.h> 20#include <linux/workqueue.h>
20#include <linux/gpio.h> 21#include <linux/gpio.h>
@@ -22,6 +23,7 @@
22#include <linux/amba/bus.h> 23#include <linux/amba/bus.h>
23#include <linux/amba/pl061.h> 24#include <linux/amba/pl061.h>
24#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/pinctrl/consumer.h>
25#include <linux/pm.h> 27#include <linux/pm.h>
26#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
27 29
@@ -51,8 +53,7 @@ struct pl061_gpio {
51 spinlock_t lock; 53 spinlock_t lock;
52 54
53 void __iomem *base; 55 void __iomem *base;
54 int irq_base; 56 struct irq_domain *domain;
55 struct irq_chip_generic *irq_gc;
56 struct gpio_chip gc; 57 struct gpio_chip gc;
57 58
58#ifdef CONFIG_PM 59#ifdef CONFIG_PM
@@ -60,6 +61,24 @@ struct pl061_gpio {
60#endif 61#endif
61}; 62};
62 63
64static int pl061_gpio_request(struct gpio_chip *chip, unsigned offset)
65{
66 /*
67 * Map back to global GPIO space and request muxing, the direction
68 * parameter does not matter for this controller.
69 */
70 int gpio = chip->base + offset;
71
72 return pinctrl_request_gpio(gpio);
73}
74
75static void pl061_gpio_free(struct gpio_chip *chip, unsigned offset)
76{
77 int gpio = chip->base + offset;
78
79 pinctrl_free_gpio(gpio);
80}
81
63static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) 82static int pl061_direction_input(struct gpio_chip *gc, unsigned offset)
64{ 83{
65 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); 84 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
@@ -122,24 +141,20 @@ static int pl061_to_irq(struct gpio_chip *gc, unsigned offset)
122{ 141{
123 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); 142 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
124 143
125 if (chip->irq_base <= 0) 144 return irq_create_mapping(chip->domain, offset);
126 return -EINVAL;
127
128 return chip->irq_base + offset;
129} 145}
130 146
131static int pl061_irq_type(struct irq_data *d, unsigned trigger) 147static int pl061_irq_type(struct irq_data *d, unsigned trigger)
132{ 148{
133 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 149 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
134 struct pl061_gpio *chip = gc->private; 150 int offset = irqd_to_hwirq(d);
135 int offset = d->irq - chip->irq_base;
136 unsigned long flags; 151 unsigned long flags;
137 u8 gpiois, gpioibe, gpioiev; 152 u8 gpiois, gpioibe, gpioiev;
138 153
139 if (offset < 0 || offset >= PL061_GPIO_NR) 154 if (offset < 0 || offset >= PL061_GPIO_NR)
140 return -EINVAL; 155 return -EINVAL;
141 156
142 raw_spin_lock_irqsave(&gc->lock, flags); 157 spin_lock_irqsave(&chip->lock, flags);
143 158
144 gpioiev = readb(chip->base + GPIOIEV); 159 gpioiev = readb(chip->base + GPIOIEV);
145 160
@@ -168,7 +183,7 @@ static int pl061_irq_type(struct irq_data *d, unsigned trigger)
168 183
169 writeb(gpioiev, chip->base + GPIOIEV); 184 writeb(gpioiev, chip->base + GPIOIEV);
170 185
171 raw_spin_unlock_irqrestore(&gc->lock, flags); 186 spin_unlock_irqrestore(&chip->lock, flags);
172 187
173 return 0; 188 return 0;
174} 189}
@@ -192,31 +207,61 @@ static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
192 chained_irq_exit(irqchip, desc); 207 chained_irq_exit(irqchip, desc);
193} 208}
194 209
195static void __init pl061_init_gc(struct pl061_gpio *chip, int irq_base) 210static void pl061_irq_mask(struct irq_data *d)
211{
212 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
213 u8 mask = 1 << (irqd_to_hwirq(d) % PL061_GPIO_NR);
214 u8 gpioie;
215
216 spin_lock(&chip->lock);
217 gpioie = readb(chip->base + GPIOIE) & ~mask;
218 writeb(gpioie, chip->base + GPIOIE);
219 spin_unlock(&chip->lock);
220}
221
222static void pl061_irq_unmask(struct irq_data *d)
196{ 223{
197 struct irq_chip_type *ct; 224 struct pl061_gpio *chip = irq_data_get_irq_chip_data(d);
225 u8 mask = 1 << (irqd_to_hwirq(d) % PL061_GPIO_NR);
226 u8 gpioie;
227
228 spin_lock(&chip->lock);
229 gpioie = readb(chip->base + GPIOIE) | mask;
230 writeb(gpioie, chip->base + GPIOIE);
231 spin_unlock(&chip->lock);
232}
233
234static struct irq_chip pl061_irqchip = {
235 .name = "pl061 gpio",
236 .irq_mask = pl061_irq_mask,
237 .irq_unmask = pl061_irq_unmask,
238 .irq_set_type = pl061_irq_type,
239};
198 240
199 chip->irq_gc = irq_alloc_generic_chip("gpio-pl061", 1, irq_base, 241static int pl061_irq_map(struct irq_domain *d, unsigned int virq,
200 chip->base, handle_simple_irq); 242 irq_hw_number_t hw)
201 chip->irq_gc->private = chip; 243{
244 struct pl061_gpio *chip = d->host_data;
202 245
203 ct = chip->irq_gc->chip_types; 246 irq_set_chip_and_handler_name(virq, &pl061_irqchip, handle_simple_irq,
204 ct->chip.irq_mask = irq_gc_mask_clr_bit; 247 "pl061");
205 ct->chip.irq_unmask = irq_gc_mask_set_bit; 248 irq_set_chip_data(virq, chip);
206 ct->chip.irq_set_type = pl061_irq_type; 249 irq_set_irq_type(virq, IRQ_TYPE_NONE);
207 ct->chip.irq_set_wake = irq_gc_set_wake;
208 ct->regs.mask = GPIOIE;
209 250
210 irq_setup_generic_chip(chip->irq_gc, IRQ_MSK(PL061_GPIO_NR), 251 return 0;
211 IRQ_GC_INIT_NESTED_LOCK, IRQ_NOREQUEST, 0);
212} 252}
213 253
254static const struct irq_domain_ops pl061_domain_ops = {
255 .map = pl061_irq_map,
256 .xlate = irq_domain_xlate_twocell,
257};
258
214static int pl061_probe(struct amba_device *adev, const struct amba_id *id) 259static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
215{ 260{
216 struct device *dev = &adev->dev; 261 struct device *dev = &adev->dev;
217 struct pl061_platform_data *pdata = dev->platform_data; 262 struct pl061_platform_data *pdata = dev->platform_data;
218 struct pl061_gpio *chip; 263 struct pl061_gpio *chip;
219 int ret, irq, i; 264 int ret, irq, i, irq_base;
220 265
221 chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL); 266 chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
222 if (chip == NULL) 267 if (chip == NULL)
@@ -224,24 +269,32 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
224 269
225 if (pdata) { 270 if (pdata) {
226 chip->gc.base = pdata->gpio_base; 271 chip->gc.base = pdata->gpio_base;
227 chip->irq_base = pdata->irq_base; 272 irq_base = pdata->irq_base;
228 } else if (adev->dev.of_node) { 273 if (irq_base <= 0)
274 return -ENODEV;
275 } else {
229 chip->gc.base = -1; 276 chip->gc.base = -1;
230 chip->irq_base = 0; 277 irq_base = 0;
231 } else 278 }
232 return -ENODEV;
233 279
234 if (!devm_request_mem_region(dev, adev->res.start, 280 if (!devm_request_mem_region(dev, adev->res.start,
235 resource_size(&adev->res), "pl061")) 281 resource_size(&adev->res), "pl061"))
236 return -EBUSY; 282 return -EBUSY;
237 283
238 chip->base = devm_ioremap(dev, adev->res.start, 284 chip->base = devm_ioremap(dev, adev->res.start,
239 resource_size(&adev->res)); 285 resource_size(&adev->res));
240 if (chip->base == NULL) 286 if (!chip->base)
241 return -ENOMEM; 287 return -ENOMEM;
242 288
289 chip->domain = irq_domain_add_simple(adev->dev.of_node, PL061_GPIO_NR,
290 irq_base, &pl061_domain_ops, chip);
291 if (!chip->domain)
292 return -ENODEV;
293
243 spin_lock_init(&chip->lock); 294 spin_lock_init(&chip->lock);
244 295
296 chip->gc.request = pl061_gpio_request;
297 chip->gc.free = pl061_gpio_free;
245 chip->gc.direction_input = pl061_direction_input; 298 chip->gc.direction_input = pl061_direction_input;
246 chip->gc.direction_output = pl061_direction_output; 299 chip->gc.direction_output = pl061_direction_output;
247 chip->gc.get = pl061_get_value; 300 chip->gc.get = pl061_get_value;
@@ -259,12 +312,6 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
259 /* 312 /*
260 * irq_chip support 313 * irq_chip support
261 */ 314 */
262
263 if (chip->irq_base <= 0)
264 return 0;
265
266 pl061_init_gc(chip, chip->irq_base);
267
268 writeb(0, chip->base + GPIOIE); /* disable irqs */ 315 writeb(0, chip->base + GPIOIE); /* disable irqs */
269 irq = adev->irq[0]; 316 irq = adev->irq[0];
270 if (irq < 0) 317 if (irq < 0)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 5150df6cba08..465f4ca57e80 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -203,22 +203,11 @@ static void of_gpiochip_add_pin_range(struct gpio_chip *chip)
203 if (!pctldev) 203 if (!pctldev)
204 break; 204 break;
205 205
206 /*
207 * This assumes that the n GPIO pins are consecutive in the
208 * GPIO number space, and that the pins are also consecutive
209 * in their local number space. Currently it is not possible
210 * to add different ranges for one and the same GPIO chip,
211 * as the code assumes that we have one consecutive range
212 * on both, mapping 1-to-1.
213 *
214 * TODO: make the OF bindings handle multiple sparse ranges
215 * on the same GPIO chip.
216 */
217 ret = gpiochip_add_pin_range(chip, 206 ret = gpiochip_add_pin_range(chip,
218 pinctrl_dev_get_devname(pctldev), 207 pinctrl_dev_get_devname(pctldev),
219 0, /* offset in gpiochip */
220 pinspec.args[0], 208 pinspec.args[0],
221 pinspec.args[1]); 209 pinspec.args[1],
210 pinspec.args[2]);
222 211
223 if (ret) 212 if (ret)
224 break; 213 break;
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 34f51d2d90d2..f910962baaa7 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -106,20 +106,11 @@ config PINCTRL_LANTIQ
106 select PINMUX 106 select PINMUX
107 select PINCONF 107 select PINCONF
108 108
109config PINCTRL_PXA3xx
110 bool
111 select PINMUX
112
113config PINCTRL_FALCON 109config PINCTRL_FALCON
114 bool 110 bool
115 depends on SOC_FALCON 111 depends on SOC_FALCON
116 depends on PINCTRL_LANTIQ 112 depends on PINCTRL_LANTIQ
117 113
118config PINCTRL_MMP2
119 bool "MMP2 pin controller driver"
120 depends on ARCH_MMP
121 select PINCTRL_PXA3xx
122
123config PINCTRL_MXS 114config PINCTRL_MXS
124 bool 115 bool
125 select PINMUX 116 select PINMUX
@@ -151,21 +142,12 @@ config PINCTRL_DB8540
151 bool "DB8540 pin controller driver" 142 bool "DB8540 pin controller driver"
152 depends on PINCTRL_NOMADIK && ARCH_U8500 143 depends on PINCTRL_NOMADIK && ARCH_U8500
153 144
154config PINCTRL_PXA168
155 bool "PXA168 pin controller driver"
156 depends on ARCH_MMP
157 select PINCTRL_PXA3xx
158
159config PINCTRL_PXA910
160 bool "PXA910 pin controller driver"
161 depends on ARCH_MMP
162 select PINCTRL_PXA3xx
163
164config PINCTRL_SINGLE 145config PINCTRL_SINGLE
165 tristate "One-register-per-pin type device tree based pinctrl driver" 146 tristate "One-register-per-pin type device tree based pinctrl driver"
166 depends on OF 147 depends on OF
167 select PINMUX 148 select PINMUX
168 select PINCONF 149 select PINCONF
150 select GENERIC_PINCONF
169 help 151 help
170 This selects the device tree based generic pinctrl driver. 152 This selects the device tree based generic pinctrl driver.
171 153
@@ -226,6 +208,11 @@ config PINCTRL_EXYNOS5440
226 select PINMUX 208 select PINMUX
227 select PINCONF 209 select PINCONF
228 210
211config PINCTRL_S3C64XX
212 bool "Samsung S3C64XX SoC pinctrl driver"
213 depends on ARCH_S3C64XX
214 select PINCTRL_SAMSUNG
215
229source "drivers/pinctrl/mvebu/Kconfig" 216source "drivers/pinctrl/mvebu/Kconfig"
230source "drivers/pinctrl/sh-pfc/Kconfig" 217source "drivers/pinctrl/sh-pfc/Kconfig"
231source "drivers/pinctrl/spear/Kconfig" 218source "drivers/pinctrl/spear/Kconfig"
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index f82cc5baf767..988279ae23cd 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -21,9 +21,7 @@ obj-$(CONFIG_PINCTRL_IMX35) += pinctrl-imx35.o
21obj-$(CONFIG_PINCTRL_IMX51) += pinctrl-imx51.o 21obj-$(CONFIG_PINCTRL_IMX51) += pinctrl-imx51.o
22obj-$(CONFIG_PINCTRL_IMX53) += pinctrl-imx53.o 22obj-$(CONFIG_PINCTRL_IMX53) += pinctrl-imx53.o
23obj-$(CONFIG_PINCTRL_IMX6Q) += pinctrl-imx6q.o 23obj-$(CONFIG_PINCTRL_IMX6Q) += pinctrl-imx6q.o
24obj-$(CONFIG_PINCTRL_PXA3xx) += pinctrl-pxa3xx.o
25obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o 24obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o
26obj-$(CONFIG_PINCTRL_MMP2) += pinctrl-mmp2.o
27obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o 25obj-$(CONFIG_PINCTRL_MXS) += pinctrl-mxs.o
28obj-$(CONFIG_PINCTRL_IMX23) += pinctrl-imx23.o 26obj-$(CONFIG_PINCTRL_IMX23) += pinctrl-imx23.o
29obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o 27obj-$(CONFIG_PINCTRL_IMX28) += pinctrl-imx28.o
@@ -31,8 +29,6 @@ obj-$(CONFIG_PINCTRL_NOMADIK) += pinctrl-nomadik.o
31obj-$(CONFIG_PINCTRL_STN8815) += pinctrl-nomadik-stn8815.o 29obj-$(CONFIG_PINCTRL_STN8815) += pinctrl-nomadik-stn8815.o
32obj-$(CONFIG_PINCTRL_DB8500) += pinctrl-nomadik-db8500.o 30obj-$(CONFIG_PINCTRL_DB8500) += pinctrl-nomadik-db8500.o
33obj-$(CONFIG_PINCTRL_DB8540) += pinctrl-nomadik-db8540.o 31obj-$(CONFIG_PINCTRL_DB8540) += pinctrl-nomadik-db8540.o
34obj-$(CONFIG_PINCTRL_PXA168) += pinctrl-pxa168.o
35obj-$(CONFIG_PINCTRL_PXA910) += pinctrl-pxa910.o
36obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o 32obj-$(CONFIG_PINCTRL_SINGLE) += pinctrl-single.o
37obj-$(CONFIG_PINCTRL_SIRF) += pinctrl-sirf.o 33obj-$(CONFIG_PINCTRL_SIRF) += pinctrl-sirf.o
38obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sunxi.o 34obj-$(CONFIG_PINCTRL_SUNXI) += pinctrl-sunxi.o
@@ -45,6 +41,7 @@ obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o
45obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o 41obj-$(CONFIG_PINCTRL_SAMSUNG) += pinctrl-samsung.o
46obj-$(CONFIG_PINCTRL_EXYNOS) += pinctrl-exynos.o 42obj-$(CONFIG_PINCTRL_EXYNOS) += pinctrl-exynos.o
47obj-$(CONFIG_PINCTRL_EXYNOS5440) += pinctrl-exynos5440.o 43obj-$(CONFIG_PINCTRL_EXYNOS5440) += pinctrl-exynos5440.o
44obj-$(CONFIG_PINCTRL_S3C64XX) += pinctrl-s3c64xx.o
48obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o 45obj-$(CONFIG_PINCTRL_XWAY) += pinctrl-xway.o
49obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o 46obj-$(CONFIG_PINCTRL_LANTIQ) += pinctrl-lantiq.o
50 47
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index b0de6e7f1fdb..c3d222ed39a2 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -27,6 +27,11 @@
27#include <linux/pinctrl/consumer.h> 27#include <linux/pinctrl/consumer.h>
28#include <linux/pinctrl/pinctrl.h> 28#include <linux/pinctrl/pinctrl.h>
29#include <linux/pinctrl/machine.h> 29#include <linux/pinctrl/machine.h>
30
31#ifdef CONFIG_GPIOLIB
32#include <asm-generic/gpio.h>
33#endif
34
30#include "core.h" 35#include "core.h"
31#include "devicetree.h" 36#include "devicetree.h"
32#include "pinmux.h" 37#include "pinmux.h"
@@ -35,11 +40,17 @@
35 40
36static bool pinctrl_dummy_state; 41static bool pinctrl_dummy_state;
37 42
38/* Mutex taken by all entry points */ 43/* Mutex taken to protect pinctrl_list */
39DEFINE_MUTEX(pinctrl_mutex); 44DEFINE_MUTEX(pinctrl_list_mutex);
45
46/* Mutex taken to protect pinctrl_maps */
47DEFINE_MUTEX(pinctrl_maps_mutex);
48
49/* Mutex taken to protect pinctrldev_list */
50DEFINE_MUTEX(pinctrldev_list_mutex);
40 51
41/* Global list of pin control devices (struct pinctrl_dev) */ 52/* Global list of pin control devices (struct pinctrl_dev) */
42LIST_HEAD(pinctrldev_list); 53static LIST_HEAD(pinctrldev_list);
43 54
44/* List of pin controller handles (struct pinctrl) */ 55/* List of pin controller handles (struct pinctrl) */
45static LIST_HEAD(pinctrl_list); 56static LIST_HEAD(pinctrl_list);
@@ -106,6 +117,23 @@ struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *devname)
106 return found ? pctldev : NULL; 117 return found ? pctldev : NULL;
107} 118}
108 119
120struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np)
121{
122 struct pinctrl_dev *pctldev;
123
124 mutex_lock(&pinctrldev_list_mutex);
125
126 list_for_each_entry(pctldev, &pinctrldev_list, node)
127 if (pctldev->dev->of_node == np) {
128 mutex_unlock(&pinctrldev_list_mutex);
129 return pctldev;
130 }
131
132 mutex_lock(&pinctrldev_list_mutex);
133
134 return NULL;
135}
136
109/** 137/**
110 * pin_get_from_name() - look up a pin number from a name 138 * pin_get_from_name() - look up a pin number from a name
111 * @pctldev: the pin control device to lookup the pin on 139 * @pctldev: the pin control device to lookup the pin on
@@ -165,9 +193,9 @@ bool pin_is_valid(struct pinctrl_dev *pctldev, int pin)
165 if (pin < 0) 193 if (pin < 0)
166 return false; 194 return false;
167 195
168 mutex_lock(&pinctrl_mutex); 196 mutex_lock(&pctldev->mutex);
169 pindesc = pin_desc_get(pctldev, pin); 197 pindesc = pin_desc_get(pctldev, pin);
170 mutex_unlock(&pinctrl_mutex); 198 mutex_unlock(&pctldev->mutex);
171 199
172 return pindesc != NULL; 200 return pindesc != NULL;
173} 201}
@@ -264,19 +292,58 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
264{ 292{
265 struct pinctrl_gpio_range *range = NULL; 293 struct pinctrl_gpio_range *range = NULL;
266 294
295 mutex_lock(&pctldev->mutex);
267 /* Loop over the ranges */ 296 /* Loop over the ranges */
268 list_for_each_entry(range, &pctldev->gpio_ranges, node) { 297 list_for_each_entry(range, &pctldev->gpio_ranges, node) {
269 /* Check if we're in the valid range */ 298 /* Check if we're in the valid range */
270 if (gpio >= range->base && 299 if (gpio >= range->base &&
271 gpio < range->base + range->npins) { 300 gpio < range->base + range->npins) {
301 mutex_unlock(&pctldev->mutex);
272 return range; 302 return range;
273 } 303 }
274 } 304 }
275 305 mutex_unlock(&pctldev->mutex);
276 return NULL; 306 return NULL;
277} 307}
278 308
279/** 309/**
310 * pinctrl_ready_for_gpio_range() - check if other GPIO pins of
311 * the same GPIO chip are in range
312 * @gpio: gpio pin to check taken from the global GPIO pin space
313 *
314 * This function is complement of pinctrl_match_gpio_range(). If the return
315 * value of pinctrl_match_gpio_range() is NULL, this function could be used
316 * to check whether pinctrl device is ready or not. Maybe some GPIO pins
317 * of the same GPIO chip don't have back-end pinctrl interface.
318 * If the return value is true, it means that pinctrl device is ready & the
319 * certain GPIO pin doesn't have back-end pinctrl device. If the return value
320 * is false, it means that pinctrl device may not be ready.
321 */
322#ifdef CONFIG_GPIOLIB
323static bool pinctrl_ready_for_gpio_range(unsigned gpio)
324{
325 struct pinctrl_dev *pctldev;
326 struct pinctrl_gpio_range *range = NULL;
327 struct gpio_chip *chip = gpio_to_chip(gpio);
328
329 /* Loop over the pin controllers */
330 list_for_each_entry(pctldev, &pinctrldev_list, node) {
331 /* Loop over the ranges */
332 list_for_each_entry(range, &pctldev->gpio_ranges, node) {
333 /* Check if any gpio range overlapped with gpio chip */
334 if (range->base + range->npins - 1 < chip->base ||
335 range->base > chip->base + chip->ngpio - 1)
336 continue;
337 return true;
338 }
339 }
340 return false;
341}
342#else
343static bool pinctrl_ready_for_gpio_range(unsigned gpio) { return true; }
344#endif
345
346/**
280 * pinctrl_get_device_gpio_range() - find device for GPIO range 347 * pinctrl_get_device_gpio_range() - find device for GPIO range
281 * @gpio: the pin to locate the pin controller for 348 * @gpio: the pin to locate the pin controller for
282 * @outdev: the pin control device if found 349 * @outdev: the pin control device if found
@@ -319,9 +386,9 @@ static int pinctrl_get_device_gpio_range(unsigned gpio,
319void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev, 386void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev,
320 struct pinctrl_gpio_range *range) 387 struct pinctrl_gpio_range *range)
321{ 388{
322 mutex_lock(&pinctrl_mutex); 389 mutex_lock(&pctldev->mutex);
323 list_add_tail(&range->node, &pctldev->gpio_ranges); 390 list_add_tail(&range->node, &pctldev->gpio_ranges);
324 mutex_unlock(&pinctrl_mutex); 391 mutex_unlock(&pctldev->mutex);
325} 392}
326EXPORT_SYMBOL_GPL(pinctrl_add_gpio_range); 393EXPORT_SYMBOL_GPL(pinctrl_add_gpio_range);
327 394
@@ -339,17 +406,25 @@ EXPORT_SYMBOL_GPL(pinctrl_add_gpio_ranges);
339struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname, 406struct pinctrl_dev *pinctrl_find_and_add_gpio_range(const char *devname,
340 struct pinctrl_gpio_range *range) 407 struct pinctrl_gpio_range *range)
341{ 408{
342 struct pinctrl_dev *pctldev = get_pinctrl_dev_from_devname(devname); 409 struct pinctrl_dev *pctldev;
410
411 mutex_lock(&pinctrldev_list_mutex);
412
413 pctldev = get_pinctrl_dev_from_devname(devname);
343 414
344 /* 415 /*
345 * If we can't find this device, let's assume that is because 416 * If we can't find this device, let's assume that is because
346 * it has not probed yet, so the driver trying to register this 417 * it has not probed yet, so the driver trying to register this
347 * range need to defer probing. 418 * range need to defer probing.
348 */ 419 */
349 if (!pctldev) 420 if (!pctldev) {
421 mutex_unlock(&pinctrldev_list_mutex);
350 return ERR_PTR(-EPROBE_DEFER); 422 return ERR_PTR(-EPROBE_DEFER);
351 423 }
352 pinctrl_add_gpio_range(pctldev, range); 424 pinctrl_add_gpio_range(pctldev, range);
425
426 mutex_unlock(&pinctrldev_list_mutex);
427
353 return pctldev; 428 return pctldev;
354} 429}
355EXPORT_SYMBOL_GPL(pinctrl_find_and_add_gpio_range); 430EXPORT_SYMBOL_GPL(pinctrl_find_and_add_gpio_range);
@@ -365,14 +440,17 @@ pinctrl_find_gpio_range_from_pin(struct pinctrl_dev *pctldev,
365{ 440{
366 struct pinctrl_gpio_range *range = NULL; 441 struct pinctrl_gpio_range *range = NULL;
367 442
443 mutex_lock(&pctldev->mutex);
368 /* Loop over the ranges */ 444 /* Loop over the ranges */
369 list_for_each_entry(range, &pctldev->gpio_ranges, node) { 445 list_for_each_entry(range, &pctldev->gpio_ranges, node) {
370 /* Check if we're in the valid range */ 446 /* Check if we're in the valid range */
371 if (pin >= range->pin_base && 447 if (pin >= range->pin_base &&
372 pin < range->pin_base + range->npins) { 448 pin < range->pin_base + range->npins) {
449 mutex_unlock(&pctldev->mutex);
373 return range; 450 return range;
374 } 451 }
375 } 452 }
453 mutex_unlock(&pctldev->mutex);
376 454
377 return NULL; 455 return NULL;
378} 456}
@@ -386,9 +464,9 @@ EXPORT_SYMBOL_GPL(pinctrl_find_gpio_range_from_pin);
386void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev, 464void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev,
387 struct pinctrl_gpio_range *range) 465 struct pinctrl_gpio_range *range)
388{ 466{
389 mutex_lock(&pinctrl_mutex); 467 mutex_lock(&pctldev->mutex);
390 list_del(&range->node); 468 list_del(&range->node);
391 mutex_unlock(&pinctrl_mutex); 469 mutex_unlock(&pctldev->mutex);
392} 470}
393EXPORT_SYMBOL_GPL(pinctrl_remove_gpio_range); 471EXPORT_SYMBOL_GPL(pinctrl_remove_gpio_range);
394 472
@@ -439,11 +517,13 @@ int pinctrl_request_gpio(unsigned gpio)
439 int ret; 517 int ret;
440 int pin; 518 int pin;
441 519
442 mutex_lock(&pinctrl_mutex); 520 mutex_lock(&pinctrldev_list_mutex);
443 521
444 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); 522 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
445 if (ret) { 523 if (ret) {
446 mutex_unlock(&pinctrl_mutex); 524 if (pinctrl_ready_for_gpio_range(gpio))
525 ret = 0;
526 mutex_unlock(&pinctrldev_list_mutex);
447 return ret; 527 return ret;
448 } 528 }
449 529
@@ -452,7 +532,7 @@ int pinctrl_request_gpio(unsigned gpio)
452 532
453 ret = pinmux_request_gpio(pctldev, range, pin, gpio); 533 ret = pinmux_request_gpio(pctldev, range, pin, gpio);
454 534
455 mutex_unlock(&pinctrl_mutex); 535 mutex_unlock(&pinctrldev_list_mutex);
456 return ret; 536 return ret;
457} 537}
458EXPORT_SYMBOL_GPL(pinctrl_request_gpio); 538EXPORT_SYMBOL_GPL(pinctrl_request_gpio);
@@ -472,20 +552,22 @@ void pinctrl_free_gpio(unsigned gpio)
472 int ret; 552 int ret;
473 int pin; 553 int pin;
474 554
475 mutex_lock(&pinctrl_mutex); 555 mutex_lock(&pinctrldev_list_mutex);
476 556
477 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); 557 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
478 if (ret) { 558 if (ret) {
479 mutex_unlock(&pinctrl_mutex); 559 mutex_unlock(&pinctrldev_list_mutex);
480 return; 560 return;
481 } 561 }
562 mutex_lock(&pctldev->mutex);
482 563
483 /* Convert to the pin controllers number space */ 564 /* Convert to the pin controllers number space */
484 pin = gpio - range->base + range->pin_base; 565 pin = gpio - range->base + range->pin_base;
485 566
486 pinmux_free_gpio(pctldev, pin, range); 567 pinmux_free_gpio(pctldev, pin, range);
487 568
488 mutex_unlock(&pinctrl_mutex); 569 mutex_unlock(&pctldev->mutex);
570 mutex_unlock(&pinctrldev_list_mutex);
489} 571}
490EXPORT_SYMBOL_GPL(pinctrl_free_gpio); 572EXPORT_SYMBOL_GPL(pinctrl_free_gpio);
491 573
@@ -496,14 +578,24 @@ static int pinctrl_gpio_direction(unsigned gpio, bool input)
496 int ret; 578 int ret;
497 int pin; 579 int pin;
498 580
581 mutex_lock(&pinctrldev_list_mutex);
582
499 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); 583 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
500 if (ret) 584 if (ret) {
585 mutex_unlock(&pinctrldev_list_mutex);
501 return ret; 586 return ret;
587 }
588
589 mutex_lock(&pctldev->mutex);
502 590
503 /* Convert to the pin controllers number space */ 591 /* Convert to the pin controllers number space */
504 pin = gpio - range->base + range->pin_base; 592 pin = gpio - range->base + range->pin_base;
593 ret = pinmux_gpio_direction(pctldev, range, pin, input);
594
595 mutex_unlock(&pctldev->mutex);
596 mutex_unlock(&pinctrldev_list_mutex);
505 597
506 return pinmux_gpio_direction(pctldev, range, pin, input); 598 return ret;
507} 599}
508 600
509/** 601/**
@@ -516,11 +608,7 @@ static int pinctrl_gpio_direction(unsigned gpio, bool input)
516 */ 608 */
517int pinctrl_gpio_direction_input(unsigned gpio) 609int pinctrl_gpio_direction_input(unsigned gpio)
518{ 610{
519 int ret; 611 return pinctrl_gpio_direction(gpio, true);
520 mutex_lock(&pinctrl_mutex);
521 ret = pinctrl_gpio_direction(gpio, true);
522 mutex_unlock(&pinctrl_mutex);
523 return ret;
524} 612}
525EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input); 613EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
526 614
@@ -534,11 +622,7 @@ EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
534 */ 622 */
535int pinctrl_gpio_direction_output(unsigned gpio) 623int pinctrl_gpio_direction_output(unsigned gpio)
536{ 624{
537 int ret; 625 return pinctrl_gpio_direction(gpio, false);
538 mutex_lock(&pinctrl_mutex);
539 ret = pinctrl_gpio_direction(gpio, false);
540 mutex_unlock(&pinctrl_mutex);
541 return ret;
542} 626}
543EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output); 627EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
544 628
@@ -641,14 +725,18 @@ static struct pinctrl *find_pinctrl(struct device *dev)
641{ 725{
642 struct pinctrl *p; 726 struct pinctrl *p;
643 727
728 mutex_lock(&pinctrl_list_mutex);
644 list_for_each_entry(p, &pinctrl_list, node) 729 list_for_each_entry(p, &pinctrl_list, node)
645 if (p->dev == dev) 730 if (p->dev == dev) {
731 mutex_unlock(&pinctrl_list_mutex);
646 return p; 732 return p;
733 }
647 734
735 mutex_unlock(&pinctrl_list_mutex);
648 return NULL; 736 return NULL;
649} 737}
650 738
651static void pinctrl_put_locked(struct pinctrl *p, bool inlist); 739static void pinctrl_free(struct pinctrl *p, bool inlist);
652 740
653static struct pinctrl *create_pinctrl(struct device *dev) 741static struct pinctrl *create_pinctrl(struct device *dev)
654{ 742{
@@ -681,6 +769,7 @@ static struct pinctrl *create_pinctrl(struct device *dev)
681 769
682 devname = dev_name(dev); 770 devname = dev_name(dev);
683 771
772 mutex_lock(&pinctrl_maps_mutex);
684 /* Iterate over the pin control maps to locate the right ones */ 773 /* Iterate over the pin control maps to locate the right ones */
685 for_each_maps(maps_node, i, map) { 774 for_each_maps(maps_node, i, map) {
686 /* Map must be for this device */ 775 /* Map must be for this device */
@@ -702,13 +791,16 @@ static struct pinctrl *create_pinctrl(struct device *dev)
702 * an -EPROBE_DEFER later, as that is the worst case. 791 * an -EPROBE_DEFER later, as that is the worst case.
703 */ 792 */
704 if (ret == -EPROBE_DEFER) { 793 if (ret == -EPROBE_DEFER) {
705 pinctrl_put_locked(p, false); 794 pinctrl_free(p, false);
795 mutex_unlock(&pinctrl_maps_mutex);
706 return ERR_PTR(ret); 796 return ERR_PTR(ret);
707 } 797 }
708 } 798 }
799 mutex_unlock(&pinctrl_maps_mutex);
800
709 if (ret < 0) { 801 if (ret < 0) {
710 /* If some other error than deferral occured, return here */ 802 /* If some other error than deferral occured, return here */
711 pinctrl_put_locked(p, false); 803 pinctrl_free(p, false);
712 return ERR_PTR(ret); 804 return ERR_PTR(ret);
713 } 805 }
714 806
@@ -720,7 +812,11 @@ static struct pinctrl *create_pinctrl(struct device *dev)
720 return p; 812 return p;
721} 813}
722 814
723static struct pinctrl *pinctrl_get_locked(struct device *dev) 815/**
816 * pinctrl_get() - retrieves the pinctrl handle for a device
817 * @dev: the device to obtain the handle for
818 */
819struct pinctrl *pinctrl_get(struct device *dev)
724{ 820{
725 struct pinctrl *p; 821 struct pinctrl *p;
726 822
@@ -741,43 +837,35 @@ static struct pinctrl *pinctrl_get_locked(struct device *dev)
741 837
742 return create_pinctrl(dev); 838 return create_pinctrl(dev);
743} 839}
840EXPORT_SYMBOL_GPL(pinctrl_get);
744 841
745/** 842static void pinctrl_free_setting(bool disable_setting,
746 * pinctrl_get() - retrieves the pinctrl handle for a device 843 struct pinctrl_setting *setting)
747 * @dev: the device to obtain the handle for
748 */
749struct pinctrl *pinctrl_get(struct device *dev)
750{ 844{
751 struct pinctrl *p; 845 switch (setting->type) {
752 846 case PIN_MAP_TYPE_MUX_GROUP:
753 mutex_lock(&pinctrl_mutex); 847 if (disable_setting)
754 p = pinctrl_get_locked(dev); 848 pinmux_disable_setting(setting);
755 mutex_unlock(&pinctrl_mutex); 849 pinmux_free_setting(setting);
756 850 break;
757 return p; 851 case PIN_MAP_TYPE_CONFIGS_PIN:
852 case PIN_MAP_TYPE_CONFIGS_GROUP:
853 pinconf_free_setting(setting);
854 break;
855 default:
856 break;
857 }
758} 858}
759EXPORT_SYMBOL_GPL(pinctrl_get);
760 859
761static void pinctrl_put_locked(struct pinctrl *p, bool inlist) 860static void pinctrl_free(struct pinctrl *p, bool inlist)
762{ 861{
763 struct pinctrl_state *state, *n1; 862 struct pinctrl_state *state, *n1;
764 struct pinctrl_setting *setting, *n2; 863 struct pinctrl_setting *setting, *n2;
765 864
865 mutex_lock(&pinctrl_list_mutex);
766 list_for_each_entry_safe(state, n1, &p->states, node) { 866 list_for_each_entry_safe(state, n1, &p->states, node) {
767 list_for_each_entry_safe(setting, n2, &state->settings, node) { 867 list_for_each_entry_safe(setting, n2, &state->settings, node) {
768 switch (setting->type) { 868 pinctrl_free_setting(state == p->state, setting);
769 case PIN_MAP_TYPE_MUX_GROUP:
770 if (state == p->state)
771 pinmux_disable_setting(setting);
772 pinmux_free_setting(setting);
773 break;
774 case PIN_MAP_TYPE_CONFIGS_PIN:
775 case PIN_MAP_TYPE_CONFIGS_GROUP:
776 pinconf_free_setting(setting);
777 break;
778 default:
779 break;
780 }
781 list_del(&setting->node); 869 list_del(&setting->node);
782 kfree(setting); 870 kfree(setting);
783 } 871 }
@@ -790,6 +878,7 @@ static void pinctrl_put_locked(struct pinctrl *p, bool inlist)
790 if (inlist) 878 if (inlist)
791 list_del(&p->node); 879 list_del(&p->node);
792 kfree(p); 880 kfree(p);
881 mutex_unlock(&pinctrl_list_mutex);
793} 882}
794 883
795/** 884/**
@@ -800,7 +889,7 @@ static void pinctrl_release(struct kref *kref)
800{ 889{
801 struct pinctrl *p = container_of(kref, struct pinctrl, users); 890 struct pinctrl *p = container_of(kref, struct pinctrl, users);
802 891
803 pinctrl_put_locked(p, true); 892 pinctrl_free(p, true);
804} 893}
805 894
806/** 895/**
@@ -809,14 +898,17 @@ static void pinctrl_release(struct kref *kref)
809 */ 898 */
810void pinctrl_put(struct pinctrl *p) 899void pinctrl_put(struct pinctrl *p)
811{ 900{
812 mutex_lock(&pinctrl_mutex);
813 kref_put(&p->users, pinctrl_release); 901 kref_put(&p->users, pinctrl_release);
814 mutex_unlock(&pinctrl_mutex);
815} 902}
816EXPORT_SYMBOL_GPL(pinctrl_put); 903EXPORT_SYMBOL_GPL(pinctrl_put);
817 904
818static struct pinctrl_state *pinctrl_lookup_state_locked(struct pinctrl *p, 905/**
819 const char *name) 906 * pinctrl_lookup_state() - retrieves a state handle from a pinctrl handle
907 * @p: the pinctrl handle to retrieve the state from
908 * @name: the state name to retrieve
909 */
910struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p,
911 const char *name)
820{ 912{
821 struct pinctrl_state *state; 913 struct pinctrl_state *state;
822 914
@@ -833,28 +925,17 @@ static struct pinctrl_state *pinctrl_lookup_state_locked(struct pinctrl *p,
833 925
834 return state; 926 return state;
835} 927}
928EXPORT_SYMBOL_GPL(pinctrl_lookup_state);
836 929
837/** 930/**
838 * pinctrl_lookup_state() - retrieves a state handle from a pinctrl handle 931 * pinctrl_select_state() - select/activate/program a pinctrl state to HW
839 * @p: the pinctrl handle to retrieve the state from 932 * @p: the pinctrl handle for the device that requests configuration
840 * @name: the state name to retrieve 933 * @state: the state handle to select/activate/program
841 */ 934 */
842struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p, const char *name) 935int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
843{
844 struct pinctrl_state *s;
845
846 mutex_lock(&pinctrl_mutex);
847 s = pinctrl_lookup_state_locked(p, name);
848 mutex_unlock(&pinctrl_mutex);
849
850 return s;
851}
852EXPORT_SYMBOL_GPL(pinctrl_lookup_state);
853
854static int pinctrl_select_state_locked(struct pinctrl *p,
855 struct pinctrl_state *state)
856{ 936{
857 struct pinctrl_setting *setting, *setting2; 937 struct pinctrl_setting *setting, *setting2;
938 struct pinctrl_state *old_state = p->state;
858 int ret; 939 int ret;
859 940
860 if (p->state == state) 941 if (p->state == state)
@@ -888,7 +969,7 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
888 } 969 }
889 } 970 }
890 971
891 p->state = state; 972 p->state = NULL;
892 973
893 /* Apply all the settings for the new state */ 974 /* Apply all the settings for the new state */
894 list_for_each_entry(setting, &state->settings, node) { 975 list_for_each_entry(setting, &state->settings, node) {
@@ -904,27 +985,36 @@ static int pinctrl_select_state_locked(struct pinctrl *p,
904 ret = -EINVAL; 985 ret = -EINVAL;
905 break; 986 break;
906 } 987 }
988
907 if (ret < 0) { 989 if (ret < 0) {
908 /* FIXME: Difficult to return to prev state */ 990 goto unapply_new_state;
909 return ret;
910 } 991 }
911 } 992 }
912 993
994 p->state = state;
995
913 return 0; 996 return 0;
914}
915 997
916/** 998unapply_new_state:
917 * pinctrl_select() - select/activate/program a pinctrl state to HW 999 dev_err(p->dev, "Error applying setting, reverse things back\n");
918 * @p: the pinctrl handle for the device that requests configuratio
919 * @state: the state handle to select/activate/program
920 */
921int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
922{
923 int ret;
924 1000
925 mutex_lock(&pinctrl_mutex); 1001 list_for_each_entry(setting2, &state->settings, node) {
926 ret = pinctrl_select_state_locked(p, state); 1002 if (&setting2->node == &setting->node)
927 mutex_unlock(&pinctrl_mutex); 1003 break;
1004 /*
1005 * All we can do here is pinmux_disable_setting.
1006 * That means that some pins are muxed differently now
1007 * than they were before applying the setting (We can't
1008 * "unmux a pin"!), but it's not a big deal since the pins
1009 * are free to be muxed by another apply_setting.
1010 */
1011 if (setting2->type == PIN_MAP_TYPE_MUX_GROUP)
1012 pinmux_disable_setting(setting2);
1013 }
1014
1015 /* There's no infinite recursive loop here because p->state is NULL */
1016 if (old_state)
1017 pinctrl_select_state(p, old_state);
928 1018
929 return ret; 1019 return ret;
930} 1020}
@@ -979,9 +1069,8 @@ static int devm_pinctrl_match(struct device *dev, void *res, void *data)
979 */ 1069 */
980void devm_pinctrl_put(struct pinctrl *p) 1070void devm_pinctrl_put(struct pinctrl *p)
981{ 1071{
982 WARN_ON(devres_destroy(p->dev, devm_pinctrl_release, 1072 WARN_ON(devres_release(p->dev, devm_pinctrl_release,
983 devm_pinctrl_match, p)); 1073 devm_pinctrl_match, p));
984 pinctrl_put(p);
985} 1074}
986EXPORT_SYMBOL_GPL(devm_pinctrl_put); 1075EXPORT_SYMBOL_GPL(devm_pinctrl_put);
987 1076
@@ -1055,10 +1144,10 @@ int pinctrl_register_map(struct pinctrl_map const *maps, unsigned num_maps,
1055 } 1144 }
1056 1145
1057 if (!locked) 1146 if (!locked)
1058 mutex_lock(&pinctrl_mutex); 1147 mutex_lock(&pinctrl_maps_mutex);
1059 list_add_tail(&maps_node->node, &pinctrl_maps); 1148 list_add_tail(&maps_node->node, &pinctrl_maps);
1060 if (!locked) 1149 if (!locked)
1061 mutex_unlock(&pinctrl_mutex); 1150 mutex_unlock(&pinctrl_maps_mutex);
1062 1151
1063 return 0; 1152 return 0;
1064} 1153}
@@ -1080,12 +1169,15 @@ void pinctrl_unregister_map(struct pinctrl_map const *map)
1080{ 1169{
1081 struct pinctrl_maps *maps_node; 1170 struct pinctrl_maps *maps_node;
1082 1171
1172 mutex_lock(&pinctrl_maps_mutex);
1083 list_for_each_entry(maps_node, &pinctrl_maps, node) { 1173 list_for_each_entry(maps_node, &pinctrl_maps, node) {
1084 if (maps_node->maps == map) { 1174 if (maps_node->maps == map) {
1085 list_del(&maps_node->node); 1175 list_del(&maps_node->node);
1176 mutex_unlock(&pinctrl_maps_mutex);
1086 return; 1177 return;
1087 } 1178 }
1088 } 1179 }
1180 mutex_unlock(&pinctrl_maps_mutex);
1089} 1181}
1090 1182
1091/** 1183/**
@@ -1122,7 +1214,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
1122 1214
1123 seq_printf(s, "registered pins: %d\n", pctldev->desc->npins); 1215 seq_printf(s, "registered pins: %d\n", pctldev->desc->npins);
1124 1216
1125 mutex_lock(&pinctrl_mutex); 1217 mutex_lock(&pctldev->mutex);
1126 1218
1127 /* The pin number can be retrived from the pin controller descriptor */ 1219 /* The pin number can be retrived from the pin controller descriptor */
1128 for (i = 0; i < pctldev->desc->npins; i++) { 1220 for (i = 0; i < pctldev->desc->npins; i++) {
@@ -1144,7 +1236,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
1144 seq_puts(s, "\n"); 1236 seq_puts(s, "\n");
1145 } 1237 }
1146 1238
1147 mutex_unlock(&pinctrl_mutex); 1239 mutex_unlock(&pctldev->mutex);
1148 1240
1149 return 0; 1241 return 0;
1150} 1242}
@@ -1155,8 +1247,9 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
1155 const struct pinctrl_ops *ops = pctldev->desc->pctlops; 1247 const struct pinctrl_ops *ops = pctldev->desc->pctlops;
1156 unsigned ngroups, selector = 0; 1248 unsigned ngroups, selector = 0;
1157 1249
1250 mutex_lock(&pctldev->mutex);
1251
1158 ngroups = ops->get_groups_count(pctldev); 1252 ngroups = ops->get_groups_count(pctldev);
1159 mutex_lock(&pinctrl_mutex);
1160 1253
1161 seq_puts(s, "registered pin groups:\n"); 1254 seq_puts(s, "registered pin groups:\n");
1162 while (selector < ngroups) { 1255 while (selector < ngroups) {
@@ -1177,7 +1270,7 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
1177 for (i = 0; i < num_pins; i++) { 1270 for (i = 0; i < num_pins; i++) {
1178 pname = pin_get_name(pctldev, pins[i]); 1271 pname = pin_get_name(pctldev, pins[i]);
1179 if (WARN_ON(!pname)) { 1272 if (WARN_ON(!pname)) {
1180 mutex_unlock(&pinctrl_mutex); 1273 mutex_unlock(&pctldev->mutex);
1181 return -EINVAL; 1274 return -EINVAL;
1182 } 1275 }
1183 seq_printf(s, "pin %d (%s)\n", pins[i], pname); 1276 seq_printf(s, "pin %d (%s)\n", pins[i], pname);
@@ -1187,7 +1280,7 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
1187 selector++; 1280 selector++;
1188 } 1281 }
1189 1282
1190 mutex_unlock(&pinctrl_mutex); 1283 mutex_unlock(&pctldev->mutex);
1191 1284
1192 return 0; 1285 return 0;
1193} 1286}
@@ -1199,7 +1292,7 @@ static int pinctrl_gpioranges_show(struct seq_file *s, void *what)
1199 1292
1200 seq_puts(s, "GPIO ranges handled:\n"); 1293 seq_puts(s, "GPIO ranges handled:\n");
1201 1294
1202 mutex_lock(&pinctrl_mutex); 1295 mutex_lock(&pctldev->mutex);
1203 1296
1204 /* Loop over the ranges */ 1297 /* Loop over the ranges */
1205 list_for_each_entry(range, &pctldev->gpio_ranges, node) { 1298 list_for_each_entry(range, &pctldev->gpio_ranges, node) {
@@ -1210,7 +1303,7 @@ static int pinctrl_gpioranges_show(struct seq_file *s, void *what)
1210 (range->pin_base + range->npins - 1)); 1303 (range->pin_base + range->npins - 1));
1211 } 1304 }
1212 1305
1213 mutex_unlock(&pinctrl_mutex); 1306 mutex_unlock(&pctldev->mutex);
1214 1307
1215 return 0; 1308 return 0;
1216} 1309}
@@ -1221,7 +1314,7 @@ static int pinctrl_devices_show(struct seq_file *s, void *what)
1221 1314
1222 seq_puts(s, "name [pinmux] [pinconf]\n"); 1315 seq_puts(s, "name [pinmux] [pinconf]\n");
1223 1316
1224 mutex_lock(&pinctrl_mutex); 1317 mutex_lock(&pinctrldev_list_mutex);
1225 1318
1226 list_for_each_entry(pctldev, &pinctrldev_list, node) { 1319 list_for_each_entry(pctldev, &pinctrldev_list, node) {
1227 seq_printf(s, "%s ", pctldev->desc->name); 1320 seq_printf(s, "%s ", pctldev->desc->name);
@@ -1236,7 +1329,7 @@ static int pinctrl_devices_show(struct seq_file *s, void *what)
1236 seq_puts(s, "\n"); 1329 seq_puts(s, "\n");
1237 } 1330 }
1238 1331
1239 mutex_unlock(&pinctrl_mutex); 1332 mutex_unlock(&pinctrldev_list_mutex);
1240 1333
1241 return 0; 1334 return 0;
1242} 1335}
@@ -1265,8 +1358,7 @@ static int pinctrl_maps_show(struct seq_file *s, void *what)
1265 1358
1266 seq_puts(s, "Pinctrl maps:\n"); 1359 seq_puts(s, "Pinctrl maps:\n");
1267 1360
1268 mutex_lock(&pinctrl_mutex); 1361 mutex_lock(&pinctrl_maps_mutex);
1269
1270 for_each_maps(maps_node, i, map) { 1362 for_each_maps(maps_node, i, map) {
1271 seq_printf(s, "device %s\nstate %s\ntype %s (%d)\n", 1363 seq_printf(s, "device %s\nstate %s\ntype %s (%d)\n",
1272 map->dev_name, map->name, map_type(map->type), 1364 map->dev_name, map->name, map_type(map->type),
@@ -1290,8 +1382,7 @@ static int pinctrl_maps_show(struct seq_file *s, void *what)
1290 1382
1291 seq_printf(s, "\n"); 1383 seq_printf(s, "\n");
1292 } 1384 }
1293 1385 mutex_unlock(&pinctrl_maps_mutex);
1294 mutex_unlock(&pinctrl_mutex);
1295 1386
1296 return 0; 1387 return 0;
1297} 1388}
@@ -1304,7 +1395,7 @@ static int pinctrl_show(struct seq_file *s, void *what)
1304 1395
1305 seq_puts(s, "Requested pin control handlers their pinmux maps:\n"); 1396 seq_puts(s, "Requested pin control handlers their pinmux maps:\n");
1306 1397
1307 mutex_lock(&pinctrl_mutex); 1398 mutex_lock(&pinctrl_list_mutex);
1308 1399
1309 list_for_each_entry(p, &pinctrl_list, node) { 1400 list_for_each_entry(p, &pinctrl_list, node) {
1310 seq_printf(s, "device: %s current state: %s\n", 1401 seq_printf(s, "device: %s current state: %s\n",
@@ -1336,7 +1427,7 @@ static int pinctrl_show(struct seq_file *s, void *what)
1336 } 1427 }
1337 } 1428 }
1338 1429
1339 mutex_unlock(&pinctrl_mutex); 1430 mutex_unlock(&pinctrl_list_mutex);
1340 1431
1341 return 0; 1432 return 0;
1342} 1433}
@@ -1522,6 +1613,7 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
1522 INIT_RADIX_TREE(&pctldev->pin_desc_tree, GFP_KERNEL); 1613 INIT_RADIX_TREE(&pctldev->pin_desc_tree, GFP_KERNEL);
1523 INIT_LIST_HEAD(&pctldev->gpio_ranges); 1614 INIT_LIST_HEAD(&pctldev->gpio_ranges);
1524 pctldev->dev = dev; 1615 pctldev->dev = dev;
1616 mutex_init(&pctldev->mutex);
1525 1617
1526 /* check core ops for sanity */ 1618 /* check core ops for sanity */
1527 if (pinctrl_check_ops(pctldev)) { 1619 if (pinctrl_check_ops(pctldev)) {
@@ -1551,38 +1643,37 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
1551 goto out_err; 1643 goto out_err;
1552 } 1644 }
1553 1645
1554 mutex_lock(&pinctrl_mutex); 1646 mutex_lock(&pinctrldev_list_mutex);
1555
1556 list_add_tail(&pctldev->node, &pinctrldev_list); 1647 list_add_tail(&pctldev->node, &pinctrldev_list);
1648 mutex_unlock(&pinctrldev_list_mutex);
1649
1650 pctldev->p = pinctrl_get(pctldev->dev);
1557 1651
1558 pctldev->p = pinctrl_get_locked(pctldev->dev);
1559 if (!IS_ERR(pctldev->p)) { 1652 if (!IS_ERR(pctldev->p)) {
1560 pctldev->hog_default = 1653 pctldev->hog_default =
1561 pinctrl_lookup_state_locked(pctldev->p, 1654 pinctrl_lookup_state(pctldev->p, PINCTRL_STATE_DEFAULT);
1562 PINCTRL_STATE_DEFAULT);
1563 if (IS_ERR(pctldev->hog_default)) { 1655 if (IS_ERR(pctldev->hog_default)) {
1564 dev_dbg(dev, "failed to lookup the default state\n"); 1656 dev_dbg(dev, "failed to lookup the default state\n");
1565 } else { 1657 } else {
1566 if (pinctrl_select_state_locked(pctldev->p, 1658 if (pinctrl_select_state(pctldev->p,
1567 pctldev->hog_default)) 1659 pctldev->hog_default))
1568 dev_err(dev, 1660 dev_err(dev,
1569 "failed to select default state\n"); 1661 "failed to select default state\n");
1570 } 1662 }
1571 1663
1572 pctldev->hog_sleep = 1664 pctldev->hog_sleep =
1573 pinctrl_lookup_state_locked(pctldev->p, 1665 pinctrl_lookup_state(pctldev->p,
1574 PINCTRL_STATE_SLEEP); 1666 PINCTRL_STATE_SLEEP);
1575 if (IS_ERR(pctldev->hog_sleep)) 1667 if (IS_ERR(pctldev->hog_sleep))
1576 dev_dbg(dev, "failed to lookup the sleep state\n"); 1668 dev_dbg(dev, "failed to lookup the sleep state\n");
1577 } 1669 }
1578 1670
1579 mutex_unlock(&pinctrl_mutex);
1580
1581 pinctrl_init_device_debugfs(pctldev); 1671 pinctrl_init_device_debugfs(pctldev);
1582 1672
1583 return pctldev; 1673 return pctldev;
1584 1674
1585out_err: 1675out_err:
1676 mutex_destroy(&pctldev->mutex);
1586 kfree(pctldev); 1677 kfree(pctldev);
1587 return NULL; 1678 return NULL;
1588} 1679}
@@ -1600,12 +1691,13 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
1600 if (pctldev == NULL) 1691 if (pctldev == NULL)
1601 return; 1692 return;
1602 1693
1603 pinctrl_remove_device_debugfs(pctldev); 1694 mutex_lock(&pinctrldev_list_mutex);
1695 mutex_lock(&pctldev->mutex);
1604 1696
1605 mutex_lock(&pinctrl_mutex); 1697 pinctrl_remove_device_debugfs(pctldev);
1606 1698
1607 if (!IS_ERR(pctldev->p)) 1699 if (!IS_ERR(pctldev->p))
1608 pinctrl_put_locked(pctldev->p, true); 1700 pinctrl_put(pctldev->p);
1609 1701
1610 /* TODO: check that no pinmuxes are still active? */ 1702 /* TODO: check that no pinmuxes are still active? */
1611 list_del(&pctldev->node); 1703 list_del(&pctldev->node);
@@ -1616,9 +1708,10 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
1616 list_for_each_entry_safe(range, n, &pctldev->gpio_ranges, node) 1708 list_for_each_entry_safe(range, n, &pctldev->gpio_ranges, node)
1617 list_del(&range->node); 1709 list_del(&range->node);
1618 1710
1711 mutex_unlock(&pctldev->mutex);
1712 mutex_destroy(&pctldev->mutex);
1619 kfree(pctldev); 1713 kfree(pctldev);
1620 1714 mutex_unlock(&pinctrldev_list_mutex);
1621 mutex_unlock(&pinctrl_mutex);
1622} 1715}
1623EXPORT_SYMBOL_GPL(pinctrl_unregister); 1716EXPORT_SYMBOL_GPL(pinctrl_unregister);
1624 1717
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index ee72f1f6d862..75476b3d87da 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -33,6 +33,7 @@ struct pinctrl_gpio_range;
33 * @p: result of pinctrl_get() for this device 33 * @p: result of pinctrl_get() for this device
34 * @hog_default: default state for pins hogged by this device 34 * @hog_default: default state for pins hogged by this device
35 * @hog_sleep: sleep state for pins hogged by this device 35 * @hog_sleep: sleep state for pins hogged by this device
36 * @mutex: mutex taken on each pin controller specific action
36 * @device_root: debugfs root for this device 37 * @device_root: debugfs root for this device
37 */ 38 */
38struct pinctrl_dev { 39struct pinctrl_dev {
@@ -46,6 +47,7 @@ struct pinctrl_dev {
46 struct pinctrl *p; 47 struct pinctrl *p;
47 struct pinctrl_state *hog_default; 48 struct pinctrl_state *hog_default;
48 struct pinctrl_state *hog_sleep; 49 struct pinctrl_state *hog_sleep;
50 struct mutex mutex;
49#ifdef CONFIG_DEBUG_FS 51#ifdef CONFIG_DEBUG_FS
50 struct dentry *device_root; 52 struct dentry *device_root;
51#endif 53#endif
@@ -72,7 +74,7 @@ struct pinctrl {
72 74
73/** 75/**
74 * struct pinctrl_state - a pinctrl state for a device 76 * struct pinctrl_state - a pinctrl state for a device
75 * @node: list not for struct pinctrl's @states field 77 * @node: list node for struct pinctrl's @states field
76 * @name: the name of this state 78 * @name: the name of this state
77 * @settings: a list of settings for this state 79 * @settings: a list of settings for this state
78 */ 80 */
@@ -168,6 +170,7 @@ struct pinctrl_maps {
168}; 170};
169 171
170struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name); 172struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
173struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np);
171int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name); 174int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
172const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin); 175const char *pin_get_name(struct pinctrl_dev *pctldev, const unsigned pin);
173int pinctrl_get_group_selector(struct pinctrl_dev *pctldev, 176int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
@@ -186,8 +189,7 @@ void pinctrl_unregister_map(struct pinctrl_map const *map);
186extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev); 189extern int pinctrl_force_sleep(struct pinctrl_dev *pctldev);
187extern int pinctrl_force_default(struct pinctrl_dev *pctldev); 190extern int pinctrl_force_default(struct pinctrl_dev *pctldev);
188 191
189extern struct mutex pinctrl_mutex; 192extern struct mutex pinctrl_maps_mutex;
190extern struct list_head pinctrldev_list;
191extern struct list_head pinctrl_maps; 193extern struct list_head pinctrl_maps;
192 194
193#define for_each_maps(_maps_node_, _i_, _map_) \ 195#define for_each_maps(_maps_node_, _i_, _map_) \
diff --git a/drivers/pinctrl/devicetree.c b/drivers/pinctrl/devicetree.c
index fd40a11ad645..340fb4e6c600 100644
--- a/drivers/pinctrl/devicetree.c
+++ b/drivers/pinctrl/devicetree.c
@@ -41,7 +41,7 @@ static void dt_free_map(struct pinctrl_dev *pctldev,
41 struct pinctrl_map *map, unsigned num_maps) 41 struct pinctrl_map *map, unsigned num_maps)
42{ 42{
43 if (pctldev) { 43 if (pctldev) {
44 struct pinctrl_ops *ops = pctldev->desc->pctlops; 44 const struct pinctrl_ops *ops = pctldev->desc->pctlops;
45 ops->dt_free_map(pctldev, map, num_maps); 45 ops->dt_free_map(pctldev, map, num_maps);
46 } else { 46 } else {
47 /* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */ 47 /* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */
@@ -95,22 +95,11 @@ static int dt_remember_or_free_map(struct pinctrl *p, const char *statename,
95 return pinctrl_register_map(map, num_maps, false, true); 95 return pinctrl_register_map(map, num_maps, false, true);
96} 96}
97 97
98static struct pinctrl_dev *find_pinctrl_by_of_node(struct device_node *np)
99{
100 struct pinctrl_dev *pctldev;
101
102 list_for_each_entry(pctldev, &pinctrldev_list, node)
103 if (pctldev->dev->of_node == np)
104 return pctldev;
105
106 return NULL;
107}
108
109struct pinctrl_dev *of_pinctrl_get(struct device_node *np) 98struct pinctrl_dev *of_pinctrl_get(struct device_node *np)
110{ 99{
111 struct pinctrl_dev *pctldev; 100 struct pinctrl_dev *pctldev;
112 101
113 pctldev = find_pinctrl_by_of_node(np); 102 pctldev = get_pinctrl_dev_from_of_node(np);
114 if (!pctldev) 103 if (!pctldev)
115 return NULL; 104 return NULL;
116 105
@@ -122,7 +111,7 @@ static int dt_to_map_one_config(struct pinctrl *p, const char *statename,
122{ 111{
123 struct device_node *np_pctldev; 112 struct device_node *np_pctldev;
124 struct pinctrl_dev *pctldev; 113 struct pinctrl_dev *pctldev;
125 struct pinctrl_ops *ops; 114 const struct pinctrl_ops *ops;
126 int ret; 115 int ret;
127 struct pinctrl_map *map; 116 struct pinctrl_map *map;
128 unsigned num_maps; 117 unsigned num_maps;
@@ -138,7 +127,7 @@ static int dt_to_map_one_config(struct pinctrl *p, const char *statename,
138 /* OK let's just assume this will appear later then */ 127 /* OK let's just assume this will appear later then */
139 return -EPROBE_DEFER; 128 return -EPROBE_DEFER;
140 } 129 }
141 pctldev = find_pinctrl_by_of_node(np_pctldev); 130 pctldev = get_pinctrl_dev_from_of_node(np_pctldev);
142 if (pctldev) 131 if (pctldev)
143 break; 132 break;
144 /* Do not defer probing of hogs (circular loop) */ 133 /* Do not defer probing of hogs (circular loop) */
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 2d2f0a43d36b..bb7ddb1bc89f 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -263,7 +263,7 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
263 return; 263 return;
264} 264}
265 265
266static struct pinconf_ops mvebu_pinconf_ops = { 266static const struct pinconf_ops mvebu_pinconf_ops = {
267 .pin_config_group_get = mvebu_pinconf_group_get, 267 .pin_config_group_get = mvebu_pinconf_group_get,
268 .pin_config_group_set = mvebu_pinconf_group_set, 268 .pin_config_group_set = mvebu_pinconf_group_set,
269 .pin_config_group_dbg_show = mvebu_pinconf_group_dbg_show, 269 .pin_config_group_dbg_show = mvebu_pinconf_group_dbg_show,
@@ -369,7 +369,7 @@ static int mvebu_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
369 return -ENOTSUPP; 369 return -ENOTSUPP;
370} 370}
371 371
372static struct pinmux_ops mvebu_pinmux_ops = { 372static const struct pinmux_ops mvebu_pinmux_ops = {
373 .get_functions_count = mvebu_pinmux_get_funcs_count, 373 .get_functions_count = mvebu_pinmux_get_funcs_count,
374 .get_function_name = mvebu_pinmux_get_func_name, 374 .get_function_name = mvebu_pinmux_get_func_name,
375 .get_function_groups = mvebu_pinmux_get_groups, 375 .get_function_groups = mvebu_pinmux_get_groups,
@@ -470,7 +470,7 @@ static void mvebu_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
470 kfree(map); 470 kfree(map);
471} 471}
472 472
473static struct pinctrl_ops mvebu_pinctrl_ops = { 473static const struct pinctrl_ops mvebu_pinctrl_ops = {
474 .get_groups_count = mvebu_pinctrl_get_groups_count, 474 .get_groups_count = mvebu_pinctrl_get_groups_count,
475 .get_group_name = mvebu_pinctrl_get_group_name, 475 .get_group_name = mvebu_pinctrl_get_group_name,
476 .get_group_pins = mvebu_pinctrl_get_group_pins, 476 .get_group_pins = mvebu_pinctrl_get_group_pins,
@@ -478,8 +478,12 @@ static struct pinctrl_ops mvebu_pinctrl_ops = {
478 .dt_free_map = mvebu_pinctrl_dt_free_map, 478 .dt_free_map = mvebu_pinctrl_dt_free_map,
479}; 479};
480 480
481static int _add_function(struct mvebu_pinctrl_function *funcs, const char *name) 481static int _add_function(struct mvebu_pinctrl_function *funcs, int *funcsize,
482 const char *name)
482{ 483{
484 if (*funcsize <= 0)
485 return -EOVERFLOW;
486
483 while (funcs->num_groups) { 487 while (funcs->num_groups) {
484 /* function already there */ 488 /* function already there */
485 if (strcmp(funcs->name, name) == 0) { 489 if (strcmp(funcs->name, name) == 0) {
@@ -488,8 +492,12 @@ static int _add_function(struct mvebu_pinctrl_function *funcs, const char *name)
488 } 492 }
489 funcs++; 493 funcs++;
490 } 494 }
495
496 /* append new unique function */
491 funcs->name = name; 497 funcs->name = name;
492 funcs->num_groups = 1; 498 funcs->num_groups = 1;
499 (*funcsize)--;
500
493 return 0; 501 return 0;
494} 502}
495 503
@@ -497,12 +505,12 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev,
497 struct mvebu_pinctrl *pctl) 505 struct mvebu_pinctrl *pctl)
498{ 506{
499 struct mvebu_pinctrl_function *funcs; 507 struct mvebu_pinctrl_function *funcs;
500 int num = 0; 508 int num = 0, funcsize = pctl->desc.npins;
501 int n, s; 509 int n, s;
502 510
503 /* we allocate functions for number of pins and hope 511 /* we allocate functions for number of pins and hope
504 * there are less unique functions than pins available */ 512 * there are fewer unique functions than pins available */
505 funcs = devm_kzalloc(&pdev->dev, pctl->desc.npins * 513 funcs = devm_kzalloc(&pdev->dev, funcsize *
506 sizeof(struct mvebu_pinctrl_function), GFP_KERNEL); 514 sizeof(struct mvebu_pinctrl_function), GFP_KERNEL);
507 if (!funcs) 515 if (!funcs)
508 return -ENOMEM; 516 return -ENOMEM;
@@ -510,26 +518,27 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev,
510 for (n = 0; n < pctl->num_groups; n++) { 518 for (n = 0; n < pctl->num_groups; n++) {
511 struct mvebu_pinctrl_group *grp = &pctl->groups[n]; 519 struct mvebu_pinctrl_group *grp = &pctl->groups[n];
512 for (s = 0; s < grp->num_settings; s++) { 520 for (s = 0; s < grp->num_settings; s++) {
521 int ret;
522
513 /* skip unsupported settings on this variant */ 523 /* skip unsupported settings on this variant */
514 if (pctl->variant && 524 if (pctl->variant &&
515 !(pctl->variant & grp->settings[s].variant)) 525 !(pctl->variant & grp->settings[s].variant))
516 continue; 526 continue;
517 527
518 /* check for unique functions and count groups */ 528 /* check for unique functions and count groups */
519 if (_add_function(funcs, grp->settings[s].name)) 529 ret = _add_function(funcs, &funcsize,
530 grp->settings[s].name);
531 if (ret == -EOVERFLOW)
532 dev_err(&pdev->dev,
533 "More functions than pins(%d)\n",
534 pctl->desc.npins);
535 if (ret < 0)
520 continue; 536 continue;
521 537
522 num++; 538 num++;
523 } 539 }
524 } 540 }
525 541
526 /* with the number of unique functions and it's groups known,
527 reallocate functions and assign group names */
528 funcs = krealloc(funcs, num * sizeof(struct mvebu_pinctrl_function),
529 GFP_KERNEL);
530 if (!funcs)
531 return -ENOMEM;
532
533 pctl->num_functions = num; 542 pctl->num_functions = num;
534 pctl->functions = funcs; 543 pctl->functions = funcs;
535 544
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
index 06c304ac6f7d..2ad5a8d337b5 100644
--- a/drivers/pinctrl/pinconf-generic.c
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -12,6 +12,7 @@
12#define pr_fmt(fmt) "generic pinconfig core: " fmt 12#define pr_fmt(fmt) "generic pinconfig core: " fmt
13 13
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/device.h> 17#include <linux/device.h>
17#include <linux/slab.h> 18#include <linux/slab.h>
@@ -33,7 +34,7 @@ struct pin_config_item {
33 34
34#define PCONFDUMP(a, b, c) { .param = a, .display = b, .format = c } 35#define PCONFDUMP(a, b, c) { .param = a, .display = b, .format = c }
35 36
36struct pin_config_item conf_items[] = { 37static struct pin_config_item conf_items[] = {
37 PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL), 38 PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL),
38 PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL), 39 PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL),
39 PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL), 40 PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL),
@@ -59,7 +60,7 @@ void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
59 if (!ops->is_generic) 60 if (!ops->is_generic)
60 return; 61 return;
61 62
62 for(i = 0; i < ARRAY_SIZE(conf_items); i++) { 63 for (i = 0; i < ARRAY_SIZE(conf_items); i++) {
63 unsigned long config; 64 unsigned long config;
64 int ret; 65 int ret;
65 66
@@ -94,7 +95,7 @@ void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
94 if (!ops->is_generic) 95 if (!ops->is_generic)
95 return; 96 return;
96 97
97 for(i = 0; i < ARRAY_SIZE(conf_items); i++) { 98 for (i = 0; i < ARRAY_SIZE(conf_items); i++) {
98 unsigned long config; 99 unsigned long config;
99 int ret; 100 int ret;
100 101
@@ -120,4 +121,17 @@ void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
120 } 121 }
121} 122}
122 123
124void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
125 struct seq_file *s, unsigned long config)
126{
127 int i;
128
129 for (i = 0; i < ARRAY_SIZE(conf_items); i++) {
130 if (pinconf_to_config_param(config) != conf_items[i].param)
131 continue;
132 seq_printf(s, "%s: 0x%x", conf_items[i].display,
133 pinconf_to_config_argument(config));
134 }
135}
136EXPORT_SYMBOL_GPL(pinconf_generic_dump_config);
123#endif 137#endif
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index d611ecfcbf70..c67c37e23dd7 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -17,6 +17,7 @@
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/debugfs.h> 18#include <linux/debugfs.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/uaccess.h>
20#include <linux/pinctrl/machine.h> 21#include <linux/pinctrl/machine.h>
21#include <linux/pinctrl/pinctrl.h> 22#include <linux/pinctrl/pinctrl.h>
22#include <linux/pinctrl/pinconf.h> 23#include <linux/pinctrl/pinconf.h>
@@ -88,14 +89,14 @@ int pin_config_get(const char *dev_name, const char *name,
88 struct pinctrl_dev *pctldev; 89 struct pinctrl_dev *pctldev;
89 int pin; 90 int pin;
90 91
91 mutex_lock(&pinctrl_mutex);
92
93 pctldev = get_pinctrl_dev_from_devname(dev_name); 92 pctldev = get_pinctrl_dev_from_devname(dev_name);
94 if (!pctldev) { 93 if (!pctldev) {
95 pin = -EINVAL; 94 pin = -EINVAL;
96 goto unlock; 95 return pin;
97 } 96 }
98 97
98 mutex_lock(&pctldev->mutex);
99
99 pin = pin_get_from_name(pctldev, name); 100 pin = pin_get_from_name(pctldev, name);
100 if (pin < 0) 101 if (pin < 0)
101 goto unlock; 102 goto unlock;
@@ -103,7 +104,7 @@ int pin_config_get(const char *dev_name, const char *name,
103 pin = pin_config_get_for_pin(pctldev, pin, config); 104 pin = pin_config_get_for_pin(pctldev, pin, config);
104 105
105unlock: 106unlock:
106 mutex_unlock(&pinctrl_mutex); 107 mutex_unlock(&pctldev->mutex);
107 return pin; 108 return pin;
108} 109}
109EXPORT_SYMBOL(pin_config_get); 110EXPORT_SYMBOL(pin_config_get);
@@ -144,14 +145,14 @@ int pin_config_set(const char *dev_name, const char *name,
144 struct pinctrl_dev *pctldev; 145 struct pinctrl_dev *pctldev;
145 int pin, ret; 146 int pin, ret;
146 147
147 mutex_lock(&pinctrl_mutex);
148
149 pctldev = get_pinctrl_dev_from_devname(dev_name); 148 pctldev = get_pinctrl_dev_from_devname(dev_name);
150 if (!pctldev) { 149 if (!pctldev) {
151 ret = -EINVAL; 150 ret = -EINVAL;
152 goto unlock; 151 return ret;
153 } 152 }
154 153
154 mutex_lock(&pctldev->mutex);
155
155 pin = pin_get_from_name(pctldev, name); 156 pin = pin_get_from_name(pctldev, name);
156 if (pin < 0) { 157 if (pin < 0) {
157 ret = pin; 158 ret = pin;
@@ -161,7 +162,7 @@ int pin_config_set(const char *dev_name, const char *name,
161 ret = pin_config_set_for_pin(pctldev, pin, config); 162 ret = pin_config_set_for_pin(pctldev, pin, config);
162 163
163unlock: 164unlock:
164 mutex_unlock(&pinctrl_mutex); 165 mutex_unlock(&pctldev->mutex);
165 return ret; 166 return ret;
166} 167}
167EXPORT_SYMBOL(pin_config_set); 168EXPORT_SYMBOL(pin_config_set);
@@ -173,13 +174,14 @@ int pin_config_group_get(const char *dev_name, const char *pin_group,
173 const struct pinconf_ops *ops; 174 const struct pinconf_ops *ops;
174 int selector, ret; 175 int selector, ret;
175 176
176 mutex_lock(&pinctrl_mutex);
177
178 pctldev = get_pinctrl_dev_from_devname(dev_name); 177 pctldev = get_pinctrl_dev_from_devname(dev_name);
179 if (!pctldev) { 178 if (!pctldev) {
180 ret = -EINVAL; 179 ret = -EINVAL;
181 goto unlock; 180 return ret;
182 } 181 }
182
183 mutex_lock(&pctldev->mutex);
184
183 ops = pctldev->desc->confops; 185 ops = pctldev->desc->confops;
184 186
185 if (!ops || !ops->pin_config_group_get) { 187 if (!ops || !ops->pin_config_group_get) {
@@ -199,7 +201,7 @@ int pin_config_group_get(const char *dev_name, const char *pin_group,
199 ret = ops->pin_config_group_get(pctldev, selector, config); 201 ret = ops->pin_config_group_get(pctldev, selector, config);
200 202
201unlock: 203unlock:
202 mutex_unlock(&pinctrl_mutex); 204 mutex_unlock(&pctldev->mutex);
203 return ret; 205 return ret;
204} 206}
205EXPORT_SYMBOL(pin_config_group_get); 207EXPORT_SYMBOL(pin_config_group_get);
@@ -216,13 +218,14 @@ int pin_config_group_set(const char *dev_name, const char *pin_group,
216 int ret; 218 int ret;
217 int i; 219 int i;
218 220
219 mutex_lock(&pinctrl_mutex);
220
221 pctldev = get_pinctrl_dev_from_devname(dev_name); 221 pctldev = get_pinctrl_dev_from_devname(dev_name);
222 if (!pctldev) { 222 if (!pctldev) {
223 ret = -EINVAL; 223 ret = -EINVAL;
224 goto unlock; 224 return ret;
225 } 225 }
226
227 mutex_lock(&pctldev->mutex);
228
226 ops = pctldev->desc->confops; 229 ops = pctldev->desc->confops;
227 pctlops = pctldev->desc->pctlops; 230 pctlops = pctldev->desc->pctlops;
228 231
@@ -278,7 +281,7 @@ int pin_config_group_set(const char *dev_name, const char *pin_group,
278 ret = 0; 281 ret = 0;
279 282
280unlock: 283unlock:
281 mutex_unlock(&pinctrl_mutex); 284 mutex_unlock(&pctldev->mutex);
282 285
283 return ret; 286 return ret;
284} 287}
@@ -486,7 +489,7 @@ static int pinconf_pins_show(struct seq_file *s, void *what)
486 seq_puts(s, "Pin config settings per pin\n"); 489 seq_puts(s, "Pin config settings per pin\n");
487 seq_puts(s, "Format: pin (name): configs\n"); 490 seq_puts(s, "Format: pin (name): configs\n");
488 491
489 mutex_lock(&pinctrl_mutex); 492 mutex_lock(&pctldev->mutex);
490 493
491 /* The pin number can be retrived from the pin controller descriptor */ 494 /* The pin number can be retrived from the pin controller descriptor */
492 for (i = 0; i < pctldev->desc->npins; i++) { 495 for (i = 0; i < pctldev->desc->npins; i++) {
@@ -506,7 +509,7 @@ static int pinconf_pins_show(struct seq_file *s, void *what)
506 seq_printf(s, "\n"); 509 seq_printf(s, "\n");
507 } 510 }
508 511
509 mutex_unlock(&pinctrl_mutex); 512 mutex_unlock(&pctldev->mutex);
510 513
511 return 0; 514 return 0;
512} 515}
@@ -574,122 +577,58 @@ static const struct file_operations pinconf_groups_ops = {
574 .release = single_release, 577 .release = single_release,
575}; 578};
576 579
577/* 32bit read/write ressources */ 580#define MAX_NAME_LEN 15
578#define MAX_NAME_LEN 16
579char dbg_pinname[MAX_NAME_LEN]; /* shared: name of the state of the pin*/
580char dbg_state_name[MAX_NAME_LEN]; /* shared: state of the pin*/
581static u32 dbg_config; /* shared: config to be read/set for the pin & state*/
582
583static int pinconf_dbg_pinname_print(struct seq_file *s, void *d)
584{
585 if (strlen(dbg_pinname))
586 seq_printf(s, "%s\n", dbg_pinname);
587 else
588 seq_printf(s, "No pin name set\n");
589 return 0;
590}
591
592static int pinconf_dbg_pinname_open(struct inode *inode, struct file *file)
593{
594 return single_open(file, pinconf_dbg_pinname_print, inode->i_private);
595}
596
597static int pinconf_dbg_pinname_write(struct file *file,
598 const char __user *user_buf, size_t count, loff_t *ppos)
599{
600 int err;
601
602 if (count > MAX_NAME_LEN)
603 return -EINVAL;
604
605 err = sscanf(user_buf, "%15s", dbg_pinname);
606
607 if (err != 1)
608 return -EINVAL;
609
610 return count;
611}
612 581
613static const struct file_operations pinconf_dbg_pinname_fops = { 582struct dbg_cfg {
614 .open = pinconf_dbg_pinname_open, 583 enum pinctrl_map_type map_type;
615 .write = pinconf_dbg_pinname_write, 584 char dev_name[MAX_NAME_LEN+1];
616 .read = seq_read, 585 char state_name[MAX_NAME_LEN+1];
617 .llseek = seq_lseek, 586 char pin_name[MAX_NAME_LEN+1];
618 .release = single_release,
619 .owner = THIS_MODULE,
620}; 587};
621 588
622static int pinconf_dbg_state_print(struct seq_file *s, void *d) 589/*
623{ 590 * Goal is to keep this structure as global in order to simply read the
624 if (strlen(dbg_state_name)) 591 * pinconf-config file after a write to check config is as expected
625 seq_printf(s, "%s\n", dbg_state_name); 592 */
626 else 593static struct dbg_cfg pinconf_dbg_conf;
627 seq_printf(s, "No pin state set\n");
628 return 0;
629}
630
631static int pinconf_dbg_state_open(struct inode *inode, struct file *file)
632{
633 return single_open(file, pinconf_dbg_state_print, inode->i_private);
634}
635
636static int pinconf_dbg_state_write(struct file *file,
637 const char __user *user_buf, size_t count, loff_t *ppos)
638{
639 int err;
640
641 if (count > MAX_NAME_LEN)
642 return -EINVAL;
643
644 err = sscanf(user_buf, "%15s", dbg_state_name);
645
646 if (err != 1)
647 return -EINVAL;
648
649 return count;
650}
651
652static const struct file_operations pinconf_dbg_pinstate_fops = {
653 .open = pinconf_dbg_state_open,
654 .write = pinconf_dbg_state_write,
655 .read = seq_read,
656 .llseek = seq_lseek,
657 .release = single_release,
658 .owner = THIS_MODULE,
659};
660 594
661/** 595/**
662 * pinconf_dbg_config_print() - display the pinctrl config from the pinctrl 596 * pinconf_dbg_config_print() - display the pinctrl config from the pinctrl
663 * map, of a pin/state pair based on pinname and state that have been 597 * map, of the dev/pin/state that was last written to pinconf-config file.
664 * selected with the debugfs entries pinconf-name and pinconf-state 598 * @s: string filled in with config description
665 * @s: contains the 32bits config to be written
666 * @d: not used 599 * @d: not used
667 */ 600 */
668static int pinconf_dbg_config_print(struct seq_file *s, void *d) 601static int pinconf_dbg_config_print(struct seq_file *s, void *d)
669{ 602{
670 struct pinctrl_maps *maps_node; 603 struct pinctrl_maps *maps_node;
671 struct pinctrl_map const *map; 604 const struct pinctrl_map *map;
672 struct pinctrl_dev *pctldev = NULL; 605 struct pinctrl_dev *pctldev = NULL;
673 struct pinconf_ops *confops = NULL; 606 const struct pinconf_ops *confops = NULL;
607 const struct pinctrl_map_configs *configs;
608 struct dbg_cfg *dbg = &pinconf_dbg_conf;
674 int i, j; 609 int i, j;
675 bool found = false; 610 bool found = false;
611 unsigned long config;
676 612
677 mutex_lock(&pinctrl_mutex); 613 mutex_lock(&pctldev->mutex);
678 614
679 /* Parse the pinctrl map and look for the elected pin/state */ 615 /* Parse the pinctrl map and look for the elected pin/state */
680 for_each_maps(maps_node, i, map) { 616 for_each_maps(maps_node, i, map) {
681 if (map->type != PIN_MAP_TYPE_CONFIGS_PIN) 617 if (map->type != dbg->map_type)
682 continue; 618 continue;
683 619 if (strcmp(map->dev_name, dbg->dev_name))
684 if (strncmp(map->name, dbg_state_name, MAX_NAME_LEN) > 0) 620 continue;
621 if (strcmp(map->name, dbg->state_name))
685 continue; 622 continue;
686 623
687 for (j = 0; j < map->data.configs.num_configs; j++) { 624 for (j = 0; j < map->data.configs.num_configs; j++) {
688 if (0 == strncmp(map->data.configs.group_or_pin, 625 if (!strcmp(map->data.configs.group_or_pin,
689 dbg_pinname, MAX_NAME_LEN)) { 626 dbg->pin_name)) {
690 /* We found the right pin / state, read the 627 /*
691 * config and store the pctldev */ 628 * We found the right pin / state, read the
692 dbg_config = map->data.configs.configs[j]; 629 * config and he pctldev for later use
630 */
631 configs = &map->data.configs;
693 pctldev = get_pinctrl_dev_from_devname 632 pctldev = get_pinctrl_dev_from_devname
694 (map->ctrl_dev_name); 633 (map->ctrl_dev_name);
695 found = true; 634 found = true;
@@ -698,74 +637,166 @@ static int pinconf_dbg_config_print(struct seq_file *s, void *d)
698 } 637 }
699 } 638 }
700 639
701 mutex_unlock(&pinctrl_mutex); 640 if (!found) {
641 seq_printf(s, "No config found for dev/state/pin, expected:\n");
642 seq_printf(s, "Searched dev:%s\n", dbg->dev_name);
643 seq_printf(s, "Searched state:%s\n", dbg->state_name);
644 seq_printf(s, "Searched pin:%s\n", dbg->pin_name);
645 seq_printf(s, "Use: modify config_pin <devname> "\
646 "<state> <pinname> <value>\n");
647 goto exit;
648 }
702 649
703 if (found) { 650 config = *(configs->configs);
704 seq_printf(s, "Config of %s in state %s: 0x%08X\n", dbg_pinname, 651 seq_printf(s, "Dev %s has config of %s in state %s: 0x%08lX\n",
705 dbg_state_name, dbg_config); 652 dbg->dev_name, dbg->pin_name,
653 dbg->state_name, config);
706 654
707 if (pctldev) 655 if (pctldev)
708 confops = pctldev->desc->confops; 656 confops = pctldev->desc->confops;
709 657
710 if (confops && confops->pin_config_config_dbg_show) 658 if (confops && confops->pin_config_config_dbg_show)
711 confops->pin_config_config_dbg_show(pctldev, 659 confops->pin_config_config_dbg_show(pctldev, s, config);
712 s, dbg_config);
713 } else {
714 seq_printf(s, "No pin found for defined name/state\n");
715 }
716 660
717 return 0; 661exit:
718} 662 mutex_unlock(&pctldev->mutex);
719 663
720static int pinconf_dbg_config_open(struct inode *inode, struct file *file) 664 return 0;
721{
722 return single_open(file, pinconf_dbg_config_print, inode->i_private);
723} 665}
724 666
725/** 667/**
726 * pinconf_dbg_config_write() - overwrite the pinctrl config in thepinctrl 668 * pinconf_dbg_config_write() - modify the pinctrl config in the pinctrl
727 * map, of a pin/state pair based on pinname and state that have been 669 * map, of a dev/pin/state entry based on user entries to pinconf-config
728 * selected with the debugfs entries pinconf-name and pinconf-state 670 * @user_buf: contains the modification request with expected format:
671 * modify config_pin <devicename> <state> <pinname> <newvalue>
672 * modify is literal string, alternatives like add/delete not supported yet
673 * config_pin is literal, alternatives like config_mux not supported yet
674 * <devicename> <state> <pinname> are values that should match the pinctrl-maps
675 * <newvalue> reflects the new config and is driver dependant
729 */ 676 */
730static int pinconf_dbg_config_write(struct file *file, 677static int pinconf_dbg_config_write(struct file *file,
731 const char __user *user_buf, size_t count, loff_t *ppos) 678 const char __user *user_buf, size_t count, loff_t *ppos)
732{ 679{
733 int err;
734 unsigned long config;
735 struct pinctrl_maps *maps_node; 680 struct pinctrl_maps *maps_node;
736 struct pinctrl_map const *map; 681 const struct pinctrl_map *map;
737 int i, j; 682 struct pinctrl_dev *pctldev = NULL;
683 const struct pinconf_ops *confops = NULL;
684 struct dbg_cfg *dbg = &pinconf_dbg_conf;
685 const struct pinctrl_map_configs *configs;
686 char config[MAX_NAME_LEN+1];
687 bool found = false;
688 char buf[128];
689 char *b = &buf[0];
690 int buf_size;
691 char *token;
692 int i;
693
694 /* Get userspace string and assure termination */
695 buf_size = min(count, (sizeof(buf)-1));
696 if (copy_from_user(buf, user_buf, buf_size))
697 return -EFAULT;
698 buf[buf_size] = 0;
699
700 /*
701 * need to parse entry and extract parameters:
702 * modify configs_pin devicename state pinname newvalue
703 */
704
705 /* Get arg: 'modify' */
706 token = strsep(&b, " ");
707 if (!token)
708 return -EINVAL;
709 if (strcmp(token, "modify"))
710 return -EINVAL;
738 711
739 err = kstrtoul_from_user(user_buf, count, 0, &config); 712 /* Get arg type: "config_pin" type supported so far */
713 token = strsep(&b, " ");
714 if (!token)
715 return -EINVAL;
716 if (strcmp(token, "config_pin"))
717 return -EINVAL;
718 dbg->map_type = PIN_MAP_TYPE_CONFIGS_PIN;
740 719
741 if (err) 720 /* get arg 'device_name' */
742 return err; 721 token = strsep(&b, " ");
722 if (token == NULL)
723 return -EINVAL;
724 if (strlen(token) >= MAX_NAME_LEN)
725 return -EINVAL;
726 strncpy(dbg->dev_name, token, MAX_NAME_LEN);
743 727
744 dbg_config = config; 728 /* get arg 'state_name' */
729 token = strsep(&b, " ");
730 if (token == NULL)
731 return -EINVAL;
732 if (strlen(token) >= MAX_NAME_LEN)
733 return -EINVAL;
734 strncpy(dbg->state_name, token, MAX_NAME_LEN);
745 735
746 mutex_lock(&pinctrl_mutex); 736 /* get arg 'pin_name' */
737 token = strsep(&b, " ");
738 if (token == NULL)
739 return -EINVAL;
740 if (strlen(token) >= MAX_NAME_LEN)
741 return -EINVAL;
742 strncpy(dbg->pin_name, token, MAX_NAME_LEN);
747 743
748 /* Parse the pinctrl map and look for the selected pin/state */ 744 /* get new_value of config' */
745 token = strsep(&b, " ");
746 if (token == NULL)
747 return -EINVAL;
748 if (strlen(token) >= MAX_NAME_LEN)
749 return -EINVAL;
750 strncpy(config, token, MAX_NAME_LEN);
751
752 mutex_lock(&pinctrl_maps_mutex);
753
754 /* Parse the pinctrl map and look for the selected dev/state/pin */
749 for_each_maps(maps_node, i, map) { 755 for_each_maps(maps_node, i, map) {
750 if (map->type != PIN_MAP_TYPE_CONFIGS_PIN) 756 if (strcmp(map->dev_name, dbg->dev_name))
751 continue; 757 continue;
752 758 if (map->type != dbg->map_type)
753 if (strncmp(map->name, dbg_state_name, MAX_NAME_LEN) > 0) 759 continue;
760 if (strcmp(map->name, dbg->state_name))
754 continue; 761 continue;
755 762
756 /* we found the right pin / state, so overwrite config */ 763 /* we found the right pin / state, so overwrite config */
757 for (j = 0; j < map->data.configs.num_configs; j++) { 764 if (!strcmp(map->data.configs.group_or_pin, dbg->pin_name)) {
758 if (strncmp(map->data.configs.group_or_pin, dbg_pinname, 765 found = true;
759 MAX_NAME_LEN) == 0) 766 pctldev = get_pinctrl_dev_from_devname(
760 map->data.configs.configs[j] = dbg_config; 767 map->ctrl_dev_name);
768 configs = &map->data.configs;
769 break;
761 } 770 }
762 } 771 }
763 772
764 mutex_unlock(&pinctrl_mutex); 773 if (!found) {
774 count = -EINVAL;
775 goto exit;
776 }
777
778 if (pctldev)
779 confops = pctldev->desc->confops;
780
781 if (confops && confops->pin_config_dbg_parse_modify) {
782 for (i = 0; i < configs->num_configs; i++) {
783 confops->pin_config_dbg_parse_modify(pctldev,
784 config,
785 &configs->configs[i]);
786 }
787 }
788
789exit:
790 mutex_unlock(&pinctrl_maps_mutex);
765 791
766 return count; 792 return count;
767} 793}
768 794
795static int pinconf_dbg_config_open(struct inode *inode, struct file *file)
796{
797 return single_open(file, pinconf_dbg_config_print, inode->i_private);
798}
799
769static const struct file_operations pinconf_dbg_pinconfig_fops = { 800static const struct file_operations pinconf_dbg_pinconfig_fops = {
770 .open = pinconf_dbg_config_open, 801 .open = pinconf_dbg_config_open,
771 .write = pinconf_dbg_config_write, 802 .write = pinconf_dbg_config_write,
@@ -782,10 +813,6 @@ void pinconf_init_device_debugfs(struct dentry *devroot,
782 devroot, pctldev, &pinconf_pins_ops); 813 devroot, pctldev, &pinconf_pins_ops);
783 debugfs_create_file("pinconf-groups", S_IFREG | S_IRUGO, 814 debugfs_create_file("pinconf-groups", S_IFREG | S_IRUGO,
784 devroot, pctldev, &pinconf_groups_ops); 815 devroot, pctldev, &pinconf_groups_ops);
785 debugfs_create_file("pinconf-name", (S_IRUGO | S_IWUSR | S_IWGRP),
786 devroot, pctldev, &pinconf_dbg_pinname_fops);
787 debugfs_create_file("pinconf-state", (S_IRUGO | S_IWUSR | S_IWGRP),
788 devroot, pctldev, &pinconf_dbg_pinstate_fops);
789 debugfs_create_file("pinconf-config", (S_IRUGO | S_IWUSR | S_IWGRP), 816 debugfs_create_file("pinconf-config", (S_IRUGO | S_IWUSR | S_IWGRP),
790 devroot, pctldev, &pinconf_dbg_pinconfig_fops); 817 devroot, pctldev, &pinconf_dbg_pinconfig_fops);
791} 818}
diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h
index bfda73d64eed..92c7267244d2 100644
--- a/drivers/pinctrl/pinconf.h
+++ b/drivers/pinctrl/pinconf.h
@@ -98,6 +98,8 @@ void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
98void pinconf_generic_dump_group(struct pinctrl_dev *pctldev, 98void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
99 struct seq_file *s, const char *gname); 99 struct seq_file *s, const char *gname);
100 100
101void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
102 struct seq_file *s, unsigned long config);
101#else 103#else
102 104
103static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev, 105static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
@@ -114,4 +116,10 @@ static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
114 return; 116 return;
115} 117}
116 118
119static inline void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
120 struct seq_file *s,
121 unsigned long config)
122{
123 return;
124}
117#endif 125#endif
diff --git a/drivers/pinctrl/pinctrl-ab8500.c b/drivers/pinctrl/pinctrl-ab8500.c
index 3b471d87c211..2ac2d0ad3025 100644
--- a/drivers/pinctrl/pinctrl-ab8500.c
+++ b/drivers/pinctrl/pinctrl-ab8500.c
@@ -389,7 +389,8 @@ static const struct abx500_function ab8500_functions[] = {
389 * alt_A | 1 | 0 | 0 389 * alt_A | 1 | 0 | 0
390 */ 390 */
391 391
392struct alternate_functions ab8500_alternate_functions[AB8500_GPIO_MAX_NUMBER + 1] = { 392static struct
393alternate_functions ab8500_alternate_functions[AB8500_GPIO_MAX_NUMBER + 1] = {
393 ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */ 394 ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */
394 ALTERNATE_FUNCTIONS(1, 0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */ 395 ALTERNATE_FUNCTIONS(1, 0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */
395 ALTERNATE_FUNCTIONS(2, 1, UNUSED, UNUSED, 0, 0, 0), /* GPIO2, altA controlled by bit 1 */ 396 ALTERNATE_FUNCTIONS(2, 1, UNUSED, UNUSED, 0, 0, 0), /* GPIO2, altA controlled by bit 1 */
@@ -455,7 +456,7 @@ struct alternate_functions ab8500_alternate_functions[AB8500_GPIO_MAX_NUMBER + 1
455 * GPIO24 and GPIO25 456 * GPIO24 and GPIO25
456 * GPIO36 to GPIO41 457 * GPIO36 to GPIO41
457 */ 458 */
458struct abx500_gpio_irq_cluster ab8500_gpio_irq_cluster[] = { 459static struct abx500_gpio_irq_cluster ab8500_gpio_irq_cluster[] = {
459 GPIO_IRQ_CLUSTER(6, 13, AB8500_INT_GPIO6R), 460 GPIO_IRQ_CLUSTER(6, 13, AB8500_INT_GPIO6R),
460 GPIO_IRQ_CLUSTER(24, 25, AB8500_INT_GPIO24R), 461 GPIO_IRQ_CLUSTER(24, 25, AB8500_INT_GPIO24R),
461 GPIO_IRQ_CLUSTER(36, 41, AB8500_INT_GPIO36R), 462 GPIO_IRQ_CLUSTER(36, 41, AB8500_INT_GPIO36R),
diff --git a/drivers/pinctrl/pinctrl-ab8505.c b/drivers/pinctrl/pinctrl-ab8505.c
index 3a4238e879e3..bf0ef4ac376f 100644
--- a/drivers/pinctrl/pinctrl-ab8505.c
+++ b/drivers/pinctrl/pinctrl-ab8505.c
@@ -271,7 +271,8 @@ static const struct abx500_function ab8505_functions[] = {
271 * alt_A | 1 | 0 | 0 271 * alt_A | 1 | 0 | 0
272 */ 272 */
273 273
274struct alternate_functions ab8505_alternate_functions[AB8505_GPIO_MAX_NUMBER + 1] = { 274static struct
275alternate_functions ab8505_alternate_functions[AB8505_GPIO_MAX_NUMBER + 1] = {
275 ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */ 276 ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */
276 ALTERNATE_FUNCTIONS(1, 0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */ 277 ALTERNATE_FUNCTIONS(1, 0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */
277 ALTERNATE_FUNCTIONS(2, 1, UNUSED, UNUSED, 0, 0, 0), /* GPIO2, altA controlled by bit 1 */ 278 ALTERNATE_FUNCTIONS(2, 1, UNUSED, UNUSED, 0, 0, 0), /* GPIO2, altA controlled by bit 1 */
@@ -284,7 +285,7 @@ struct alternate_functions ab8505_alternate_functions[AB8505_GPIO_MAX_NUMBER + 1
284 285
285 ALTERNATE_FUNCTIONS(9, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO9, bit 0 reserved */ 286 ALTERNATE_FUNCTIONS(9, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO9, bit 0 reserved */
286 ALTERNATE_FUNCTIONS(10, 1, 0, UNUSED, 1, 0, 0), /* GPIO10, altA and altB controlled by bit 0 */ 287 ALTERNATE_FUNCTIONS(10, 1, 0, UNUSED, 1, 0, 0), /* GPIO10, altA and altB controlled by bit 0 */
287 ALTERNATE_FUNCTIONS(11, 2, UNUSED, UNUSED, 0, 0, 0), /* GPIO11, altA controlled by bit 2 */ 288 ALTERNATE_FUNCTIONS(11, 2, 1, UNUSED, 0, 0, 0), /* GPIO11, altA controlled by bit 2 */
288 ALTERNATE_FUNCTIONS(12, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO12, bit3 reseved */ 289 ALTERNATE_FUNCTIONS(12, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO12, bit3 reseved */
289 ALTERNATE_FUNCTIONS(13, 4, 3, 4, 1, 0, 2), /* GPIO13, altA altB and altC controlled by bit 3 and 4 */ 290 ALTERNATE_FUNCTIONS(13, 4, 3, 4, 1, 0, 2), /* GPIO13, altA altB and altC controlled by bit 3 and 4 */
290 ALTERNATE_FUNCTIONS(14, 5, UNUSED, UNUSED, 0, 0, 0), /* GPIO14, altA controlled by bit 5 */ 291 ALTERNATE_FUNCTIONS(14, 5, UNUSED, UNUSED, 0, 0, 0), /* GPIO14, altA controlled by bit 5 */
@@ -348,7 +349,7 @@ struct alternate_functions ab8505_alternate_functions[AB8505_GPIO_MAX_NUMBER + 1
348 * GPIO50 349 * GPIO50
349 * GPIO52 to GPIO53 350 * GPIO52 to GPIO53
350 */ 351 */
351struct abx500_gpio_irq_cluster ab8505_gpio_irq_cluster[] = { 352static struct abx500_gpio_irq_cluster ab8505_gpio_irq_cluster[] = {
352 GPIO_IRQ_CLUSTER(10, 11, AB8500_INT_GPIO10R), 353 GPIO_IRQ_CLUSTER(10, 11, AB8500_INT_GPIO10R),
353 GPIO_IRQ_CLUSTER(13, 13, AB8500_INT_GPIO13R), 354 GPIO_IRQ_CLUSTER(13, 13, AB8500_INT_GPIO13R),
354 GPIO_IRQ_CLUSTER(40, 41, AB8500_INT_GPIO40R), 355 GPIO_IRQ_CLUSTER(40, 41, AB8500_INT_GPIO40R),
diff --git a/drivers/pinctrl/pinctrl-ab8540.c b/drivers/pinctrl/pinctrl-ab8540.c
index 8ee1e8d95f65..9867535d49c1 100644
--- a/drivers/pinctrl/pinctrl-ab8540.c
+++ b/drivers/pinctrl/pinctrl-ab8540.c
@@ -299,7 +299,8 @@ static const struct abx500_function ab8540_functions[] = {
299 * 299 *
300 */ 300 */
301 301
302struct alternate_functions ab8540_alternate_functions[AB8540_GPIO_MAX_NUMBER + 1] = { 302static struct
303alternate_functions ab8540_alternate_functions[AB8540_GPIO_MAX_NUMBER + 1] = {
303 /* GPIOSEL1 - bit 4-7 reserved */ 304 /* GPIOSEL1 - bit 4-7 reserved */
304 ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */ 305 ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */
305 ALTERNATE_FUNCTIONS(1, 0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */ 306 ALTERNATE_FUNCTIONS(1, 0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */
@@ -376,7 +377,7 @@ static struct pullud ab8540_pullud = {
376 * GPIO43 to GPIO44 377 * GPIO43 to GPIO44
377 * GPIO51 to GPIO54 378 * GPIO51 to GPIO54
378 */ 379 */
379struct abx500_gpio_irq_cluster ab8540_gpio_irq_cluster[] = { 380static struct abx500_gpio_irq_cluster ab8540_gpio_irq_cluster[] = {
380 GPIO_IRQ_CLUSTER(43, 43, AB8540_INT_GPIO43F), 381 GPIO_IRQ_CLUSTER(43, 43, AB8540_INT_GPIO43F),
381 GPIO_IRQ_CLUSTER(44, 44, AB8540_INT_GPIO44F), 382 GPIO_IRQ_CLUSTER(44, 44, AB8540_INT_GPIO44F),
382 GPIO_IRQ_CLUSTER(51, 54, AB9540_INT_GPIO51R), 383 GPIO_IRQ_CLUSTER(51, 54, AB9540_INT_GPIO51R),
diff --git a/drivers/pinctrl/pinctrl-ab9540.c b/drivers/pinctrl/pinctrl-ab9540.c
index 7610bd012b98..1a281ca95dac 100644
--- a/drivers/pinctrl/pinctrl-ab9540.c
+++ b/drivers/pinctrl/pinctrl-ab9540.c
@@ -379,7 +379,8 @@ static const struct abx500_function ab9540_functions[] = {
379 * alt_A | 1 | 0 | 0 379 * alt_A | 1 | 0 | 0
380 */ 380 */
381 381
382struct alternate_functions ab9540alternate_functions[AB9540_GPIO_MAX_NUMBER + 1] = { 382static struct
383alternate_functions ab9540alternate_functions[AB9540_GPIO_MAX_NUMBER + 1] = {
383 /* GPIOSEL1 - bits 4-7 are reserved */ 384 /* GPIOSEL1 - bits 4-7 are reserved */
384 ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */ 385 ALTERNATE_FUNCTIONS(0, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO0 */
385 ALTERNATE_FUNCTIONS(1, 0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */ 386 ALTERNATE_FUNCTIONS(1, 0, UNUSED, UNUSED, 0, 0, 0), /* GPIO1, altA controlled by bit 0 */
@@ -393,7 +394,7 @@ struct alternate_functions ab9540alternate_functions[AB9540_GPIO_MAX_NUMBER + 1]
393 /* GPIOSEL2 - bits 0 and 3 are reserved */ 394 /* GPIOSEL2 - bits 0 and 3 are reserved */
394 ALTERNATE_FUNCTIONS(9, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO9 */ 395 ALTERNATE_FUNCTIONS(9, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO9 */
395 ALTERNATE_FUNCTIONS(10, 1, 0, UNUSED, 1, 0, 0), /* GPIO10, altA and altB controlled by bit 0 */ 396 ALTERNATE_FUNCTIONS(10, 1, 0, UNUSED, 1, 0, 0), /* GPIO10, altA and altB controlled by bit 0 */
396 ALTERNATE_FUNCTIONS(11, 2, UNUSED, UNUSED, 0, 0, 0), /* GPIO11, altA controlled by bit 1 */ 397 ALTERNATE_FUNCTIONS(11, 2, 1, UNUSED, 0, 0, 0), /* GPIO11, altA controlled by bit 1 */
397 ALTERNATE_FUNCTIONS(12, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO12 */ 398 ALTERNATE_FUNCTIONS(12, UNUSED, UNUSED, UNUSED, 0, 0, 0), /* no GPIO12 */
398 ALTERNATE_FUNCTIONS(13, 4, 3, 4, 1, 0, 2), /* GPIO13, altA altB and altC controlled by bit 3 and 4 */ 399 ALTERNATE_FUNCTIONS(13, 4, 3, 4, 1, 0, 2), /* GPIO13, altA altB and altC controlled by bit 3 and 4 */
399 ALTERNATE_FUNCTIONS(14, 5, UNUSED, UNUSED, 0, 0, 0), /* GPIO14, altA controlled by bit 5 */ 400 ALTERNATE_FUNCTIONS(14, 5, UNUSED, UNUSED, 0, 0, 0), /* GPIO14, altA controlled by bit 5 */
@@ -454,7 +455,7 @@ struct alternate_functions ab9540alternate_functions[AB9540_GPIO_MAX_NUMBER + 1]
454 ALTERNATE_FUNCTIONS(54, 5, UNUSED, UNUSED, 0, 0, 0), /* GPIO54 = GPIO60, altA controlled by bit 5 */ 455 ALTERNATE_FUNCTIONS(54, 5, UNUSED, UNUSED, 0, 0, 0), /* GPIO54 = GPIO60, altA controlled by bit 5 */
455}; 456};
456 457
457struct abx500_gpio_irq_cluster ab9540_gpio_irq_cluster[] = { 458static struct abx500_gpio_irq_cluster ab9540_gpio_irq_cluster[] = {
458 GPIO_IRQ_CLUSTER(10, 13, AB8500_INT_GPIO10R), 459 GPIO_IRQ_CLUSTER(10, 13, AB8500_INT_GPIO10R),
459 GPIO_IRQ_CLUSTER(24, 25, AB8500_INT_GPIO24R), 460 GPIO_IRQ_CLUSTER(24, 25, AB8500_INT_GPIO24R),
460 GPIO_IRQ_CLUSTER(40, 41, AB8500_INT_GPIO40R), 461 GPIO_IRQ_CLUSTER(40, 41, AB8500_INT_GPIO40R),
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index c542a97c82f3..aa17f7580f61 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -517,14 +517,14 @@ static inline void abx500_gpio_dbg_show_one(struct seq_file *s,
517#define abx500_gpio_dbg_show NULL 517#define abx500_gpio_dbg_show NULL
518#endif 518#endif
519 519
520int abx500_gpio_request(struct gpio_chip *chip, unsigned offset) 520static int abx500_gpio_request(struct gpio_chip *chip, unsigned offset)
521{ 521{
522 int gpio = chip->base + offset; 522 int gpio = chip->base + offset;
523 523
524 return pinctrl_request_gpio(gpio); 524 return pinctrl_request_gpio(gpio);
525} 525}
526 526
527void abx500_gpio_free(struct gpio_chip *chip, unsigned offset) 527static void abx500_gpio_free(struct gpio_chip *chip, unsigned offset)
528{ 528{
529 int gpio = chip->base + offset; 529 int gpio = chip->base + offset;
530 530
@@ -611,7 +611,7 @@ static void abx500_pmx_disable(struct pinctrl_dev *pctldev,
611 dev_dbg(pct->dev, "disable group %s, %u pins\n", g->name, g->npins); 611 dev_dbg(pct->dev, "disable group %s, %u pins\n", g->name, g->npins);
612} 612}
613 613
614int abx500_gpio_request_enable(struct pinctrl_dev *pctldev, 614static int abx500_gpio_request_enable(struct pinctrl_dev *pctldev,
615 struct pinctrl_gpio_range *range, 615 struct pinctrl_gpio_range *range,
616 unsigned offset) 616 unsigned offset)
617{ 617{
@@ -656,7 +656,7 @@ static void abx500_gpio_disable_free(struct pinctrl_dev *pctldev,
656{ 656{
657} 657}
658 658
659static struct pinmux_ops abx500_pinmux_ops = { 659static const struct pinmux_ops abx500_pinmux_ops = {
660 .get_functions_count = abx500_pmx_get_funcs_cnt, 660 .get_functions_count = abx500_pmx_get_funcs_cnt,
661 .get_function_name = abx500_pmx_get_func_name, 661 .get_function_name = abx500_pmx_get_func_name,
662 .get_function_groups = abx500_pmx_get_func_groups, 662 .get_function_groups = abx500_pmx_get_func_groups,
@@ -704,21 +704,21 @@ static void abx500_pin_dbg_show(struct pinctrl_dev *pctldev,
704 chip->base + offset - 1); 704 chip->base + offset - 1);
705} 705}
706 706
707static struct pinctrl_ops abx500_pinctrl_ops = { 707static const struct pinctrl_ops abx500_pinctrl_ops = {
708 .get_groups_count = abx500_get_groups_cnt, 708 .get_groups_count = abx500_get_groups_cnt,
709 .get_group_name = abx500_get_group_name, 709 .get_group_name = abx500_get_group_name,
710 .get_group_pins = abx500_get_group_pins, 710 .get_group_pins = abx500_get_group_pins,
711 .pin_dbg_show = abx500_pin_dbg_show, 711 .pin_dbg_show = abx500_pin_dbg_show,
712}; 712};
713 713
714int abx500_pin_config_get(struct pinctrl_dev *pctldev, 714static int abx500_pin_config_get(struct pinctrl_dev *pctldev,
715 unsigned pin, 715 unsigned pin,
716 unsigned long *config) 716 unsigned long *config)
717{ 717{
718 return -ENOSYS; 718 return -ENOSYS;
719} 719}
720 720
721int abx500_pin_config_set(struct pinctrl_dev *pctldev, 721static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
722 unsigned pin, 722 unsigned pin,
723 unsigned long config) 723 unsigned long config)
724{ 724{
@@ -778,7 +778,7 @@ int abx500_pin_config_set(struct pinctrl_dev *pctldev,
778 return ret; 778 return ret;
779} 779}
780 780
781static struct pinconf_ops abx500_pinconf_ops = { 781static const struct pinconf_ops abx500_pinconf_ops = {
782 .pin_config_get = abx500_pin_config_get, 782 .pin_config_get = abx500_pin_config_get,
783 .pin_config_set = abx500_pin_config_set, 783 .pin_config_set = abx500_pin_config_set,
784}; 784};
@@ -834,6 +834,7 @@ static const struct of_device_id abx500_gpio_match[] = {
834 { .compatible = "stericsson,ab8505-gpio", .data = (void *)PINCTRL_AB8505, }, 834 { .compatible = "stericsson,ab8505-gpio", .data = (void *)PINCTRL_AB8505, },
835 { .compatible = "stericsson,ab8540-gpio", .data = (void *)PINCTRL_AB8540, }, 835 { .compatible = "stericsson,ab8540-gpio", .data = (void *)PINCTRL_AB8540, },
836 { .compatible = "stericsson,ab9540-gpio", .data = (void *)PINCTRL_AB9540, }, 836 { .compatible = "stericsson,ab9540-gpio", .data = (void *)PINCTRL_AB9540, },
837 { }
837}; 838};
838 839
839static int abx500_gpio_probe(struct platform_device *pdev) 840static int abx500_gpio_probe(struct platform_device *pdev)
@@ -879,7 +880,6 @@ static int abx500_gpio_probe(struct platform_device *pdev)
879 pct->parent = dev_get_drvdata(pdev->dev.parent); 880 pct->parent = dev_get_drvdata(pdev->dev.parent);
880 pct->chip = abx500gpio_chip; 881 pct->chip = abx500gpio_chip;
881 pct->chip.dev = &pdev->dev; 882 pct->chip.dev = &pdev->dev;
882 pct->chip.base = pdata->gpio_base;
883 pct->chip.base = (np) ? -1 : pdata->gpio_base; 883 pct->chip.base = (np) ? -1 : pdata->gpio_base;
884 884
885 /* initialize the lock */ 885 /* initialize the lock */
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index efb7f10e902a..4d7f531e945d 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -294,7 +294,7 @@ static void at91_dt_free_map(struct pinctrl_dev *pctldev,
294{ 294{
295} 295}
296 296
297static struct pinctrl_ops at91_pctrl_ops = { 297static const struct pinctrl_ops at91_pctrl_ops = {
298 .get_groups_count = at91_get_groups_count, 298 .get_groups_count = at91_get_groups_count,
299 .get_group_name = at91_get_group_name, 299 .get_group_name = at91_get_group_name,
300 .get_group_pins = at91_get_group_pins, 300 .get_group_pins = at91_get_group_pins,
@@ -303,7 +303,7 @@ static struct pinctrl_ops at91_pctrl_ops = {
303 .dt_free_map = at91_dt_free_map, 303 .dt_free_map = at91_dt_free_map,
304}; 304};
305 305
306static void __iomem * pin_to_controller(struct at91_pinctrl *info, 306static void __iomem *pin_to_controller(struct at91_pinctrl *info,
307 unsigned int bank) 307 unsigned int bank)
308{ 308{
309 return gpio_chips[bank]->regbase; 309 return gpio_chips[bank]->regbase;
@@ -501,7 +501,7 @@ static void at91_pin_dbg(const struct device *dev, const struct at91_pmx_pin *pi
501 } 501 }
502} 502}
503 503
504static int pin_check_config(struct at91_pinctrl *info, const char* name, 504static int pin_check_config(struct at91_pinctrl *info, const char *name,
505 int index, const struct at91_pmx_pin *pin) 505 int index, const struct at91_pmx_pin *pin)
506{ 506{
507 int mux; 507 int mux;
@@ -579,7 +579,7 @@ static int at91_pmx_enable(struct pinctrl_dev *pctldev, unsigned selector,
579 pio = pin_to_controller(info, pin->bank); 579 pio = pin_to_controller(info, pin->bank);
580 mask = pin_to_mask(pin->pin); 580 mask = pin_to_mask(pin->pin);
581 at91_mux_disable_interrupt(pio, mask); 581 at91_mux_disable_interrupt(pio, mask);
582 switch(pin->mux) { 582 switch (pin->mux) {
583 case AT91_MUX_GPIO: 583 case AT91_MUX_GPIO:
584 at91_mux_gpio_enable(pio, mask, 1); 584 at91_mux_gpio_enable(pio, mask, 1);
585 break; 585 break;
@@ -696,7 +696,7 @@ static void at91_gpio_disable_free(struct pinctrl_dev *pctldev,
696 /* Set the pin to some default state, GPIO is usually default */ 696 /* Set the pin to some default state, GPIO is usually default */
697} 697}
698 698
699static struct pinmux_ops at91_pmx_ops = { 699static const struct pinmux_ops at91_pmx_ops = {
700 .get_functions_count = at91_pmx_get_funcs_count, 700 .get_functions_count = at91_pmx_get_funcs_count,
701 .get_function_name = at91_pmx_get_func_name, 701 .get_function_name = at91_pmx_get_func_name,
702 .get_function_groups = at91_pmx_get_groups, 702 .get_function_groups = at91_pmx_get_groups,
@@ -776,7 +776,7 @@ static void at91_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
776{ 776{
777} 777}
778 778
779static struct pinconf_ops at91_pinconf_ops = { 779static const struct pinconf_ops at91_pinconf_ops = {
780 .pin_config_get = at91_pinconf_get, 780 .pin_config_get = at91_pinconf_get,
781 .pin_config_set = at91_pinconf_set, 781 .pin_config_set = at91_pinconf_set,
782 .pin_config_dbg_show = at91_pinconf_dbg_show, 782 .pin_config_dbg_show = at91_pinconf_dbg_show,
@@ -812,7 +812,7 @@ static int at91_pinctrl_mux_mask(struct at91_pinctrl *info,
812{ 812{
813 int ret = 0; 813 int ret = 0;
814 int size; 814 int size;
815 const const __be32 *list; 815 const __be32 *list;
816 816
817 list = of_get_property(np, "atmel,mux-mask", &size); 817 list = of_get_property(np, "atmel,mux-mask", &size);
818 if (!list) { 818 if (!list) {
@@ -846,7 +846,7 @@ static int at91_pinctrl_parse_groups(struct device_node *np,
846{ 846{
847 struct at91_pmx_pin *pin; 847 struct at91_pmx_pin *pin;
848 int size; 848 int size;
849 const const __be32 *list; 849 const __be32 *list;
850 int i, j; 850 int i, j;
851 851
852 dev_dbg(info->dev, "group(%d): %s\n", index, np->name); 852 dev_dbg(info->dev, "group(%d): %s\n", index, np->name);
@@ -944,7 +944,7 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev,
944 return -ENODEV; 944 return -ENODEV;
945 945
946 info->dev = &pdev->dev; 946 info->dev = &pdev->dev;
947 info->ops = (struct at91_pinctrl_mux_ops*) 947 info->ops = (struct at91_pinctrl_mux_ops *)
948 of_match_device(at91_pinctrl_of_match, &pdev->dev)->data; 948 of_match_device(at91_pinctrl_of_match, &pdev->dev)->data;
949 at91_pinctrl_child_count(info, np); 949 at91_pinctrl_child_count(info, np);
950 950
@@ -1002,7 +1002,7 @@ static int at91_pinctrl_probe(struct platform_device *pdev)
1002{ 1002{
1003 struct at91_pinctrl *info; 1003 struct at91_pinctrl *info;
1004 struct pinctrl_pin_desc *pdesc; 1004 struct pinctrl_pin_desc *pdesc;
1005 int ret, i, j ,k; 1005 int ret, i, j, k;
1006 1006
1007 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); 1007 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
1008 if (!info) 1008 if (!info)
@@ -1568,7 +1568,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
1568 goto err; 1568 goto err;
1569 } 1569 }
1570 1570
1571 at91_chip->ops = (struct at91_pinctrl_mux_ops*) 1571 at91_chip->ops = (struct at91_pinctrl_mux_ops *)
1572 of_match_device(at91_gpio_of_match, &pdev->dev)->data; 1572 of_match_device(at91_gpio_of_match, &pdev->dev)->data;
1573 at91_chip->pioc_virq = irq; 1573 at91_chip->pioc_virq = irq;
1574 at91_chip->pioc_idx = alias_idx; 1574 at91_chip->pioc_idx = alias_idx;
@@ -1605,7 +1605,8 @@ static int at91_gpio_probe(struct platform_device *pdev)
1605 chip->ngpio = ngpio; 1605 chip->ngpio = ngpio;
1606 } 1606 }
1607 1607
1608 names = devm_kzalloc(&pdev->dev, sizeof(char*) * chip->ngpio, GFP_KERNEL); 1608 names = devm_kzalloc(&pdev->dev, sizeof(char *) * chip->ngpio,
1609 GFP_KERNEL);
1609 1610
1610 if (!names) { 1611 if (!names) {
1611 ret = -ENOMEM; 1612 ret = -ENOMEM;
@@ -1615,7 +1616,7 @@ static int at91_gpio_probe(struct platform_device *pdev)
1615 for (i = 0; i < chip->ngpio; i++) 1616 for (i = 0; i < chip->ngpio; i++)
1616 names[i] = kasprintf(GFP_KERNEL, "pio%c%d", alias_idx + 'A', i); 1617 names[i] = kasprintf(GFP_KERNEL, "pio%c%d", alias_idx + 'A', i);
1617 1618
1618 chip->names = (const char*const*)names; 1619 chip->names = (const char *const *)names;
1619 1620
1620 range = &at91_chip->range; 1621 range = &at91_chip->range;
1621 range->name = chip->label; 1622 range->name = chip->label;
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c
index 4eb6d2c4e4df..f28d4b08771a 100644
--- a/drivers/pinctrl/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/pinctrl-bcm2835.c
@@ -795,7 +795,7 @@ out:
795 return err; 795 return err;
796} 796}
797 797
798static struct pinctrl_ops bcm2835_pctl_ops = { 798static const struct pinctrl_ops bcm2835_pctl_ops = {
799 .get_groups_count = bcm2835_pctl_get_groups_count, 799 .get_groups_count = bcm2835_pctl_get_groups_count,
800 .get_group_name = bcm2835_pctl_get_group_name, 800 .get_group_name = bcm2835_pctl_get_group_name,
801 .get_group_pins = bcm2835_pctl_get_group_pins, 801 .get_group_pins = bcm2835_pctl_get_group_pins,
@@ -872,7 +872,7 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
872 return 0; 872 return 0;
873} 873}
874 874
875static struct pinmux_ops bcm2835_pmx_ops = { 875static const struct pinmux_ops bcm2835_pmx_ops = {
876 .get_functions_count = bcm2835_pmx_get_functions_count, 876 .get_functions_count = bcm2835_pmx_get_functions_count,
877 .get_function_name = bcm2835_pmx_get_function_name, 877 .get_function_name = bcm2835_pmx_get_function_name,
878 .get_function_groups = bcm2835_pmx_get_function_groups, 878 .get_function_groups = bcm2835_pmx_get_function_groups,
@@ -916,7 +916,7 @@ static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev,
916 return 0; 916 return 0;
917} 917}
918 918
919static struct pinconf_ops bcm2835_pinconf_ops = { 919static const struct pinconf_ops bcm2835_pinconf_ops = {
920 .pin_config_get = bcm2835_pinconf_get, 920 .pin_config_get = bcm2835_pinconf_get,
921 .pin_config_set = bcm2835_pinconf_set, 921 .pin_config_set = bcm2835_pinconf_set,
922}; 922};
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index 8b7e7bc2226b..edde3acc4186 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -318,13 +318,16 @@ static int u300_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
318 struct u300_gpio_port *port = NULL; 318 struct u300_gpio_port *port = NULL;
319 struct list_head *p; 319 struct list_head *p;
320 int retirq; 320 int retirq;
321 bool found = false;
321 322
322 list_for_each(p, &gpio->port_list) { 323 list_for_each(p, &gpio->port_list) {
323 port = list_entry(p, struct u300_gpio_port, node); 324 port = list_entry(p, struct u300_gpio_port, node);
324 if (port->number == portno) 325 if (port->number == portno) {
326 found = true;
325 break; 327 break;
328 }
326 } 329 }
327 if (port == NULL) { 330 if (!found) {
328 dev_err(gpio->dev, "could not locate port for GPIO %d IRQ\n", 331 dev_err(gpio->dev, "could not locate port for GPIO %d IRQ\n",
329 offset); 332 offset);
330 return -EINVAL; 333 return -EINVAL;
@@ -359,7 +362,7 @@ int u300_gpio_config_get(struct gpio_chip *chip,
359 drmode &= (U300_GPIO_PXPCR_PIN_MODE_MASK << ((offset & 0x07) << 1)); 362 drmode &= (U300_GPIO_PXPCR_PIN_MODE_MASK << ((offset & 0x07) << 1));
360 drmode >>= ((offset & 0x07) << 1); 363 drmode >>= ((offset & 0x07) << 1);
361 364
362 switch(param) { 365 switch (param) {
363 case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: 366 case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
364 *config = 0; 367 *config = 0;
365 if (biasmode) 368 if (biasmode)
diff --git a/drivers/pinctrl/pinctrl-exynos.c b/drivers/pinctrl/pinctrl-exynos.c
index 538b9ddaadf7..8b10b1ac9071 100644
--- a/drivers/pinctrl/pinctrl-exynos.c
+++ b/drivers/pinctrl/pinctrl-exynos.c
@@ -26,6 +26,7 @@
26#include <linux/of_irq.h> 26#include <linux/of_irq.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/spinlock.h>
29#include <linux/err.h> 30#include <linux/err.h>
30 31
31#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
@@ -33,6 +34,17 @@
33#include "pinctrl-samsung.h" 34#include "pinctrl-samsung.h"
34#include "pinctrl-exynos.h" 35#include "pinctrl-exynos.h"
35 36
37
38static struct samsung_pin_bank_type bank_type_off = {
39 .fld_width = { 4, 1, 2, 2, 2, 2, },
40 .reg_offset = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, },
41};
42
43static struct samsung_pin_bank_type bank_type_alive = {
44 .fld_width = { 4, 1, 2, 2, },
45 .reg_offset = { 0x00, 0x04, 0x08, 0x0c, },
46};
47
36/* list of external wakeup controllers supported */ 48/* list of external wakeup controllers supported */
37static const struct of_device_id exynos_wkup_irq_ids[] = { 49static const struct of_device_id exynos_wkup_irq_ids[] = {
38 { .compatible = "samsung,exynos4210-wakeup-eint", }, 50 { .compatible = "samsung,exynos4210-wakeup-eint", },
@@ -75,12 +87,14 @@ static void exynos_gpio_irq_ack(struct irq_data *irqd)
75static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type) 87static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
76{ 88{
77 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 89 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
90 struct samsung_pin_bank_type *bank_type = bank->type;
78 struct samsung_pinctrl_drv_data *d = bank->drvdata; 91 struct samsung_pinctrl_drv_data *d = bank->drvdata;
79 struct samsung_pin_ctrl *ctrl = d->ctrl; 92 struct samsung_pin_ctrl *ctrl = d->ctrl;
80 unsigned int pin = irqd->hwirq; 93 unsigned int pin = irqd->hwirq;
81 unsigned int shift = EXYNOS_EINT_CON_LEN * pin; 94 unsigned int shift = EXYNOS_EINT_CON_LEN * pin;
82 unsigned int con, trig_type; 95 unsigned int con, trig_type;
83 unsigned long reg_con = ctrl->geint_con + bank->eint_offset; 96 unsigned long reg_con = ctrl->geint_con + bank->eint_offset;
97 unsigned long flags;
84 unsigned int mask; 98 unsigned int mask;
85 99
86 switch (type) { 100 switch (type) {
@@ -114,15 +128,19 @@ static int exynos_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
114 con |= trig_type << shift; 128 con |= trig_type << shift;
115 writel(con, d->virt_base + reg_con); 129 writel(con, d->virt_base + reg_con);
116 130
117 reg_con = bank->pctl_offset; 131 reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC];
118 shift = pin * bank->func_width; 132 shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC];
119 mask = (1 << bank->func_width) - 1; 133 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
134
135 spin_lock_irqsave(&bank->slock, flags);
120 136
121 con = readl(d->virt_base + reg_con); 137 con = readl(d->virt_base + reg_con);
122 con &= ~(mask << shift); 138 con &= ~(mask << shift);
123 con |= EXYNOS_EINT_FUNC << shift; 139 con |= EXYNOS_EINT_FUNC << shift;
124 writel(con, d->virt_base + reg_con); 140 writel(con, d->virt_base + reg_con);
125 141
142 spin_unlock_irqrestore(&bank->slock, flags);
143
126 return 0; 144 return 0;
127} 145}
128 146
@@ -253,11 +271,13 @@ static void exynos_wkup_irq_ack(struct irq_data *irqd)
253static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type) 271static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type)
254{ 272{
255 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); 273 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
274 struct samsung_pin_bank_type *bank_type = bank->type;
256 struct samsung_pinctrl_drv_data *d = bank->drvdata; 275 struct samsung_pinctrl_drv_data *d = bank->drvdata;
257 unsigned int pin = irqd->hwirq; 276 unsigned int pin = irqd->hwirq;
258 unsigned long reg_con = d->ctrl->weint_con + bank->eint_offset; 277 unsigned long reg_con = d->ctrl->weint_con + bank->eint_offset;
259 unsigned long shift = EXYNOS_EINT_CON_LEN * pin; 278 unsigned long shift = EXYNOS_EINT_CON_LEN * pin;
260 unsigned long con, trig_type; 279 unsigned long con, trig_type;
280 unsigned long flags;
261 unsigned int mask; 281 unsigned int mask;
262 282
263 switch (type) { 283 switch (type) {
@@ -291,15 +311,19 @@ static int exynos_wkup_irq_set_type(struct irq_data *irqd, unsigned int type)
291 con |= trig_type << shift; 311 con |= trig_type << shift;
292 writel(con, d->virt_base + reg_con); 312 writel(con, d->virt_base + reg_con);
293 313
294 reg_con = bank->pctl_offset; 314 reg_con = bank->pctl_offset + bank_type->reg_offset[PINCFG_TYPE_FUNC];
295 shift = pin * bank->func_width; 315 shift = pin * bank_type->fld_width[PINCFG_TYPE_FUNC];
296 mask = (1 << bank->func_width) - 1; 316 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
317
318 spin_lock_irqsave(&bank->slock, flags);
297 319
298 con = readl(d->virt_base + reg_con); 320 con = readl(d->virt_base + reg_con);
299 con &= ~(mask << shift); 321 con &= ~(mask << shift);
300 con |= EXYNOS_EINT_FUNC << shift; 322 con |= EXYNOS_EINT_FUNC << shift;
301 writel(con, d->virt_base + reg_con); 323 writel(con, d->virt_base + reg_con);
302 324
325 spin_unlock_irqrestore(&bank->slock, flags);
326
303 return 0; 327 return 0;
304} 328}
305 329
diff --git a/drivers/pinctrl/pinctrl-exynos.h b/drivers/pinctrl/pinctrl-exynos.h
index 0a708890d8b4..9b1f77a5bf0f 100644
--- a/drivers/pinctrl/pinctrl-exynos.h
+++ b/drivers/pinctrl/pinctrl-exynos.h
@@ -48,26 +48,18 @@
48 48
49#define EXYNOS_PIN_BANK_EINTN(pins, reg, id) \ 49#define EXYNOS_PIN_BANK_EINTN(pins, reg, id) \
50 { \ 50 { \
51 .type = &bank_type_off, \
51 .pctl_offset = reg, \ 52 .pctl_offset = reg, \
52 .nr_pins = pins, \ 53 .nr_pins = pins, \
53 .func_width = 4, \
54 .pud_width = 2, \
55 .drv_width = 2, \
56 .conpdn_width = 2, \
57 .pudpdn_width = 2, \
58 .eint_type = EINT_TYPE_NONE, \ 54 .eint_type = EINT_TYPE_NONE, \
59 .name = id \ 55 .name = id \
60 } 56 }
61 57
62#define EXYNOS_PIN_BANK_EINTG(pins, reg, id, offs) \ 58#define EXYNOS_PIN_BANK_EINTG(pins, reg, id, offs) \
63 { \ 59 { \
60 .type = &bank_type_off, \
64 .pctl_offset = reg, \ 61 .pctl_offset = reg, \
65 .nr_pins = pins, \ 62 .nr_pins = pins, \
66 .func_width = 4, \
67 .pud_width = 2, \
68 .drv_width = 2, \
69 .conpdn_width = 2, \
70 .pudpdn_width = 2, \
71 .eint_type = EINT_TYPE_GPIO, \ 63 .eint_type = EINT_TYPE_GPIO, \
72 .eint_offset = offs, \ 64 .eint_offset = offs, \
73 .name = id \ 65 .name = id \
@@ -75,11 +67,9 @@
75 67
76#define EXYNOS_PIN_BANK_EINTW(pins, reg, id, offs) \ 68#define EXYNOS_PIN_BANK_EINTW(pins, reg, id, offs) \
77 { \ 69 { \
70 .type = &bank_type_alive, \
78 .pctl_offset = reg, \ 71 .pctl_offset = reg, \
79 .nr_pins = pins, \ 72 .nr_pins = pins, \
80 .func_width = 4, \
81 .pud_width = 2, \
82 .drv_width = 2, \
83 .eint_type = EINT_TYPE_WKUP, \ 73 .eint_type = EINT_TYPE_WKUP, \
84 .eint_offset = offs, \ 74 .eint_offset = offs, \
85 .name = id \ 75 .name = id \
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c
index 1376eb7305db..6038503ed929 100644
--- a/drivers/pinctrl/pinctrl-exynos5440.c
+++ b/drivers/pinctrl/pinctrl-exynos5440.c
@@ -20,6 +20,9 @@
20#include <linux/pinctrl/pinctrl.h> 20#include <linux/pinctrl/pinctrl.h>
21#include <linux/pinctrl/pinmux.h> 21#include <linux/pinctrl/pinmux.h>
22#include <linux/pinctrl/pinconf.h> 22#include <linux/pinctrl/pinconf.h>
23#include <linux/interrupt.h>
24#include <linux/irqdomain.h>
25#include <linux/of_irq.h>
23#include "core.h" 26#include "core.h"
24 27
25/* EXYNOS5440 GPIO and Pinctrl register offsets */ 28/* EXYNOS5440 GPIO and Pinctrl register offsets */
@@ -37,6 +40,7 @@
37#define GPIO_DS1 0x2C 40#define GPIO_DS1 0x2C
38 41
39#define EXYNOS5440_MAX_PINS 23 42#define EXYNOS5440_MAX_PINS 23
43#define EXYNOS5440_MAX_GPIO_INT 8
40#define PIN_NAME_LENGTH 10 44#define PIN_NAME_LENGTH 10
41 45
42#define GROUP_SUFFIX "-grp" 46#define GROUP_SUFFIX "-grp"
@@ -109,6 +113,7 @@ struct exynos5440_pmx_func {
109struct exynos5440_pinctrl_priv_data { 113struct exynos5440_pinctrl_priv_data {
110 void __iomem *reg_base; 114 void __iomem *reg_base;
111 struct gpio_chip *gc; 115 struct gpio_chip *gc;
116 struct irq_domain *irq_domain;
112 117
113 const struct exynos5440_pin_group *pin_groups; 118 const struct exynos5440_pin_group *pin_groups;
114 unsigned int nr_groups; 119 unsigned int nr_groups;
@@ -116,6 +121,16 @@ struct exynos5440_pinctrl_priv_data {
116 unsigned int nr_functions; 121 unsigned int nr_functions;
117}; 122};
118 123
124/**
125 * struct exynos5440_gpio_intr_data: private data for gpio interrupts.
126 * @priv: driver's private runtime data.
127 * @gpio_int: gpio interrupt number.
128 */
129struct exynos5440_gpio_intr_data {
130 struct exynos5440_pinctrl_priv_data *priv;
131 unsigned int gpio_int;
132};
133
119/* list of all possible config options supported */ 134/* list of all possible config options supported */
120static struct pin_config { 135static struct pin_config {
121 char *prop_cfg; 136 char *prop_cfg;
@@ -286,7 +301,7 @@ static void exynos5440_dt_free_map(struct pinctrl_dev *pctldev,
286} 301}
287 302
288/* list of pinctrl callbacks for the pinctrl core */ 303/* list of pinctrl callbacks for the pinctrl core */
289static struct pinctrl_ops exynos5440_pctrl_ops = { 304static const struct pinctrl_ops exynos5440_pctrl_ops = {
290 .get_groups_count = exynos5440_get_group_count, 305 .get_groups_count = exynos5440_get_group_count,
291 .get_group_name = exynos5440_get_group_name, 306 .get_group_name = exynos5440_get_group_name,
292 .get_group_pins = exynos5440_get_group_pins, 307 .get_group_pins = exynos5440_get_group_pins,
@@ -374,7 +389,7 @@ static int exynos5440_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
374} 389}
375 390
376/* list of pinmux callbacks for the pinmux vertical in pinctrl core */ 391/* list of pinmux callbacks for the pinmux vertical in pinctrl core */
377static struct pinmux_ops exynos5440_pinmux_ops = { 392static const struct pinmux_ops exynos5440_pinmux_ops = {
378 .get_functions_count = exynos5440_get_functions_count, 393 .get_functions_count = exynos5440_get_functions_count,
379 .get_function_name = exynos5440_pinmux_get_fname, 394 .get_function_name = exynos5440_pinmux_get_fname,
380 .get_function_groups = exynos5440_pinmux_get_groups, 395 .get_function_groups = exynos5440_pinmux_get_groups,
@@ -523,7 +538,7 @@ static int exynos5440_pinconf_group_get(struct pinctrl_dev *pctldev,
523} 538}
524 539
525/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */ 540/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */
526static struct pinconf_ops exynos5440_pinconf_ops = { 541static const struct pinconf_ops exynos5440_pinconf_ops = {
527 .pin_config_get = exynos5440_pinconf_get, 542 .pin_config_get = exynos5440_pinconf_get,
528 .pin_config_set = exynos5440_pinconf_set, 543 .pin_config_set = exynos5440_pinconf_set,
529 .pin_config_group_get = exynos5440_pinconf_group_get, 544 .pin_config_group_get = exynos5440_pinconf_group_get,
@@ -598,6 +613,22 @@ static int exynos5440_gpio_direction_output(struct gpio_chip *gc, unsigned offse
598 return 0; 613 return 0;
599} 614}
600 615
616/* gpiolib gpio_to_irq callback function */
617static int exynos5440_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
618{
619 struct exynos5440_pinctrl_priv_data *priv = dev_get_drvdata(gc->dev);
620 unsigned int virq;
621
622 if (offset < 16 || offset > 23)
623 return -ENXIO;
624
625 if (!priv->irq_domain)
626 return -ENXIO;
627
628 virq = irq_create_mapping(priv->irq_domain, offset - 16);
629 return virq ? : -ENXIO;
630}
631
601/* parse the pin numbers listed in the 'samsung,exynos5440-pins' property */ 632/* parse the pin numbers listed in the 'samsung,exynos5440-pins' property */
602static int exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev, 633static int exynos5440_pinctrl_parse_dt_pins(struct platform_device *pdev,
603 struct device_node *cfg_np, unsigned int **pin_list, 634 struct device_node *cfg_np, unsigned int **pin_list,
@@ -670,8 +701,10 @@ static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
670 701
671 ret = exynos5440_pinctrl_parse_dt_pins(pdev, cfg_np, 702 ret = exynos5440_pinctrl_parse_dt_pins(pdev, cfg_np,
672 &pin_list, &npins); 703 &pin_list, &npins);
673 if (ret) 704 if (ret) {
674 return ret; 705 gname = NULL;
706 goto skip_to_pin_function;
707 }
675 708
676 /* derive pin group name from the node name */ 709 /* derive pin group name from the node name */
677 gname = devm_kzalloc(dev, strlen(cfg_np->name) + GSUFFIX_LEN, 710 gname = devm_kzalloc(dev, strlen(cfg_np->name) + GSUFFIX_LEN,
@@ -687,6 +720,7 @@ static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
687 grp->num_pins = npins; 720 grp->num_pins = npins;
688 grp++; 721 grp++;
689 722
723skip_to_pin_function:
690 ret = of_property_read_u32(cfg_np, "samsung,exynos5440-pin-function", 724 ret = of_property_read_u32(cfg_np, "samsung,exynos5440-pin-function",
691 &function); 725 &function);
692 if (ret) 726 if (ret)
@@ -709,7 +743,7 @@ static int exynos5440_pinctrl_parse_dt(struct platform_device *pdev,
709 return -ENOMEM; 743 return -ENOMEM;
710 } 744 }
711 func->groups[0] = gname; 745 func->groups[0] = gname;
712 func->num_groups = 1; 746 func->num_groups = gname ? 1 : 0;
713 func->function = function; 747 func->function = function;
714 func++; 748 func++;
715 func_idx++; 749 func_idx++;
@@ -818,6 +852,7 @@ static int exynos5440_gpiolib_register(struct platform_device *pdev,
818 gc->get = exynos5440_gpio_get; 852 gc->get = exynos5440_gpio_get;
819 gc->direction_input = exynos5440_gpio_direction_input; 853 gc->direction_input = exynos5440_gpio_direction_input;
820 gc->direction_output = exynos5440_gpio_direction_output; 854 gc->direction_output = exynos5440_gpio_direction_output;
855 gc->to_irq = exynos5440_gpio_to_irq;
821 gc->label = "gpiolib-exynos5440"; 856 gc->label = "gpiolib-exynos5440";
822 gc->owner = THIS_MODULE; 857 gc->owner = THIS_MODULE;
823 ret = gpiochip_add(gc); 858 ret = gpiochip_add(gc);
@@ -842,6 +877,110 @@ static int exynos5440_gpiolib_unregister(struct platform_device *pdev,
842 return 0; 877 return 0;
843} 878}
844 879
880static void exynos5440_gpio_irq_unmask(struct irq_data *irqd)
881{
882 struct exynos5440_pinctrl_priv_data *d;
883 unsigned long gpio_int;
884
885 d = irq_data_get_irq_chip_data(irqd);
886 gpio_int = readl(d->reg_base + GPIO_INT);
887 gpio_int |= 1 << irqd->hwirq;
888 writel(gpio_int, d->reg_base + GPIO_INT);
889}
890
891static void exynos5440_gpio_irq_mask(struct irq_data *irqd)
892{
893 struct exynos5440_pinctrl_priv_data *d;
894 unsigned long gpio_int;
895
896 d = irq_data_get_irq_chip_data(irqd);
897 gpio_int = readl(d->reg_base + GPIO_INT);
898 gpio_int &= ~(1 << irqd->hwirq);
899 writel(gpio_int, d->reg_base + GPIO_INT);
900}
901
902/* irq_chip for gpio interrupts */
903static struct irq_chip exynos5440_gpio_irq_chip = {
904 .name = "exynos5440_gpio_irq_chip",
905 .irq_unmask = exynos5440_gpio_irq_unmask,
906 .irq_mask = exynos5440_gpio_irq_mask,
907};
908
909/* interrupt handler for GPIO interrupts 0..7 */
910static irqreturn_t exynos5440_gpio_irq(int irq, void *data)
911{
912 struct exynos5440_gpio_intr_data *intd = data;
913 struct exynos5440_pinctrl_priv_data *d = intd->priv;
914 int virq;
915
916 virq = irq_linear_revmap(d->irq_domain, intd->gpio_int);
917 if (!virq)
918 return IRQ_NONE;
919 generic_handle_irq(virq);
920 return IRQ_HANDLED;
921}
922
923static int exynos5440_gpio_irq_map(struct irq_domain *h, unsigned int virq,
924 irq_hw_number_t hw)
925{
926 struct exynos5440_pinctrl_priv_data *d = h->host_data;
927
928 irq_set_chip_data(virq, d);
929 irq_set_chip_and_handler(virq, &exynos5440_gpio_irq_chip,
930 handle_level_irq);
931 set_irq_flags(virq, IRQF_VALID);
932 return 0;
933}
934
935/* irq domain callbacks for gpio interrupt controller */
936static const struct irq_domain_ops exynos5440_gpio_irqd_ops = {
937 .map = exynos5440_gpio_irq_map,
938 .xlate = irq_domain_xlate_twocell,
939};
940
941/* setup handling of gpio interrupts */
942static int exynos5440_gpio_irq_init(struct platform_device *pdev,
943 struct exynos5440_pinctrl_priv_data *priv)
944{
945 struct device *dev = &pdev->dev;
946 struct exynos5440_gpio_intr_data *intd;
947 int i, irq, ret;
948
949 intd = devm_kzalloc(dev, sizeof(*intd) * EXYNOS5440_MAX_GPIO_INT,
950 GFP_KERNEL);
951 if (!intd) {
952 dev_err(dev, "failed to allocate memory for gpio intr data\n");
953 return -ENOMEM;
954 }
955
956 for (i = 0; i < EXYNOS5440_MAX_GPIO_INT; i++) {
957 irq = irq_of_parse_and_map(dev->of_node, i);
958 if (irq <= 0) {
959 dev_err(dev, "irq parsing failed\n");
960 return -EINVAL;
961 }
962
963 intd->gpio_int = i;
964 intd->priv = priv;
965 ret = devm_request_irq(dev, irq, exynos5440_gpio_irq,
966 0, dev_name(dev), intd++);
967 if (ret) {
968 dev_err(dev, "irq request failed\n");
969 return -ENXIO;
970 }
971 }
972
973 priv->irq_domain = irq_domain_add_linear(dev->of_node,
974 EXYNOS5440_MAX_GPIO_INT,
975 &exynos5440_gpio_irqd_ops, priv);
976 if (!priv->irq_domain) {
977 dev_err(dev, "failed to create irq domain\n");
978 return -ENXIO;
979 }
980
981 return 0;
982}
983
845static int exynos5440_pinctrl_probe(struct platform_device *pdev) 984static int exynos5440_pinctrl_probe(struct platform_device *pdev)
846{ 985{
847 struct device *dev = &pdev->dev; 986 struct device *dev = &pdev->dev;
@@ -854,7 +993,7 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev)
854 return -ENODEV; 993 return -ENODEV;
855 } 994 }
856 995
857 priv = devm_kzalloc(dev, sizeof(priv), GFP_KERNEL); 996 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
858 if (!priv) { 997 if (!priv) {
859 dev_err(dev, "could not allocate memory for private data\n"); 998 dev_err(dev, "could not allocate memory for private data\n");
860 return -ENOMEM; 999 return -ENOMEM;
@@ -880,6 +1019,12 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev)
880 return ret; 1019 return ret;
881 } 1020 }
882 1021
1022 ret = exynos5440_gpio_irq_init(pdev, priv);
1023 if (ret) {
1024 dev_err(dev, "failed to setup gpio interrupts\n");
1025 return ret;
1026 }
1027
883 platform_set_drvdata(pdev, priv); 1028 platform_set_drvdata(pdev, priv);
884 dev_info(dev, "EXYNOS5440 pinctrl driver registered\n"); 1029 dev_info(dev, "EXYNOS5440 pinctrl driver registered\n");
885 return 0; 1030 return 0;
diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c
index af97a1f90007..f9b2a1d4854f 100644
--- a/drivers/pinctrl/pinctrl-falcon.c
+++ b/drivers/pinctrl/pinctrl-falcon.c
@@ -353,7 +353,7 @@ static void falcon_pinconf_group_dbg_show(struct pinctrl_dev *pctrldev,
353{ 353{
354} 354}
355 355
356static struct pinconf_ops falcon_pinconf_ops = { 356static const struct pinconf_ops falcon_pinconf_ops = {
357 .pin_config_get = falcon_pinconf_get, 357 .pin_config_get = falcon_pinconf_get,
358 .pin_config_set = falcon_pinconf_set, 358 .pin_config_set = falcon_pinconf_set,
359 .pin_config_group_get = falcon_pinconf_group_get, 359 .pin_config_group_get = falcon_pinconf_group_get,
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index 4cebb9c6c5c5..0ef190449eab 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -207,7 +207,7 @@ static void imx_dt_free_map(struct pinctrl_dev *pctldev,
207 kfree(map); 207 kfree(map);
208} 208}
209 209
210static struct pinctrl_ops imx_pctrl_ops = { 210static const struct pinctrl_ops imx_pctrl_ops = {
211 .get_groups_count = imx_get_groups_count, 211 .get_groups_count = imx_get_groups_count,
212 .get_group_name = imx_get_group_name, 212 .get_group_name = imx_get_group_name,
213 .get_group_pins = imx_get_group_pins, 213 .get_group_pins = imx_get_group_pins,
@@ -299,7 +299,7 @@ static int imx_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
299 return 0; 299 return 0;
300} 300}
301 301
302static struct pinmux_ops imx_pmx_ops = { 302static const struct pinmux_ops imx_pmx_ops = {
303 .get_functions_count = imx_pmx_get_funcs_count, 303 .get_functions_count = imx_pmx_get_funcs_count,
304 .get_function_name = imx_pmx_get_func_name, 304 .get_function_name = imx_pmx_get_func_name,
305 .get_function_groups = imx_pmx_get_groups, 305 .get_function_groups = imx_pmx_get_groups,
@@ -397,7 +397,7 @@ static void imx_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
397 } 397 }
398} 398}
399 399
400static struct pinconf_ops imx_pinconf_ops = { 400static const struct pinconf_ops imx_pinconf_ops = {
401 .pin_config_get = imx_pinconf_get, 401 .pin_config_get = imx_pinconf_get,
402 .pin_config_set = imx_pinconf_set, 402 .pin_config_set = imx_pinconf_set,
403 .pin_config_dbg_show = imx_pinconf_dbg_show, 403 .pin_config_dbg_show = imx_pinconf_dbg_show,
diff --git a/drivers/pinctrl/pinctrl-lantiq.c b/drivers/pinctrl/pinctrl-lantiq.c
index a70384611351..615c5002b757 100644
--- a/drivers/pinctrl/pinctrl-lantiq.c
+++ b/drivers/pinctrl/pinctrl-lantiq.c
@@ -169,7 +169,7 @@ static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
169 return 0; 169 return 0;
170} 170}
171 171
172static struct pinctrl_ops ltq_pctrl_ops = { 172static const struct pinctrl_ops ltq_pctrl_ops = {
173 .get_groups_count = ltq_get_group_count, 173 .get_groups_count = ltq_get_group_count,
174 .get_group_name = ltq_get_group_name, 174 .get_group_name = ltq_get_group_name,
175 .get_group_pins = ltq_get_group_pins, 175 .get_group_pins = ltq_get_group_pins,
@@ -311,7 +311,7 @@ static int ltq_pmx_gpio_request_enable(struct pinctrl_dev *pctrldev,
311 return info->apply_mux(pctrldev, mfp, pin_func); 311 return info->apply_mux(pctrldev, mfp, pin_func);
312} 312}
313 313
314static struct pinmux_ops ltq_pmx_ops = { 314static const struct pinmux_ops ltq_pmx_ops = {
315 .get_functions_count = ltq_pmx_func_count, 315 .get_functions_count = ltq_pmx_func_count,
316 .get_function_name = ltq_pmx_func_name, 316 .get_function_name = ltq_pmx_func_name,
317 .get_function_groups = ltq_pmx_get_groups, 317 .get_function_groups = ltq_pmx_get_groups,
diff --git a/drivers/pinctrl/pinctrl-mmp2.c b/drivers/pinctrl/pinctrl-mmp2.c
deleted file mode 100644
index 4afa56a3a51d..000000000000
--- a/drivers/pinctrl/pinctrl-mmp2.c
+++ /dev/null
@@ -1,722 +0,0 @@
1/*
2 * linux/drivers/pinctrl/pinmux-mmp2.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#include <linux/device.h>
15#include <linux/module.h>
16#include <linux/io.h>
17#include <linux/platform_device.h>
18#include "pinctrl-pxa3xx.h"
19
20#define MMP2_DS_MASK 0x1800
21#define MMP2_DS_SHIFT 11
22#define MMP2_SLEEP_MASK 0x38
23#define MMP2_SLEEP_SELECT (1 << 9)
24#define MMP2_SLEEP_DATA (1 << 8)
25#define MMP2_SLEEP_DIR (1 << 7)
26
27#define MFPR_MMP2(a, r, f0, f1, f2, f3, f4, f5, f6, f7) \
28 { \
29 .name = #a, \
30 .pin = a, \
31 .mfpr = r, \
32 .func = { \
33 MMP2_MUX_##f0, \
34 MMP2_MUX_##f1, \
35 MMP2_MUX_##f2, \
36 MMP2_MUX_##f3, \
37 MMP2_MUX_##f4, \
38 MMP2_MUX_##f5, \
39 MMP2_MUX_##f6, \
40 MMP2_MUX_##f7, \
41 }, \
42 }
43
44#define GRP_MMP2(a, m, p) \
45 { .name = a, .mux = MMP2_MUX_##m, .pins = p, .npins = ARRAY_SIZE(p), }
46
47/* 174 pins */
48enum mmp2_pin_list {
49 /* 0~168: GPIO0~GPIO168 */
50 TWSI4_SCL = 169,
51 TWSI4_SDA, /* 170 */
52 G_CLKREQ,
53 VCXO_REQ,
54 VCXO_OUT,
55};
56
57enum mmp2_mux {
58 /* PXA3xx_MUX_GPIO = 0 (predefined in pinctrl-pxa3xx.h) */
59 MMP2_MUX_GPIO = 0,
60 MMP2_MUX_G_CLKREQ,
61 MMP2_MUX_VCXO_REQ,
62 MMP2_MUX_VCXO_OUT,
63 MMP2_MUX_KP_MK,
64 MMP2_MUX_KP_DK,
65 MMP2_MUX_CCIC1,
66 MMP2_MUX_CCIC2,
67 MMP2_MUX_SPI,
68 MMP2_MUX_SSPA2,
69 MMP2_MUX_ROT,
70 MMP2_MUX_I2S,
71 MMP2_MUX_TB,
72 MMP2_MUX_CAM2,
73 MMP2_MUX_HDMI,
74 MMP2_MUX_TWSI2,
75 MMP2_MUX_TWSI3,
76 MMP2_MUX_TWSI4,
77 MMP2_MUX_TWSI5,
78 MMP2_MUX_TWSI6,
79 MMP2_MUX_UART1,
80 MMP2_MUX_UART2,
81 MMP2_MUX_UART3,
82 MMP2_MUX_UART4,
83 MMP2_MUX_SSP1_RX,
84 MMP2_MUX_SSP1_FRM,
85 MMP2_MUX_SSP1_TXRX,
86 MMP2_MUX_SSP2_RX,
87 MMP2_MUX_SSP2_FRM,
88 MMP2_MUX_SSP1,
89 MMP2_MUX_SSP2,
90 MMP2_MUX_SSP3,
91 MMP2_MUX_SSP4,
92 MMP2_MUX_MMC1,
93 MMP2_MUX_MMC2,
94 MMP2_MUX_MMC3,
95 MMP2_MUX_MMC4,
96 MMP2_MUX_ULPI,
97 MMP2_MUX_AC,
98 MMP2_MUX_CA,
99 MMP2_MUX_PWM,
100 MMP2_MUX_USIM,
101 MMP2_MUX_TIPU,
102 MMP2_MUX_PLL,
103 MMP2_MUX_NAND,
104 MMP2_MUX_FSIC,
105 MMP2_MUX_SLEEP_IND,
106 MMP2_MUX_EXT_DMA,
107 MMP2_MUX_ONE_WIRE,
108 MMP2_MUX_LCD,
109 MMP2_MUX_SMC,
110 MMP2_MUX_SMC_INT,
111 MMP2_MUX_MSP,
112 MMP2_MUX_G_CLKOUT,
113 MMP2_MUX_32K_CLKOUT,
114 MMP2_MUX_PRI_JTAG,
115 MMP2_MUX_AAS_JTAG,
116 MMP2_MUX_AAS_GPIO,
117 MMP2_MUX_AAS_SPI,
118 MMP2_MUX_AAS_TWSI,
119 MMP2_MUX_AAS_DEU_EX,
120 MMP2_MUX_NONE = 0xffff,
121};
122
123static struct pinctrl_pin_desc mmp2_pads[] = {
124 /*
125 * The name indicates function 0 of this pin.
126 * After reset, function 0 is the default function of pin.
127 */
128 PINCTRL_PIN(GPIO0, "GPIO0"),
129 PINCTRL_PIN(GPIO1, "GPIO1"),
130 PINCTRL_PIN(GPIO2, "GPIO2"),
131 PINCTRL_PIN(GPIO3, "GPIO3"),
132 PINCTRL_PIN(GPIO4, "GPIO4"),
133 PINCTRL_PIN(GPIO5, "GPIO5"),
134 PINCTRL_PIN(GPIO6, "GPIO6"),
135 PINCTRL_PIN(GPIO7, "GPIO7"),
136 PINCTRL_PIN(GPIO8, "GPIO8"),
137 PINCTRL_PIN(GPIO9, "GPIO9"),
138 PINCTRL_PIN(GPIO10, "GPIO10"),
139 PINCTRL_PIN(GPIO11, "GPIO11"),
140 PINCTRL_PIN(GPIO12, "GPIO12"),
141 PINCTRL_PIN(GPIO13, "GPIO13"),
142 PINCTRL_PIN(GPIO14, "GPIO14"),
143 PINCTRL_PIN(GPIO15, "GPIO15"),
144 PINCTRL_PIN(GPIO16, "GPIO16"),
145 PINCTRL_PIN(GPIO17, "GPIO17"),
146 PINCTRL_PIN(GPIO18, "GPIO18"),
147 PINCTRL_PIN(GPIO19, "GPIO19"),
148 PINCTRL_PIN(GPIO20, "GPIO20"),
149 PINCTRL_PIN(GPIO21, "GPIO21"),
150 PINCTRL_PIN(GPIO22, "GPIO22"),
151 PINCTRL_PIN(GPIO23, "GPIO23"),
152 PINCTRL_PIN(GPIO24, "GPIO24"),
153 PINCTRL_PIN(GPIO25, "GPIO25"),
154 PINCTRL_PIN(GPIO26, "GPIO26"),
155 PINCTRL_PIN(GPIO27, "GPIO27"),
156 PINCTRL_PIN(GPIO28, "GPIO28"),
157 PINCTRL_PIN(GPIO29, "GPIO29"),
158 PINCTRL_PIN(GPIO30, "GPIO30"),
159 PINCTRL_PIN(GPIO31, "GPIO31"),
160 PINCTRL_PIN(GPIO32, "GPIO32"),
161 PINCTRL_PIN(GPIO33, "GPIO33"),
162 PINCTRL_PIN(GPIO34, "GPIO34"),
163 PINCTRL_PIN(GPIO35, "GPIO35"),
164 PINCTRL_PIN(GPIO36, "GPIO36"),
165 PINCTRL_PIN(GPIO37, "GPIO37"),
166 PINCTRL_PIN(GPIO38, "GPIO38"),
167 PINCTRL_PIN(GPIO39, "GPIO39"),
168 PINCTRL_PIN(GPIO40, "GPIO40"),
169 PINCTRL_PIN(GPIO41, "GPIO41"),
170 PINCTRL_PIN(GPIO42, "GPIO42"),
171 PINCTRL_PIN(GPIO43, "GPIO43"),
172 PINCTRL_PIN(GPIO44, "GPIO44"),
173 PINCTRL_PIN(GPIO45, "GPIO45"),
174 PINCTRL_PIN(GPIO46, "GPIO46"),
175 PINCTRL_PIN(GPIO47, "GPIO47"),
176 PINCTRL_PIN(GPIO48, "GPIO48"),
177 PINCTRL_PIN(GPIO49, "GPIO49"),
178 PINCTRL_PIN(GPIO50, "GPIO50"),
179 PINCTRL_PIN(GPIO51, "GPIO51"),
180 PINCTRL_PIN(GPIO52, "GPIO52"),
181 PINCTRL_PIN(GPIO53, "GPIO53"),
182 PINCTRL_PIN(GPIO54, "GPIO54"),
183 PINCTRL_PIN(GPIO55, "GPIO55"),
184 PINCTRL_PIN(GPIO56, "GPIO56"),
185 PINCTRL_PIN(GPIO57, "GPIO57"),
186 PINCTRL_PIN(GPIO58, "GPIO58"),
187 PINCTRL_PIN(GPIO59, "GPIO59"),
188 PINCTRL_PIN(GPIO60, "GPIO60"),
189 PINCTRL_PIN(GPIO61, "GPIO61"),
190 PINCTRL_PIN(GPIO62, "GPIO62"),
191 PINCTRL_PIN(GPIO63, "GPIO63"),
192 PINCTRL_PIN(GPIO64, "GPIO64"),
193 PINCTRL_PIN(GPIO65, "GPIO65"),
194 PINCTRL_PIN(GPIO66, "GPIO66"),
195 PINCTRL_PIN(GPIO67, "GPIO67"),
196 PINCTRL_PIN(GPIO68, "GPIO68"),
197 PINCTRL_PIN(GPIO69, "GPIO69"),
198 PINCTRL_PIN(GPIO70, "GPIO70"),
199 PINCTRL_PIN(GPIO71, "GPIO71"),
200 PINCTRL_PIN(GPIO72, "GPIO72"),
201 PINCTRL_PIN(GPIO73, "GPIO73"),
202 PINCTRL_PIN(GPIO74, "GPIO74"),
203 PINCTRL_PIN(GPIO75, "GPIO75"),
204 PINCTRL_PIN(GPIO76, "GPIO76"),
205 PINCTRL_PIN(GPIO77, "GPIO77"),
206 PINCTRL_PIN(GPIO78, "GPIO78"),
207 PINCTRL_PIN(GPIO79, "GPIO79"),
208 PINCTRL_PIN(GPIO80, "GPIO80"),
209 PINCTRL_PIN(GPIO81, "GPIO81"),
210 PINCTRL_PIN(GPIO82, "GPIO82"),
211 PINCTRL_PIN(GPIO83, "GPIO83"),
212 PINCTRL_PIN(GPIO84, "GPIO84"),
213 PINCTRL_PIN(GPIO85, "GPIO85"),
214 PINCTRL_PIN(GPIO86, "GPIO86"),
215 PINCTRL_PIN(GPIO87, "GPIO87"),
216 PINCTRL_PIN(GPIO88, "GPIO88"),
217 PINCTRL_PIN(GPIO89, "GPIO89"),
218 PINCTRL_PIN(GPIO90, "GPIO90"),
219 PINCTRL_PIN(GPIO91, "GPIO91"),
220 PINCTRL_PIN(GPIO92, "GPIO92"),
221 PINCTRL_PIN(GPIO93, "GPIO93"),
222 PINCTRL_PIN(GPIO94, "GPIO94"),
223 PINCTRL_PIN(GPIO95, "GPIO95"),
224 PINCTRL_PIN(GPIO96, "GPIO96"),
225 PINCTRL_PIN(GPIO97, "GPIO97"),
226 PINCTRL_PIN(GPIO98, "GPIO98"),
227 PINCTRL_PIN(GPIO99, "GPIO99"),
228 PINCTRL_PIN(GPIO100, "GPIO100"),
229 PINCTRL_PIN(GPIO101, "GPIO101"),
230 PINCTRL_PIN(GPIO102, "GPIO102"),
231 PINCTRL_PIN(GPIO103, "GPIO103"),
232 PINCTRL_PIN(GPIO104, "GPIO104"),
233 PINCTRL_PIN(GPIO105, "GPIO105"),
234 PINCTRL_PIN(GPIO106, "GPIO106"),
235 PINCTRL_PIN(GPIO107, "GPIO107"),
236 PINCTRL_PIN(GPIO108, "GPIO108"),
237 PINCTRL_PIN(GPIO109, "GPIO109"),
238 PINCTRL_PIN(GPIO110, "GPIO110"),
239 PINCTRL_PIN(GPIO111, "GPIO111"),
240 PINCTRL_PIN(GPIO112, "GPIO112"),
241 PINCTRL_PIN(GPIO113, "GPIO113"),
242 PINCTRL_PIN(GPIO114, "GPIO114"),
243 PINCTRL_PIN(GPIO115, "GPIO115"),
244 PINCTRL_PIN(GPIO116, "GPIO116"),
245 PINCTRL_PIN(GPIO117, "GPIO117"),
246 PINCTRL_PIN(GPIO118, "GPIO118"),
247 PINCTRL_PIN(GPIO119, "GPIO119"),
248 PINCTRL_PIN(GPIO120, "GPIO120"),
249 PINCTRL_PIN(GPIO121, "GPIO121"),
250 PINCTRL_PIN(GPIO122, "GPIO122"),
251 PINCTRL_PIN(GPIO123, "GPIO123"),
252 PINCTRL_PIN(GPIO124, "GPIO124"),
253 PINCTRL_PIN(GPIO125, "GPIO125"),
254 PINCTRL_PIN(GPIO126, "GPIO126"),
255 PINCTRL_PIN(GPIO127, "GPIO127"),
256 PINCTRL_PIN(GPIO128, "GPIO128"),
257 PINCTRL_PIN(GPIO129, "GPIO129"),
258 PINCTRL_PIN(GPIO130, "GPIO130"),
259 PINCTRL_PIN(GPIO131, "GPIO131"),
260 PINCTRL_PIN(GPIO132, "GPIO132"),
261 PINCTRL_PIN(GPIO133, "GPIO133"),
262 PINCTRL_PIN(GPIO134, "GPIO134"),
263 PINCTRL_PIN(GPIO135, "GPIO135"),
264 PINCTRL_PIN(GPIO136, "GPIO136"),
265 PINCTRL_PIN(GPIO137, "GPIO137"),
266 PINCTRL_PIN(GPIO138, "GPIO138"),
267 PINCTRL_PIN(GPIO139, "GPIO139"),
268 PINCTRL_PIN(GPIO140, "GPIO140"),
269 PINCTRL_PIN(GPIO141, "GPIO141"),
270 PINCTRL_PIN(GPIO142, "GPIO142"),
271 PINCTRL_PIN(GPIO143, "GPIO143"),
272 PINCTRL_PIN(GPIO144, "GPIO144"),
273 PINCTRL_PIN(GPIO145, "GPIO145"),
274 PINCTRL_PIN(GPIO146, "GPIO146"),
275 PINCTRL_PIN(GPIO147, "GPIO147"),
276 PINCTRL_PIN(GPIO148, "GPIO148"),
277 PINCTRL_PIN(GPIO149, "GPIO149"),
278 PINCTRL_PIN(GPIO150, "GPIO150"),
279 PINCTRL_PIN(GPIO151, "GPIO151"),
280 PINCTRL_PIN(GPIO152, "GPIO152"),
281 PINCTRL_PIN(GPIO153, "GPIO153"),
282 PINCTRL_PIN(GPIO154, "GPIO154"),
283 PINCTRL_PIN(GPIO155, "GPIO155"),
284 PINCTRL_PIN(GPIO156, "GPIO156"),
285 PINCTRL_PIN(GPIO157, "GPIO157"),
286 PINCTRL_PIN(GPIO158, "GPIO158"),
287 PINCTRL_PIN(GPIO159, "GPIO159"),
288 PINCTRL_PIN(GPIO160, "GPIO160"),
289 PINCTRL_PIN(GPIO161, "GPIO161"),
290 PINCTRL_PIN(GPIO162, "GPIO162"),
291 PINCTRL_PIN(GPIO163, "GPIO163"),
292 PINCTRL_PIN(GPIO164, "GPIO164"),
293 PINCTRL_PIN(GPIO165, "GPIO165"),
294 PINCTRL_PIN(GPIO166, "GPIO166"),
295 PINCTRL_PIN(GPIO167, "GPIO167"),
296 PINCTRL_PIN(GPIO168, "GPIO168"),
297 PINCTRL_PIN(TWSI4_SCL, "TWSI4_SCL"),
298 PINCTRL_PIN(TWSI4_SDA, "TWSI4_SDA"),
299 PINCTRL_PIN(G_CLKREQ, "G_CLKREQ"),
300 PINCTRL_PIN(VCXO_REQ, "VCXO_REQ"),
301 PINCTRL_PIN(VCXO_OUT, "VCXO_OUT"),
302};
303
304struct pxa3xx_mfp_pin mmp2_mfp[] = {
305 /* pin offs f0 f1 f2 f3 f4 f5 f6 f7 */
306 MFPR_MMP2(GPIO0, 0x054, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
307 MFPR_MMP2(GPIO1, 0x058, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
308 MFPR_MMP2(GPIO2, 0x05C, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
309 MFPR_MMP2(GPIO3, 0x060, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
310 MFPR_MMP2(GPIO4, 0x064, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
311 MFPR_MMP2(GPIO5, 0x068, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
312 MFPR_MMP2(GPIO6, 0x06C, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
313 MFPR_MMP2(GPIO7, 0x070, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
314 MFPR_MMP2(GPIO8, 0x074, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
315 MFPR_MMP2(GPIO9, 0x078, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
316 MFPR_MMP2(GPIO10, 0x07C, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
317 MFPR_MMP2(GPIO11, 0x080, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
318 MFPR_MMP2(GPIO12, 0x084, GPIO, KP_MK, NONE, CCIC1, NONE, NONE, NONE, NONE),
319 MFPR_MMP2(GPIO13, 0x088, GPIO, KP_MK, NONE, CCIC1, NONE, NONE, NONE, NONE),
320 MFPR_MMP2(GPIO14, 0x08C, GPIO, KP_MK, NONE, CCIC1, NONE, NONE, NONE, NONE),
321 MFPR_MMP2(GPIO15, 0x090, GPIO, KP_MK, KP_DK, CCIC1, NONE, NONE, NONE, NONE),
322 MFPR_MMP2(GPIO16, 0x094, GPIO, KP_DK, ROT, CCIC1, NONE, NONE, NONE, NONE),
323 MFPR_MMP2(GPIO17, 0x098, GPIO, KP_DK, ROT, CCIC1, NONE, NONE, NONE, NONE),
324 MFPR_MMP2(GPIO18, 0x09C, GPIO, KP_DK, ROT, CCIC1, NONE, NONE, NONE, NONE),
325 MFPR_MMP2(GPIO19, 0x0A0, GPIO, KP_DK, ROT, CCIC1, NONE, NONE, NONE, NONE),
326 MFPR_MMP2(GPIO20, 0x0A4, GPIO, KP_DK, TB, CCIC1, NONE, NONE, NONE, NONE),
327 MFPR_MMP2(GPIO21, 0x0A8, GPIO, KP_DK, TB, CCIC1, NONE, NONE, NONE, NONE),
328 MFPR_MMP2(GPIO22, 0x0AC, GPIO, KP_DK, TB, CCIC1, NONE, NONE, NONE, NONE),
329 MFPR_MMP2(GPIO23, 0x0B0, GPIO, KP_DK, TB, CCIC1, NONE, NONE, NONE, NONE),
330 MFPR_MMP2(GPIO24, 0x0B4, GPIO, I2S, VCXO_OUT, NONE, NONE, NONE, NONE, NONE),
331 MFPR_MMP2(GPIO25, 0x0B8, GPIO, I2S, HDMI, SSPA2, NONE, NONE, NONE, NONE),
332 MFPR_MMP2(GPIO26, 0x0BC, GPIO, I2S, HDMI, SSPA2, NONE, NONE, NONE, NONE),
333 MFPR_MMP2(GPIO27, 0x0C0, GPIO, I2S, HDMI, SSPA2, NONE, NONE, NONE, NONE),
334 MFPR_MMP2(GPIO28, 0x0C4, GPIO, I2S, NONE, SSPA2, NONE, NONE, NONE, NONE),
335 MFPR_MMP2(GPIO29, 0x0C8, GPIO, UART1, KP_MK, NONE, NONE, NONE, AAS_SPI, NONE),
336 MFPR_MMP2(GPIO30, 0x0CC, GPIO, UART1, KP_MK, NONE, NONE, NONE, AAS_SPI, NONE),
337 MFPR_MMP2(GPIO31, 0x0D0, GPIO, UART1, KP_MK, NONE, NONE, NONE, AAS_SPI, NONE),
338 MFPR_MMP2(GPIO32, 0x0D4, GPIO, UART1, KP_MK, NONE, NONE, NONE, AAS_SPI, NONE),
339 MFPR_MMP2(GPIO33, 0x0D8, GPIO, SSPA2, I2S, NONE, NONE, NONE, NONE, NONE),
340 MFPR_MMP2(GPIO34, 0x0DC, GPIO, SSPA2, I2S, NONE, NONE, NONE, NONE, NONE),
341 MFPR_MMP2(GPIO35, 0x0E0, GPIO, SSPA2, I2S, NONE, NONE, NONE, NONE, NONE),
342 MFPR_MMP2(GPIO36, 0x0E4, GPIO, SSPA2, I2S, NONE, NONE, NONE, NONE, NONE),
343 MFPR_MMP2(GPIO37, 0x0E8, GPIO, MMC2, SSP1, TWSI2, UART2, UART3, AAS_SPI, AAS_TWSI),
344 MFPR_MMP2(GPIO38, 0x0EC, GPIO, MMC2, SSP1, TWSI2, UART2, UART3, AAS_SPI, AAS_TWSI),
345 MFPR_MMP2(GPIO39, 0x0F0, GPIO, MMC2, SSP1, TWSI2, UART2, UART3, AAS_SPI, AAS_TWSI),
346 MFPR_MMP2(GPIO40, 0x0F4, GPIO, MMC2, SSP1, TWSI2, UART2, UART3, AAS_SPI, AAS_TWSI),
347 MFPR_MMP2(GPIO41, 0x0F8, GPIO, MMC2, TWSI5, NONE, NONE, NONE, NONE, NONE),
348 MFPR_MMP2(GPIO42, 0x0FC, GPIO, MMC2, TWSI5, NONE, NONE, NONE, NONE, NONE),
349 MFPR_MMP2(GPIO43, 0x100, GPIO, TWSI2, UART4, SSP1, UART2, UART3, NONE, AAS_TWSI),
350 MFPR_MMP2(GPIO44, 0x104, GPIO, TWSI2, UART4, SSP1, UART2, UART3, NONE, AAS_TWSI),
351 MFPR_MMP2(GPIO45, 0x108, GPIO, UART1, UART4, SSP1, UART2, UART3, NONE, NONE),
352 MFPR_MMP2(GPIO46, 0x10C, GPIO, UART1, UART4, SSP1, UART2, UART3, NONE, NONE),
353 MFPR_MMP2(GPIO47, 0x110, GPIO, UART2, SSP2, TWSI6, CAM2, AAS_SPI, AAS_GPIO, NONE),
354 MFPR_MMP2(GPIO48, 0x114, GPIO, UART2, SSP2, TWSI6, CAM2, AAS_SPI, AAS_GPIO, NONE),
355 MFPR_MMP2(GPIO49, 0x118, GPIO, UART2, SSP2, PWM, CCIC2, AAS_SPI, NONE, NONE),
356 MFPR_MMP2(GPIO50, 0x11C, GPIO, UART2, SSP2, PWM, CCIC2, AAS_SPI, NONE, NONE),
357 MFPR_MMP2(GPIO51, 0x120, GPIO, UART3, ROT, AAS_GPIO, PWM, NONE, NONE, NONE),
358 MFPR_MMP2(GPIO52, 0x124, GPIO, UART3, ROT, AAS_GPIO, PWM, NONE, NONE, NONE),
359 MFPR_MMP2(GPIO53, 0x128, GPIO, UART3, TWSI2, VCXO_REQ, NONE, PWM, NONE, AAS_TWSI),
360 MFPR_MMP2(GPIO54, 0x12C, GPIO, UART3, TWSI2, VCXO_OUT, HDMI, PWM, NONE, AAS_TWSI),
361 MFPR_MMP2(GPIO55, 0x130, GPIO, SSP2, SSP1, UART2, ROT, TWSI2, SSP3, AAS_TWSI),
362 MFPR_MMP2(GPIO56, 0x134, GPIO, SSP2, SSP1, UART2, ROT, TWSI2, KP_DK, AAS_TWSI),
363 MFPR_MMP2(GPIO57, 0x138, GPIO, SSP2_RX, SSP1_TXRX, SSP2_FRM, SSP1_RX, VCXO_REQ, KP_DK, NONE),
364 MFPR_MMP2(GPIO58, 0x13C, GPIO, SSP2, SSP1_RX, SSP1_FRM, SSP1_TXRX, VCXO_REQ, KP_DK, NONE),
365 MFPR_MMP2(GPIO59, 0x280, GPIO, CCIC1, ULPI, MMC3, CCIC2, UART3, UART4, NONE),
366 MFPR_MMP2(GPIO60, 0x284, GPIO, CCIC1, ULPI, MMC3, CCIC2, UART3, UART4, NONE),
367 MFPR_MMP2(GPIO61, 0x288, GPIO, CCIC1, ULPI, MMC3, CCIC2, UART3, HDMI, NONE),
368 MFPR_MMP2(GPIO62, 0x28C, GPIO, CCIC1, ULPI, MMC3, CCIC2, UART3, NONE, NONE),
369 MFPR_MMP2(GPIO63, 0x290, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, UART4, NONE),
370 MFPR_MMP2(GPIO64, 0x294, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, UART4, NONE),
371 MFPR_MMP2(GPIO65, 0x298, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, UART4, NONE),
372 MFPR_MMP2(GPIO66, 0x29C, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, UART4, NONE),
373 MFPR_MMP2(GPIO67, 0x2A0, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, NONE, NONE),
374 MFPR_MMP2(GPIO68, 0x2A4, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, LCD, NONE),
375 MFPR_MMP2(GPIO69, 0x2A8, GPIO, CCIC1, ULPI, MMC3, CCIC2, NONE, LCD, NONE),
376 MFPR_MMP2(GPIO70, 0x2AC, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, LCD, NONE),
377 MFPR_MMP2(GPIO71, 0x2B0, GPIO, TWSI3, NONE, PWM, NONE, NONE, LCD, AAS_TWSI),
378 MFPR_MMP2(GPIO72, 0x2B4, GPIO, TWSI3, HDMI, PWM, NONE, NONE, LCD, AAS_TWSI),
379 MFPR_MMP2(GPIO73, 0x2B8, GPIO, VCXO_REQ, 32K_CLKOUT, PWM, VCXO_OUT, NONE, LCD, NONE),
380 MFPR_MMP2(GPIO74, 0x170, GPIO, LCD, SMC, MMC4, SSP3, UART2, UART4, TIPU),
381 MFPR_MMP2(GPIO75, 0x174, GPIO, LCD, SMC, MMC4, SSP3, UART2, UART4, TIPU),
382 MFPR_MMP2(GPIO76, 0x178, GPIO, LCD, SMC, MMC4, SSP3, UART2, UART4, TIPU),
383 MFPR_MMP2(GPIO77, 0x17C, GPIO, LCD, SMC, MMC4, SSP3, UART2, UART4, TIPU),
384 MFPR_MMP2(GPIO78, 0x180, GPIO, LCD, HDMI, MMC4, NONE, SSP4, AAS_SPI, TIPU),
385 MFPR_MMP2(GPIO79, 0x184, GPIO, LCD, AAS_GPIO, MMC4, NONE, SSP4, AAS_SPI, TIPU),
386 MFPR_MMP2(GPIO80, 0x188, GPIO, LCD, AAS_GPIO, MMC4, NONE, SSP4, AAS_SPI, TIPU),
387 MFPR_MMP2(GPIO81, 0x18C, GPIO, LCD, AAS_GPIO, MMC4, NONE, SSP4, AAS_SPI, TIPU),
388 MFPR_MMP2(GPIO82, 0x190, GPIO, LCD, NONE, MMC4, NONE, NONE, CCIC2, TIPU),
389 MFPR_MMP2(GPIO83, 0x194, GPIO, LCD, NONE, MMC4, NONE, NONE, CCIC2, TIPU),
390 MFPR_MMP2(GPIO84, 0x198, GPIO, LCD, SMC, MMC2, NONE, TWSI5, AAS_TWSI, TIPU),
391 MFPR_MMP2(GPIO85, 0x19C, GPIO, LCD, SMC, MMC2, NONE, TWSI5, AAS_TWSI, TIPU),
392 MFPR_MMP2(GPIO86, 0x1A0, GPIO, LCD, SMC, MMC2, NONE, TWSI6, CCIC2, TIPU),
393 MFPR_MMP2(GPIO87, 0x1A4, GPIO, LCD, SMC, MMC2, NONE, TWSI6, CCIC2, TIPU),
394 MFPR_MMP2(GPIO88, 0x1A8, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
395 MFPR_MMP2(GPIO89, 0x1AC, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
396 MFPR_MMP2(GPIO90, 0x1B0, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
397 MFPR_MMP2(GPIO91, 0x1B4, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
398 MFPR_MMP2(GPIO92, 0x1B8, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
399 MFPR_MMP2(GPIO93, 0x1BC, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
400 MFPR_MMP2(GPIO94, 0x1C0, GPIO, LCD, AAS_GPIO, SPI, NONE, AAS_SPI, CCIC2, TIPU),
401 MFPR_MMP2(GPIO95, 0x1C4, GPIO, LCD, TWSI3, SPI, AAS_DEU_EX, AAS_SPI, CCIC2, TIPU),
402 MFPR_MMP2(GPIO96, 0x1C8, GPIO, LCD, TWSI3, SPI, AAS_DEU_EX, AAS_SPI, NONE, TIPU),
403 MFPR_MMP2(GPIO97, 0x1CC, GPIO, LCD, TWSI6, SPI, AAS_DEU_EX, AAS_SPI, NONE, TIPU),
404 MFPR_MMP2(GPIO98, 0x1D0, GPIO, LCD, TWSI6, SPI, ONE_WIRE, NONE, NONE, TIPU),
405 MFPR_MMP2(GPIO99, 0x1D4, GPIO, LCD, SMC, SPI, TWSI5, NONE, NONE, TIPU),
406 MFPR_MMP2(GPIO100, 0x1D8, GPIO, LCD, SMC, SPI, TWSI5, NONE, NONE, TIPU),
407 MFPR_MMP2(GPIO101, 0x1DC, GPIO, LCD, SMC, SPI, NONE, NONE, NONE, TIPU),
408 MFPR_MMP2(GPIO102, 0x000, USIM, GPIO, FSIC, KP_DK, LCD, NONE, NONE, NONE),
409 MFPR_MMP2(GPIO103, 0x004, USIM, GPIO, FSIC, KP_DK, LCD, NONE, NONE, NONE),
410 MFPR_MMP2(GPIO104, 0x1FC, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
411 MFPR_MMP2(GPIO105, 0x1F8, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
412 MFPR_MMP2(GPIO106, 0x1F4, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
413 MFPR_MMP2(GPIO107, 0x1F0, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
414 MFPR_MMP2(GPIO108, 0x21C, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
415 MFPR_MMP2(GPIO109, 0x218, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
416 MFPR_MMP2(GPIO110, 0x214, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
417 MFPR_MMP2(GPIO111, 0x200, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
418 MFPR_MMP2(GPIO112, 0x244, NAND, GPIO, MMC3, SMC, NONE, NONE, NONE, NONE),
419 MFPR_MMP2(GPIO113, 0x25C, SMC, GPIO, EXT_DMA, MMC3, SMC, HDMI, NONE, NONE),
420 MFPR_MMP2(GPIO114, 0x164, G_CLKOUT, 32K_CLKOUT, HDMI, NONE, NONE, NONE, NONE, NONE),
421 MFPR_MMP2(GPIO115, 0x260, GPIO, NONE, AC, UART4, UART3, SSP1, NONE, NONE),
422 MFPR_MMP2(GPIO116, 0x264, GPIO, NONE, AC, UART4, UART3, SSP1, NONE, NONE),
423 MFPR_MMP2(GPIO117, 0x268, GPIO, NONE, AC, UART4, UART3, SSP1, NONE, NONE),
424 MFPR_MMP2(GPIO118, 0x26C, GPIO, NONE, AC, UART4, UART3, SSP1, NONE, NONE),
425 MFPR_MMP2(GPIO119, 0x270, GPIO, NONE, CA, SSP3, NONE, NONE, NONE, NONE),
426 MFPR_MMP2(GPIO120, 0x274, GPIO, NONE, CA, SSP3, NONE, NONE, NONE, NONE),
427 MFPR_MMP2(GPIO121, 0x278, GPIO, NONE, CA, SSP3, NONE, NONE, NONE, NONE),
428 MFPR_MMP2(GPIO122, 0x27C, GPIO, NONE, CA, SSP3, NONE, NONE, NONE, NONE),
429 MFPR_MMP2(GPIO123, 0x148, GPIO, SLEEP_IND, ONE_WIRE, 32K_CLKOUT, NONE, NONE, NONE, NONE),
430 MFPR_MMP2(GPIO124, 0x00C, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
431 MFPR_MMP2(GPIO125, 0x010, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
432 MFPR_MMP2(GPIO126, 0x014, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
433 MFPR_MMP2(GPIO127, 0x018, GPIO, NONE, LCD, MMC3, NAND, NONE, NONE, NONE),
434 MFPR_MMP2(GPIO128, 0x01C, GPIO, NONE, LCD, MMC3, NAND, NONE, NONE, NONE),
435 MFPR_MMP2(GPIO129, 0x020, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
436 MFPR_MMP2(GPIO130, 0x024, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
437 MFPR_MMP2(GPIO131, 0x028, GPIO, MMC1, NONE, MSP, NONE, NONE, NONE, NONE),
438 MFPR_MMP2(GPIO132, 0x02C, GPIO, MMC1, PRI_JTAG, MSP, SSP3, AAS_JTAG, NONE, NONE),
439 MFPR_MMP2(GPIO133, 0x030, GPIO, MMC1, PRI_JTAG, MSP, SSP3, AAS_JTAG, NONE, NONE),
440 MFPR_MMP2(GPIO134, 0x034, GPIO, MMC1, PRI_JTAG, MSP, SSP3, AAS_JTAG, NONE, NONE),
441 MFPR_MMP2(GPIO135, 0x038, GPIO, NONE, LCD, MMC3, NAND, NONE, NONE, NONE),
442 MFPR_MMP2(GPIO136, 0x03C, GPIO, MMC1, PRI_JTAG, MSP, SSP3, AAS_JTAG, NONE, NONE),
443 MFPR_MMP2(GPIO137, 0x040, GPIO, HDMI, LCD, MSP, NONE, NONE, NONE, NONE),
444 MFPR_MMP2(GPIO138, 0x044, GPIO, NONE, LCD, MMC3, SMC, NONE, NONE, NONE),
445 MFPR_MMP2(GPIO139, 0x048, GPIO, MMC1, PRI_JTAG, MSP, NONE, AAS_JTAG, NONE, NONE),
446 MFPR_MMP2(GPIO140, 0x04C, GPIO, MMC1, LCD, NONE, NONE, UART2, UART1, NONE),
447 MFPR_MMP2(GPIO141, 0x050, GPIO, MMC1, LCD, NONE, NONE, UART2, UART1, NONE),
448 MFPR_MMP2(GPIO142, 0x008, USIM, GPIO, FSIC, KP_DK, NONE, NONE, NONE, NONE),
449 MFPR_MMP2(GPIO143, 0x220, NAND, GPIO, SMC, NONE, NAND, NONE, NONE, NONE),
450 MFPR_MMP2(GPIO144, 0x224, NAND, GPIO, SMC_INT, SMC, NAND, NONE, NONE, NONE),
451 MFPR_MMP2(GPIO145, 0x228, SMC, GPIO, NONE, NONE, SMC, NONE, NONE, NONE),
452 MFPR_MMP2(GPIO146, 0x22C, SMC, GPIO, NONE, NONE, SMC, NONE, NONE, NONE),
453 MFPR_MMP2(GPIO147, 0x230, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
454 MFPR_MMP2(GPIO148, 0x234, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
455 MFPR_MMP2(GPIO149, 0x238, NAND, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
456 MFPR_MMP2(GPIO150, 0x23C, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
457 MFPR_MMP2(GPIO151, 0x240, SMC, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
458 MFPR_MMP2(GPIO152, 0x248, SMC, GPIO, NONE, NONE, SMC, NONE, NONE, NONE),
459 MFPR_MMP2(GPIO153, 0x24C, SMC, GPIO, NONE, NONE, SMC, NONE, NONE, NONE),
460 MFPR_MMP2(GPIO154, 0x254, SMC_INT, GPIO, SMC, NONE, NAND, NONE, NONE, NONE),
461 MFPR_MMP2(GPIO155, 0x258, EXT_DMA, GPIO, SMC, NONE, EXT_DMA, NONE, NONE, NONE),
462 MFPR_MMP2(GPIO156, 0x14C, PRI_JTAG, GPIO, PWM, NONE, NONE, NONE, NONE, NONE),
463 MFPR_MMP2(GPIO157, 0x150, PRI_JTAG, GPIO, PWM, NONE, NONE, NONE, NONE, NONE),
464 MFPR_MMP2(GPIO158, 0x154, PRI_JTAG, GPIO, PWM, NONE, NONE, NONE, NONE, NONE),
465 MFPR_MMP2(GPIO159, 0x158, PRI_JTAG, GPIO, PWM, NONE, NONE, NONE, NONE, NONE),
466 MFPR_MMP2(GPIO160, 0x250, NAND, GPIO, SMC, NONE, NAND, NONE, NONE, NONE),
467 MFPR_MMP2(GPIO161, 0x210, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
468 MFPR_MMP2(GPIO162, 0x20C, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
469 MFPR_MMP2(GPIO163, 0x208, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
470 MFPR_MMP2(GPIO164, 0x204, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
471 MFPR_MMP2(GPIO165, 0x1EC, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
472 MFPR_MMP2(GPIO166, 0x1E8, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
473 MFPR_MMP2(GPIO167, 0x1E4, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
474 MFPR_MMP2(GPIO168, 0x1E0, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
475 MFPR_MMP2(TWSI4_SCL, 0x2BC, TWSI4, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
476 MFPR_MMP2(TWSI4_SDA, 0x2C0, TWSI4, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
477 MFPR_MMP2(G_CLKREQ, 0x160, G_CLKREQ, ONE_WIRE, NONE, NONE, NONE, NONE, NONE, NONE),
478 MFPR_MMP2(VCXO_REQ, 0x168, VCXO_REQ, ONE_WIRE, PLL, NONE, NONE, NONE, NONE, NONE),
479 MFPR_MMP2(VCXO_OUT, 0x16C, VCXO_OUT, 32K_CLKOUT, NONE, NONE, NONE, NONE, NONE, NONE),
480};
481
482static const unsigned mmp2_uart1_pin1[] = {GPIO29, GPIO30, GPIO31, GPIO32};
483static const unsigned mmp2_uart1_pin2[] = {GPIO45, GPIO46};
484static const unsigned mmp2_uart1_pin3[] = {GPIO140, GPIO141};
485static const unsigned mmp2_uart2_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40};
486static const unsigned mmp2_uart2_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
487static const unsigned mmp2_uart2_pin3[] = {GPIO47, GPIO48, GPIO49, GPIO50};
488static const unsigned mmp2_uart2_pin4[] = {GPIO74, GPIO75, GPIO76, GPIO77};
489static const unsigned mmp2_uart2_pin5[] = {GPIO55, GPIO56};
490static const unsigned mmp2_uart2_pin6[] = {GPIO140, GPIO141};
491static const unsigned mmp2_uart3_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40};
492static const unsigned mmp2_uart3_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
493static const unsigned mmp2_uart3_pin3[] = {GPIO51, GPIO52, GPIO53, GPIO54};
494static const unsigned mmp2_uart3_pin4[] = {GPIO59, GPIO60, GPIO61, GPIO62};
495static const unsigned mmp2_uart3_pin5[] = {GPIO115, GPIO116, GPIO117, GPIO118};
496static const unsigned mmp2_uart3_pin6[] = {GPIO51, GPIO52};
497static const unsigned mmp2_uart4_pin1[] = {GPIO43, GPIO44, GPIO45, GPIO46};
498static const unsigned mmp2_uart4_pin2[] = {GPIO63, GPIO64, GPIO65, GPIO66};
499static const unsigned mmp2_uart4_pin3[] = {GPIO74, GPIO75, GPIO76, GPIO77};
500static const unsigned mmp2_uart4_pin4[] = {GPIO115, GPIO116, GPIO117, GPIO118};
501static const unsigned mmp2_uart4_pin5[] = {GPIO59, GPIO60};
502static const unsigned mmp2_kpdk_pin1[] = {GPIO16, GPIO17, GPIO18, GPIO19};
503static const unsigned mmp2_kpdk_pin2[] = {GPIO16, GPIO17};
504static const unsigned mmp2_twsi2_pin1[] = {GPIO37, GPIO38};
505static const unsigned mmp2_twsi2_pin2[] = {GPIO39, GPIO40};
506static const unsigned mmp2_twsi2_pin3[] = {GPIO43, GPIO44};
507static const unsigned mmp2_twsi2_pin4[] = {GPIO53, GPIO54};
508static const unsigned mmp2_twsi2_pin5[] = {GPIO55, GPIO56};
509static const unsigned mmp2_twsi3_pin1[] = {GPIO71, GPIO72};
510static const unsigned mmp2_twsi3_pin2[] = {GPIO95, GPIO96};
511static const unsigned mmp2_twsi4_pin1[] = {TWSI4_SCL, TWSI4_SDA};
512static const unsigned mmp2_twsi5_pin1[] = {GPIO41, GPIO42};
513static const unsigned mmp2_twsi5_pin2[] = {GPIO84, GPIO85};
514static const unsigned mmp2_twsi5_pin3[] = {GPIO99, GPIO100};
515static const unsigned mmp2_twsi6_pin1[] = {GPIO47, GPIO48};
516static const unsigned mmp2_twsi6_pin2[] = {GPIO86, GPIO87};
517static const unsigned mmp2_twsi6_pin3[] = {GPIO97, GPIO98};
518static const unsigned mmp2_ccic1_pin1[] = {GPIO12, GPIO13, GPIO14, GPIO15,
519 GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, GPIO22, GPIO23};
520static const unsigned mmp2_ccic1_pin2[] = {GPIO59, GPIO60, GPIO61, GPIO62,
521 GPIO63, GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70};
522static const unsigned mmp2_ccic2_pin1[] = {GPIO59, GPIO60, GPIO61, GPIO62,
523 GPIO63, GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70};
524static const unsigned mmp2_ccic2_pin2[] = {GPIO82, GPIO83, GPIO86, GPIO87,
525 GPIO88, GPIO89, GPIO90, GPIO91, GPIO92, GPIO93, GPIO94, GPIO95};
526static const unsigned mmp2_ulpi_pin1[] = {GPIO59, GPIO60, GPIO61, GPIO62,
527 GPIO63, GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70};
528static const unsigned mmp2_ro_pin1[] = {GPIO16, GPIO17};
529static const unsigned mmp2_ro_pin2[] = {GPIO18, GPIO19};
530static const unsigned mmp2_ro_pin3[] = {GPIO51, GPIO52};
531static const unsigned mmp2_ro_pin4[] = {GPIO55, GPIO56};
532static const unsigned mmp2_i2s_pin1[] = {GPIO24, GPIO25, GPIO26, GPIO27,
533 GPIO28};
534static const unsigned mmp2_i2s_pin2[] = {GPIO33, GPIO34, GPIO35, GPIO36};
535static const unsigned mmp2_ssp1_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40};
536static const unsigned mmp2_ssp1_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
537static const unsigned mmp2_ssp1_pin3[] = {GPIO115, GPIO116, GPIO117, GPIO118};
538static const unsigned mmp2_ssp2_pin1[] = {GPIO47, GPIO48, GPIO49, GPIO50};
539static const unsigned mmp2_ssp3_pin1[] = {GPIO119, GPIO120, GPIO121, GPIO122};
540static const unsigned mmp2_ssp3_pin2[] = {GPIO132, GPIO133, GPIO133, GPIO136};
541static const unsigned mmp2_sspa2_pin1[] = {GPIO25, GPIO26, GPIO27, GPIO28};
542static const unsigned mmp2_sspa2_pin2[] = {GPIO33, GPIO34, GPIO35, GPIO36};
543static const unsigned mmp2_mmc1_pin1[] = {GPIO131, GPIO132, GPIO133, GPIO134,
544 GPIO136, GPIO139, GPIO140, GPIO141};
545static const unsigned mmp2_mmc2_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40,
546 GPIO41, GPIO42};
547static const unsigned mmp2_mmc3_pin1[] = {GPIO111, GPIO112, GPIO151, GPIO162,
548 GPIO163, GPIO164, GPIO165, GPIO166, GPIO167, GPIO168};
549
550static struct pxa3xx_pin_group mmp2_grps[] = {
551 GRP_MMP2("uart1 4p1", UART1, mmp2_uart1_pin1),
552 GRP_MMP2("uart1 2p2", UART1, mmp2_uart1_pin2),
553 GRP_MMP2("uart1 2p3", UART1, mmp2_uart1_pin3),
554 GRP_MMP2("uart2 4p1", UART2, mmp2_uart2_pin1),
555 GRP_MMP2("uart2 4p2", UART2, mmp2_uart2_pin2),
556 GRP_MMP2("uart2 4p3", UART2, mmp2_uart2_pin3),
557 GRP_MMP2("uart2 4p4", UART2, mmp2_uart2_pin4),
558 GRP_MMP2("uart2 2p5", UART2, mmp2_uart2_pin5),
559 GRP_MMP2("uart2 2p6", UART2, mmp2_uart2_pin6),
560 GRP_MMP2("uart3 4p1", UART3, mmp2_uart3_pin1),
561 GRP_MMP2("uart3 4p2", UART3, mmp2_uart3_pin2),
562 GRP_MMP2("uart3 4p3", UART3, mmp2_uart3_pin3),
563 GRP_MMP2("uart3 4p4", UART3, mmp2_uart3_pin4),
564 GRP_MMP2("uart3 4p5", UART3, mmp2_uart3_pin5),
565 GRP_MMP2("uart3 2p6", UART3, mmp2_uart3_pin6),
566 GRP_MMP2("uart4 4p1", UART4, mmp2_uart4_pin1),
567 GRP_MMP2("uart4 4p2", UART4, mmp2_uart4_pin2),
568 GRP_MMP2("uart4 4p3", UART4, mmp2_uart4_pin3),
569 GRP_MMP2("uart4 4p4", UART4, mmp2_uart4_pin4),
570 GRP_MMP2("uart4 2p5", UART4, mmp2_uart4_pin5),
571 GRP_MMP2("kpdk 4p1", KP_DK, mmp2_kpdk_pin1),
572 GRP_MMP2("kpdk 4p2", KP_DK, mmp2_kpdk_pin2),
573 GRP_MMP2("twsi2-1", TWSI2, mmp2_twsi2_pin1),
574 GRP_MMP2("twsi2-2", TWSI2, mmp2_twsi2_pin2),
575 GRP_MMP2("twsi2-3", TWSI2, mmp2_twsi2_pin3),
576 GRP_MMP2("twsi2-4", TWSI2, mmp2_twsi2_pin4),
577 GRP_MMP2("twsi2-5", TWSI2, mmp2_twsi2_pin5),
578 GRP_MMP2("twsi3-1", TWSI3, mmp2_twsi3_pin1),
579 GRP_MMP2("twsi3-2", TWSI3, mmp2_twsi3_pin2),
580 GRP_MMP2("twsi4", TWSI4, mmp2_twsi4_pin1),
581 GRP_MMP2("twsi5-1", TWSI5, mmp2_twsi5_pin1),
582 GRP_MMP2("twsi5-2", TWSI5, mmp2_twsi5_pin2),
583 GRP_MMP2("twsi5-3", TWSI5, mmp2_twsi5_pin3),
584 GRP_MMP2("twsi6-1", TWSI6, mmp2_twsi6_pin1),
585 GRP_MMP2("twsi6-2", TWSI6, mmp2_twsi6_pin2),
586 GRP_MMP2("twsi6-3", TWSI6, mmp2_twsi6_pin3),
587 GRP_MMP2("ccic1-1", CCIC1, mmp2_ccic1_pin1),
588 GRP_MMP2("ccic1-2", CCIC1, mmp2_ccic1_pin2),
589 GRP_MMP2("ccic2-1", CCIC2, mmp2_ccic2_pin1),
590 GRP_MMP2("ccic2-1", CCIC2, mmp2_ccic2_pin2),
591 GRP_MMP2("ulpi", ULPI, mmp2_ulpi_pin1),
592 GRP_MMP2("ro-1", ROT, mmp2_ro_pin1),
593 GRP_MMP2("ro-2", ROT, mmp2_ro_pin2),
594 GRP_MMP2("ro-3", ROT, mmp2_ro_pin3),
595 GRP_MMP2("ro-4", ROT, mmp2_ro_pin4),
596 GRP_MMP2("i2s 5p1", I2S, mmp2_i2s_pin1),
597 GRP_MMP2("i2s 4p2", I2S, mmp2_i2s_pin2),
598 GRP_MMP2("ssp1 4p1", SSP1, mmp2_ssp1_pin1),
599 GRP_MMP2("ssp1 4p2", SSP1, mmp2_ssp1_pin2),
600 GRP_MMP2("ssp1 4p3", SSP1, mmp2_ssp1_pin3),
601 GRP_MMP2("ssp2 4p1", SSP2, mmp2_ssp2_pin1),
602 GRP_MMP2("ssp3 4p1", SSP3, mmp2_ssp3_pin1),
603 GRP_MMP2("ssp3 4p2", SSP3, mmp2_ssp3_pin2),
604 GRP_MMP2("sspa2 4p1", SSPA2, mmp2_sspa2_pin1),
605 GRP_MMP2("sspa2 4p2", SSPA2, mmp2_sspa2_pin2),
606 GRP_MMP2("mmc1 8p1", MMC1, mmp2_mmc1_pin1),
607 GRP_MMP2("mmc2 6p1", MMC2, mmp2_mmc2_pin1),
608 GRP_MMP2("mmc3 10p1", MMC3, mmp2_mmc3_pin1),
609};
610
611static const char * const mmp2_uart1_grps[] = {"uart1 4p1", "uart1 2p2",
612 "uart1 2p3"};
613static const char * const mmp2_uart2_grps[] = {"uart2 4p1", "uart2 4p2",
614 "uart2 4p3", "uart2 4p4", "uart2 4p5", "uart2 4p6"};
615static const char * const mmp2_uart3_grps[] = {"uart3 4p1", "uart3 4p2",
616 "uart3 4p3", "uart3 4p4", "uart3 4p5", "uart3 2p6"};
617static const char * const mmp2_uart4_grps[] = {"uart4 4p1", "uart4 4p2",
618 "uart4 4p3", "uart4 4p4", "uart4 2p5"};
619static const char * const mmp2_kpdk_grps[] = {"kpdk 4p1", "kpdk 4p2"};
620static const char * const mmp2_twsi2_grps[] = {"twsi2-1", "twsi2-2",
621 "twsi2-3", "twsi2-4", "twsi2-5"};
622static const char * const mmp2_twsi3_grps[] = {"twsi3-1", "twsi3-2"};
623static const char * const mmp2_twsi4_grps[] = {"twsi4"};
624static const char * const mmp2_twsi5_grps[] = {"twsi5-1", "twsi5-2",
625 "twsi5-3"};
626static const char * const mmp2_twsi6_grps[] = {"twsi6-1", "twsi6-2",
627 "twsi6-3"};
628static const char * const mmp2_ccic1_grps[] = {"ccic1-1", "ccic1-2"};
629static const char * const mmp2_ccic2_grps[] = {"ccic2-1", "ccic2-2"};
630static const char * const mmp2_ulpi_grps[] = {"ulpi"};
631static const char * const mmp2_ro_grps[] = {"ro-1", "ro-2", "ro-3", "ro-4"};
632static const char * const mmp2_i2s_grps[] = {"i2s 5p1", "i2s 4p2"};
633static const char * const mmp2_ssp1_grps[] = {"ssp1 4p1", "ssp1 4p2",
634 "ssp1 4p3"};
635static const char * const mmp2_ssp2_grps[] = {"ssp2 4p1"};
636static const char * const mmp2_ssp3_grps[] = {"ssp3 4p1", "ssp3 4p2"};
637static const char * const mmp2_sspa2_grps[] = {"sspa2 4p1", "sspa2 4p2"};
638static const char * const mmp2_mmc1_grps[] = {"mmc1 8p1"};
639static const char * const mmp2_mmc2_grps[] = {"mmc2 6p1"};
640static const char * const mmp2_mmc3_grps[] = {"mmc3 10p1"};
641
642static struct pxa3xx_pmx_func mmp2_funcs[] = {
643 {"uart1", ARRAY_AND_SIZE(mmp2_uart1_grps)},
644 {"uart2", ARRAY_AND_SIZE(mmp2_uart2_grps)},
645 {"uart3", ARRAY_AND_SIZE(mmp2_uart3_grps)},
646 {"uart4", ARRAY_AND_SIZE(mmp2_uart4_grps)},
647 {"kpdk", ARRAY_AND_SIZE(mmp2_kpdk_grps)},
648 {"twsi2", ARRAY_AND_SIZE(mmp2_twsi2_grps)},
649 {"twsi3", ARRAY_AND_SIZE(mmp2_twsi3_grps)},
650 {"twsi4", ARRAY_AND_SIZE(mmp2_twsi4_grps)},
651 {"twsi5", ARRAY_AND_SIZE(mmp2_twsi5_grps)},
652 {"twsi6", ARRAY_AND_SIZE(mmp2_twsi6_grps)},
653 {"ccic1", ARRAY_AND_SIZE(mmp2_ccic1_grps)},
654 {"ccic2", ARRAY_AND_SIZE(mmp2_ccic2_grps)},
655 {"ulpi", ARRAY_AND_SIZE(mmp2_ulpi_grps)},
656 {"ro", ARRAY_AND_SIZE(mmp2_ro_grps)},
657 {"i2s", ARRAY_AND_SIZE(mmp2_i2s_grps)},
658 {"ssp1", ARRAY_AND_SIZE(mmp2_ssp1_grps)},
659 {"ssp2", ARRAY_AND_SIZE(mmp2_ssp2_grps)},
660 {"ssp3", ARRAY_AND_SIZE(mmp2_ssp3_grps)},
661 {"sspa2", ARRAY_AND_SIZE(mmp2_sspa2_grps)},
662 {"mmc1", ARRAY_AND_SIZE(mmp2_mmc1_grps)},
663 {"mmc2", ARRAY_AND_SIZE(mmp2_mmc2_grps)},
664 {"mmc3", ARRAY_AND_SIZE(mmp2_mmc3_grps)},
665};
666
667static struct pinctrl_desc mmp2_pctrl_desc = {
668 .name = "mmp2-pinctrl",
669 .owner = THIS_MODULE,
670};
671
672static struct pxa3xx_pinmux_info mmp2_info = {
673 .mfp = mmp2_mfp,
674 .num_mfp = ARRAY_SIZE(mmp2_mfp),
675 .grps = mmp2_grps,
676 .num_grps = ARRAY_SIZE(mmp2_grps),
677 .funcs = mmp2_funcs,
678 .num_funcs = ARRAY_SIZE(mmp2_funcs),
679 .num_gpio = 169,
680 .desc = &mmp2_pctrl_desc,
681 .pads = mmp2_pads,
682 .num_pads = ARRAY_SIZE(mmp2_pads),
683
684 .cputype = PINCTRL_MMP2,
685 .ds_mask = MMP2_DS_MASK,
686 .ds_shift = MMP2_DS_SHIFT,
687};
688
689static int mmp2_pinmux_probe(struct platform_device *pdev)
690{
691 return pxa3xx_pinctrl_register(pdev, &mmp2_info);
692}
693
694static int mmp2_pinmux_remove(struct platform_device *pdev)
695{
696 return pxa3xx_pinctrl_unregister(pdev);
697}
698
699static struct platform_driver mmp2_pinmux_driver = {
700 .driver = {
701 .name = "mmp2-pinmux",
702 .owner = THIS_MODULE,
703 },
704 .probe = mmp2_pinmux_probe,
705 .remove = mmp2_pinmux_remove,
706};
707
708static int __init mmp2_pinmux_init(void)
709{
710 return platform_driver_register(&mmp2_pinmux_driver);
711}
712core_initcall_sync(mmp2_pinmux_init);
713
714static void __exit mmp2_pinmux_exit(void)
715{
716 platform_driver_unregister(&mmp2_pinmux_driver);
717}
718module_exit(mmp2_pinmux_exit);
719
720MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
721MODULE_DESCRIPTION("PXA3xx pin control driver");
722MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c
index 23af9f1f9c35..b45c4eb35798 100644
--- a/drivers/pinctrl/pinctrl-mxs.c
+++ b/drivers/pinctrl/pinctrl-mxs.c
@@ -158,7 +158,7 @@ static void mxs_dt_free_map(struct pinctrl_dev *pctldev,
158 kfree(map); 158 kfree(map);
159} 159}
160 160
161static struct pinctrl_ops mxs_pinctrl_ops = { 161static const struct pinctrl_ops mxs_pinctrl_ops = {
162 .get_groups_count = mxs_get_groups_count, 162 .get_groups_count = mxs_get_groups_count,
163 .get_group_name = mxs_get_group_name, 163 .get_group_name = mxs_get_group_name,
164 .get_group_pins = mxs_get_group_pins, 164 .get_group_pins = mxs_get_group_pins,
@@ -219,7 +219,7 @@ static int mxs_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned selector,
219 return 0; 219 return 0;
220} 220}
221 221
222static struct pinmux_ops mxs_pinmux_ops = { 222static const struct pinmux_ops mxs_pinmux_ops = {
223 .get_functions_count = mxs_pinctrl_get_funcs_count, 223 .get_functions_count = mxs_pinctrl_get_funcs_count,
224 .get_function_name = mxs_pinctrl_get_func_name, 224 .get_function_name = mxs_pinctrl_get_func_name,
225 .get_function_groups = mxs_pinctrl_get_func_groups, 225 .get_function_groups = mxs_pinctrl_get_func_groups,
@@ -319,7 +319,7 @@ static void mxs_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
319 seq_printf(s, "0x%lx", config); 319 seq_printf(s, "0x%lx", config);
320} 320}
321 321
322static struct pinconf_ops mxs_pinconf_ops = { 322static const struct pinconf_ops mxs_pinconf_ops = {
323 .pin_config_get = mxs_pinconf_get, 323 .pin_config_get = mxs_pinconf_get,
324 .pin_config_set = mxs_pinconf_set, 324 .pin_config_set = mxs_pinconf_set,
325 .pin_config_group_get = mxs_pinconf_group_get, 325 .pin_config_group_get = mxs_pinconf_group_get,
diff --git a/drivers/pinctrl/pinctrl-nomadik-db8500.c b/drivers/pinctrl/pinctrl-nomadik-db8500.c
index 30b4da91ef7e..c74840729648 100644
--- a/drivers/pinctrl/pinctrl-nomadik-db8500.c
+++ b/drivers/pinctrl/pinctrl-nomadik-db8500.c
@@ -466,7 +466,7 @@ static const unsigned mc1_a_1_pins[] = { DB8500_PIN_AH16, DB8500_PIN_AG15,
466 DB8500_PIN_AJ15, DB8500_PIN_AG14, DB8500_PIN_AF13, DB8500_PIN_AG13, 466 DB8500_PIN_AJ15, DB8500_PIN_AG14, DB8500_PIN_AF13, DB8500_PIN_AG13,
467 DB8500_PIN_AH15 }; 467 DB8500_PIN_AH15 };
468static const unsigned mc1_a_2_pins[] = { DB8500_PIN_AH16, DB8500_PIN_AJ15, 468static const unsigned mc1_a_2_pins[] = { DB8500_PIN_AH16, DB8500_PIN_AJ15,
469 DB8500_PIN_AG14, DB8500_PIN_AF13, DB8500_PIN_AG13,DB8500_PIN_AH15 }; 469 DB8500_PIN_AG14, DB8500_PIN_AF13, DB8500_PIN_AG13, DB8500_PIN_AH15 };
470static const unsigned mc1dir_a_1_pins[] = { DB8500_PIN_AH13, DB8500_PIN_AG12, 470static const unsigned mc1dir_a_1_pins[] = { DB8500_PIN_AH13, DB8500_PIN_AG12,
471 DB8500_PIN_AH12, DB8500_PIN_AH11 }; 471 DB8500_PIN_AH12, DB8500_PIN_AH11 };
472static const unsigned hsir_a_1_pins[] = { DB8500_PIN_AG10, DB8500_PIN_AH10, 472static const unsigned hsir_a_1_pins[] = { DB8500_PIN_AG10, DB8500_PIN_AH10,
@@ -663,7 +663,7 @@ static const unsigned hwobs_oc4_1_pins[] = { DB8500_PIN_D17, DB8500_PIN_D16,
663 DB8500_PIN_D21, DB8500_PIN_D20, DB8500_PIN_C20, DB8500_PIN_B21, 663 DB8500_PIN_D21, DB8500_PIN_D20, DB8500_PIN_C20, DB8500_PIN_B21,
664 DB8500_PIN_C21, DB8500_PIN_A22, DB8500_PIN_B24, DB8500_PIN_C22 }; 664 DB8500_PIN_C21, DB8500_PIN_A22, DB8500_PIN_B24, DB8500_PIN_C22 };
665 665
666#define DB8500_PIN_GROUP(a,b) { .name = #a, .pins = a##_pins, \ 666#define DB8500_PIN_GROUP(a, b) { .name = #a, .pins = a##_pins, \
667 .npins = ARRAY_SIZE(a##_pins), .altsetting = b } 667 .npins = ARRAY_SIZE(a##_pins), .altsetting = b }
668 668
669static const struct nmk_pingroup nmk_db8500_groups[] = { 669static const struct nmk_pingroup nmk_db8500_groups[] = {
diff --git a/drivers/pinctrl/pinctrl-nomadik-stn8815.c b/drivers/pinctrl/pinctrl-nomadik-stn8815.c
index 924a3393fa82..ed39dcafd4f8 100644
--- a/drivers/pinctrl/pinctrl-nomadik-stn8815.c
+++ b/drivers/pinctrl/pinctrl-nomadik-stn8815.c
@@ -299,7 +299,7 @@ static const unsigned i2c0_a_1_pins[] = { STN8815_PIN_D3, STN8815_PIN_D2 };
299static const unsigned u1_b_1_pins[] = { STN8815_PIN_B16, STN8815_PIN_A16 }; 299static const unsigned u1_b_1_pins[] = { STN8815_PIN_B16, STN8815_PIN_A16 };
300static const unsigned i2cusb_b_1_pins[] = { STN8815_PIN_C21, STN8815_PIN_C20 }; 300static const unsigned i2cusb_b_1_pins[] = { STN8815_PIN_C21, STN8815_PIN_C20 };
301 301
302#define STN8815_PIN_GROUP(a,b) { .name = #a, .pins = a##_pins, \ 302#define STN8815_PIN_GROUP(a, b) { .name = #a, .pins = a##_pins, \
303 .npins = ARRAY_SIZE(a##_pins), .altsetting = b } 303 .npins = ARRAY_SIZE(a##_pins), .altsetting = b }
304 304
305static const struct nmk_pingroup nmk_stn8815_groups[] = { 305static const struct nmk_pingroup nmk_stn8815_groups[] = {
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index 36d20293de5c..435bf3078d2c 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -1565,8 +1565,8 @@ static int nmk_dt_add_map_configs(struct pinctrl_map **map,
1565 return 0; 1565 return 0;
1566} 1566}
1567 1567
1568#define NMK_CONFIG_PIN(x,y) { .property = x, .config = y, } 1568#define NMK_CONFIG_PIN(x, y) { .property = x, .config = y, }
1569#define NMK_CONFIG_PIN_ARRAY(x,y) { .property = x, .choice = y, \ 1569#define NMK_CONFIG_PIN_ARRAY(x, y) { .property = x, .choice = y, \
1570 .size = ARRAY_SIZE(y), } 1570 .size = ARRAY_SIZE(y), }
1571 1571
1572static const unsigned long nmk_pin_input_modes[] = { 1572static const unsigned long nmk_pin_input_modes[] = {
@@ -1764,7 +1764,7 @@ int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
1764 return 0; 1764 return 0;
1765} 1765}
1766 1766
1767static struct pinctrl_ops nmk_pinctrl_ops = { 1767static const struct pinctrl_ops nmk_pinctrl_ops = {
1768 .get_groups_count = nmk_get_groups_cnt, 1768 .get_groups_count = nmk_get_groups_cnt,
1769 .get_group_name = nmk_get_group_name, 1769 .get_group_name = nmk_get_group_name,
1770 .get_group_pins = nmk_get_group_pins, 1770 .get_group_pins = nmk_get_group_pins,
@@ -1975,7 +1975,7 @@ static void nmk_gpio_disable_free(struct pinctrl_dev *pctldev,
1975 /* Set the pin to some default state, GPIO is usually default */ 1975 /* Set the pin to some default state, GPIO is usually default */
1976} 1976}
1977 1977
1978static struct pinmux_ops nmk_pinmux_ops = { 1978static const struct pinmux_ops nmk_pinmux_ops = {
1979 .get_functions_count = nmk_pmx_get_funcs_cnt, 1979 .get_functions_count = nmk_pmx_get_funcs_cnt,
1980 .get_function_name = nmk_pmx_get_func_name, 1980 .get_function_name = nmk_pmx_get_func_name,
1981 .get_function_groups = nmk_pmx_get_func_groups, 1981 .get_function_groups = nmk_pmx_get_func_groups,
@@ -2068,7 +2068,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
2068 pin, cfg, pullnames[pull], slpmnames[slpm], 2068 pin, cfg, pullnames[pull], slpmnames[slpm],
2069 output ? "output " : "input", 2069 output ? "output " : "input",
2070 output ? (val ? "high" : "low") : "", 2070 output ? (val ? "high" : "low") : "",
2071 lowemi ? "on" : "off" ); 2071 lowemi ? "on" : "off");
2072 2072
2073 clk_enable(nmk_chip->clk); 2073 clk_enable(nmk_chip->clk);
2074 bit = pin % NMK_GPIO_PER_CHIP; 2074 bit = pin % NMK_GPIO_PER_CHIP;
@@ -2089,7 +2089,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
2089 return 0; 2089 return 0;
2090} 2090}
2091 2091
2092static struct pinconf_ops nmk_pinconf_ops = { 2092static const struct pinconf_ops nmk_pinconf_ops = {
2093 .pin_config_get = nmk_pin_config_get, 2093 .pin_config_get = nmk_pin_config_get,
2094 .pin_config_set = nmk_pin_config_set, 2094 .pin_config_set = nmk_pin_config_set,
2095}; 2095};
@@ -2111,6 +2111,10 @@ static const struct of_device_id nmk_pinctrl_match[] = {
2111 .compatible = "stericsson,nmk-pinctrl", 2111 .compatible = "stericsson,nmk-pinctrl",
2112 .data = (void *)PINCTRL_NMK_DB8500, 2112 .data = (void *)PINCTRL_NMK_DB8500,
2113 }, 2113 },
2114 {
2115 .compatible = "stericsson,nmk-pinctrl-db8540",
2116 .data = (void *)PINCTRL_NMK_DB8540,
2117 },
2114 {}, 2118 {},
2115}; 2119};
2116 2120
diff --git a/drivers/pinctrl/pinctrl-pxa168.c b/drivers/pinctrl/pinctrl-pxa168.c
deleted file mode 100644
index d9cd2b457484..000000000000
--- a/drivers/pinctrl/pinctrl-pxa168.c
+++ /dev/null
@@ -1,651 +0,0 @@
1/*
2 * linux/drivers/pinctrl/pinmux-pxa168.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#include <linux/device.h>
15#include <linux/module.h>
16#include <linux/io.h>
17#include <linux/platform_device.h>
18#include "pinctrl-pxa3xx.h"
19
20#define PXA168_DS_MASK 0x1800
21#define PXA168_DS_SHIFT 11
22#define PXA168_SLEEP_MASK 0x38
23#define PXA168_SLEEP_SELECT (1 << 9)
24#define PXA168_SLEEP_DATA (1 << 8)
25#define PXA168_SLEEP_DIR (1 << 7)
26
27#define MFPR_168(a, r, f0, f1, f2, f3, f4, f5, f6, f7) \
28 { \
29 .name = #a, \
30 .pin = a, \
31 .mfpr = r, \
32 .func = { \
33 PXA168_MUX_##f0, \
34 PXA168_MUX_##f1, \
35 PXA168_MUX_##f2, \
36 PXA168_MUX_##f3, \
37 PXA168_MUX_##f4, \
38 PXA168_MUX_##f5, \
39 PXA168_MUX_##f6, \
40 PXA168_MUX_##f7, \
41 }, \
42 }
43
44#define GRP_168(a, m, p) \
45 { .name = a, .mux = PXA168_MUX_##m, .pins = p, .npins = ARRAY_SIZE(p), }
46
47/* 131 pins */
48enum pxa168_pin_list {
49 /* 0~122: GPIO0~GPIO122 */
50 PWR_SCL = 123,
51 PWR_SDA,
52 TDI,
53 TMS,
54 TCK,
55 TDO,
56 TRST,
57 WAKEUP = 130,
58};
59
60enum pxa168_mux {
61 /* PXA3xx_MUX_GPIO = 0 (predefined in pinctrl-pxa3xx.h) */
62 PXA168_MUX_GPIO = 0,
63 PXA168_MUX_DFIO,
64 PXA168_MUX_NAND,
65 PXA168_MUX_SMC,
66 PXA168_MUX_SMC_CS0,
67 PXA168_MUX_SMC_CS1,
68 PXA168_MUX_SMC_INT,
69 PXA168_MUX_SMC_RDY,
70 PXA168_MUX_MMC1,
71 PXA168_MUX_MMC2,
72 PXA168_MUX_MMC2_CMD,
73 PXA168_MUX_MMC2_CLK,
74 PXA168_MUX_MMC3,
75 PXA168_MUX_MMC3_CMD,
76 PXA168_MUX_MMC3_CLK,
77 PXA168_MUX_MMC4,
78 PXA168_MUX_MSP,
79 PXA168_MUX_MSP_DAT3,
80 PXA168_MUX_MSP_INS,
81 PXA168_MUX_I2C,
82 PXA168_MUX_PWRI2C,
83 PXA168_MUX_AC97,
84 PXA168_MUX_AC97_SYSCLK,
85 PXA168_MUX_PWM,
86 PXA168_MUX_PWM1,
87 PXA168_MUX_XD,
88 PXA168_MUX_XP,
89 PXA168_MUX_LCD,
90 PXA168_MUX_CCIC,
91 PXA168_MUX_CF,
92 PXA168_MUX_CF_RDY,
93 PXA168_MUX_CF_nINPACK,
94 PXA168_MUX_CF_nWAIT,
95 PXA168_MUX_KP_MKOUT,
96 PXA168_MUX_KP_MKIN,
97 PXA168_MUX_KP_DK,
98 PXA168_MUX_ETH,
99 PXA168_MUX_ETH_TX,
100 PXA168_MUX_ETH_RX,
101 PXA168_MUX_ONE_WIRE,
102 PXA168_MUX_UART1,
103 PXA168_MUX_UART1_TX,
104 PXA168_MUX_UART1_CTS,
105 PXA168_MUX_UART1_nRI,
106 PXA168_MUX_UART1_DTR,
107 PXA168_MUX_UART2,
108 PXA168_MUX_UART2_TX,
109 PXA168_MUX_UART3,
110 PXA168_MUX_UART3_TX,
111 PXA168_MUX_UART3_CTS,
112 PXA168_MUX_SSP1,
113 PXA168_MUX_SSP1_TX,
114 PXA168_MUX_SSP2,
115 PXA168_MUX_SSP2_TX,
116 PXA168_MUX_SSP3,
117 PXA168_MUX_SSP3_TX,
118 PXA168_MUX_SSP4,
119 PXA168_MUX_SSP4_TX,
120 PXA168_MUX_SSP5,
121 PXA168_MUX_SSP5_TX,
122 PXA168_MUX_USB,
123 PXA168_MUX_JTAG,
124 PXA168_MUX_RESET,
125 PXA168_MUX_WAKEUP,
126 PXA168_MUX_EXT_32K_IN,
127 PXA168_MUX_NONE = 0xffff,
128};
129
130static struct pinctrl_pin_desc pxa168_pads[] = {
131 PINCTRL_PIN(GPIO0, "GPIO0"),
132 PINCTRL_PIN(GPIO1, "GPIO1"),
133 PINCTRL_PIN(GPIO2, "GPIO2"),
134 PINCTRL_PIN(GPIO3, "GPIO3"),
135 PINCTRL_PIN(GPIO4, "GPIO4"),
136 PINCTRL_PIN(GPIO5, "GPIO5"),
137 PINCTRL_PIN(GPIO6, "GPIO6"),
138 PINCTRL_PIN(GPIO7, "GPIO7"),
139 PINCTRL_PIN(GPIO8, "GPIO8"),
140 PINCTRL_PIN(GPIO9, "GPIO9"),
141 PINCTRL_PIN(GPIO10, "GPIO10"),
142 PINCTRL_PIN(GPIO11, "GPIO11"),
143 PINCTRL_PIN(GPIO12, "GPIO12"),
144 PINCTRL_PIN(GPIO13, "GPIO13"),
145 PINCTRL_PIN(GPIO14, "GPIO14"),
146 PINCTRL_PIN(GPIO15, "GPIO15"),
147 PINCTRL_PIN(GPIO16, "GPIO16"),
148 PINCTRL_PIN(GPIO17, "GPIO17"),
149 PINCTRL_PIN(GPIO18, "GPIO18"),
150 PINCTRL_PIN(GPIO19, "GPIO19"),
151 PINCTRL_PIN(GPIO20, "GPIO20"),
152 PINCTRL_PIN(GPIO21, "GPIO21"),
153 PINCTRL_PIN(GPIO22, "GPIO22"),
154 PINCTRL_PIN(GPIO23, "GPIO23"),
155 PINCTRL_PIN(GPIO24, "GPIO24"),
156 PINCTRL_PIN(GPIO25, "GPIO25"),
157 PINCTRL_PIN(GPIO26, "GPIO26"),
158 PINCTRL_PIN(GPIO27, "GPIO27"),
159 PINCTRL_PIN(GPIO28, "GPIO28"),
160 PINCTRL_PIN(GPIO29, "GPIO29"),
161 PINCTRL_PIN(GPIO30, "GPIO30"),
162 PINCTRL_PIN(GPIO31, "GPIO31"),
163 PINCTRL_PIN(GPIO32, "GPIO32"),
164 PINCTRL_PIN(GPIO33, "GPIO33"),
165 PINCTRL_PIN(GPIO34, "GPIO34"),
166 PINCTRL_PIN(GPIO35, "GPIO35"),
167 PINCTRL_PIN(GPIO36, "GPIO36"),
168 PINCTRL_PIN(GPIO37, "GPIO37"),
169 PINCTRL_PIN(GPIO38, "GPIO38"),
170 PINCTRL_PIN(GPIO39, "GPIO39"),
171 PINCTRL_PIN(GPIO40, "GPIO40"),
172 PINCTRL_PIN(GPIO41, "GPIO41"),
173 PINCTRL_PIN(GPIO42, "GPIO42"),
174 PINCTRL_PIN(GPIO43, "GPIO43"),
175 PINCTRL_PIN(GPIO44, "GPIO44"),
176 PINCTRL_PIN(GPIO45, "GPIO45"),
177 PINCTRL_PIN(GPIO46, "GPIO46"),
178 PINCTRL_PIN(GPIO47, "GPIO47"),
179 PINCTRL_PIN(GPIO48, "GPIO48"),
180 PINCTRL_PIN(GPIO49, "GPIO49"),
181 PINCTRL_PIN(GPIO50, "GPIO50"),
182 PINCTRL_PIN(GPIO51, "GPIO51"),
183 PINCTRL_PIN(GPIO52, "GPIO52"),
184 PINCTRL_PIN(GPIO53, "GPIO53"),
185 PINCTRL_PIN(GPIO54, "GPIO54"),
186 PINCTRL_PIN(GPIO55, "GPIO55"),
187 PINCTRL_PIN(GPIO56, "GPIO56"),
188 PINCTRL_PIN(GPIO57, "GPIO57"),
189 PINCTRL_PIN(GPIO58, "GPIO58"),
190 PINCTRL_PIN(GPIO59, "GPIO59"),
191 PINCTRL_PIN(GPIO60, "GPIO60"),
192 PINCTRL_PIN(GPIO61, "GPIO61"),
193 PINCTRL_PIN(GPIO62, "GPIO62"),
194 PINCTRL_PIN(GPIO63, "GPIO63"),
195 PINCTRL_PIN(GPIO64, "GPIO64"),
196 PINCTRL_PIN(GPIO65, "GPIO65"),
197 PINCTRL_PIN(GPIO66, "GPIO66"),
198 PINCTRL_PIN(GPIO67, "GPIO67"),
199 PINCTRL_PIN(GPIO68, "GPIO68"),
200 PINCTRL_PIN(GPIO69, "GPIO69"),
201 PINCTRL_PIN(GPIO70, "GPIO70"),
202 PINCTRL_PIN(GPIO71, "GPIO71"),
203 PINCTRL_PIN(GPIO72, "GPIO72"),
204 PINCTRL_PIN(GPIO73, "GPIO73"),
205 PINCTRL_PIN(GPIO74, "GPIO74"),
206 PINCTRL_PIN(GPIO75, "GPIO75"),
207 PINCTRL_PIN(GPIO76, "GPIO76"),
208 PINCTRL_PIN(GPIO77, "GPIO77"),
209 PINCTRL_PIN(GPIO78, "GPIO78"),
210 PINCTRL_PIN(GPIO79, "GPIO79"),
211 PINCTRL_PIN(GPIO80, "GPIO80"),
212 PINCTRL_PIN(GPIO81, "GPIO81"),
213 PINCTRL_PIN(GPIO82, "GPIO82"),
214 PINCTRL_PIN(GPIO83, "GPIO83"),
215 PINCTRL_PIN(GPIO84, "GPIO84"),
216 PINCTRL_PIN(GPIO85, "GPIO85"),
217 PINCTRL_PIN(GPIO86, "GPIO86"),
218 PINCTRL_PIN(GPIO87, "GPIO87"),
219 PINCTRL_PIN(GPIO88, "GPIO88"),
220 PINCTRL_PIN(GPIO89, "GPIO89"),
221 PINCTRL_PIN(GPIO90, "GPIO90"),
222 PINCTRL_PIN(GPIO91, "GPIO91"),
223 PINCTRL_PIN(GPIO92, "GPIO92"),
224 PINCTRL_PIN(GPIO93, "GPIO93"),
225 PINCTRL_PIN(GPIO94, "GPIO94"),
226 PINCTRL_PIN(GPIO95, "GPIO95"),
227 PINCTRL_PIN(GPIO96, "GPIO96"),
228 PINCTRL_PIN(GPIO97, "GPIO97"),
229 PINCTRL_PIN(GPIO98, "GPIO98"),
230 PINCTRL_PIN(GPIO99, "GPIO99"),
231 PINCTRL_PIN(GPIO100, "GPIO100"),
232 PINCTRL_PIN(GPIO101, "GPIO101"),
233 PINCTRL_PIN(GPIO102, "GPIO102"),
234 PINCTRL_PIN(GPIO103, "GPIO103"),
235 PINCTRL_PIN(GPIO104, "GPIO104"),
236 PINCTRL_PIN(GPIO105, "GPIO105"),
237 PINCTRL_PIN(GPIO106, "GPIO106"),
238 PINCTRL_PIN(GPIO107, "GPIO107"),
239 PINCTRL_PIN(GPIO108, "GPIO108"),
240 PINCTRL_PIN(GPIO109, "GPIO109"),
241 PINCTRL_PIN(GPIO110, "GPIO110"),
242 PINCTRL_PIN(GPIO111, "GPIO111"),
243 PINCTRL_PIN(GPIO112, "GPIO112"),
244 PINCTRL_PIN(GPIO113, "GPIO113"),
245 PINCTRL_PIN(GPIO114, "GPIO114"),
246 PINCTRL_PIN(GPIO115, "GPIO115"),
247 PINCTRL_PIN(GPIO116, "GPIO116"),
248 PINCTRL_PIN(GPIO117, "GPIO117"),
249 PINCTRL_PIN(GPIO118, "GPIO118"),
250 PINCTRL_PIN(GPIO119, "GPIO119"),
251 PINCTRL_PIN(GPIO120, "GPIO120"),
252 PINCTRL_PIN(GPIO121, "GPIO121"),
253 PINCTRL_PIN(GPIO122, "GPIO122"),
254 PINCTRL_PIN(PWR_SCL, "PWR_SCL"),
255 PINCTRL_PIN(PWR_SDA, "PWR_SDA"),
256 PINCTRL_PIN(TDI, "TDI"),
257 PINCTRL_PIN(TMS, "TMS"),
258 PINCTRL_PIN(TCK, "TCK"),
259 PINCTRL_PIN(TDO, "TDO"),
260 PINCTRL_PIN(TRST, "TRST"),
261 PINCTRL_PIN(WAKEUP, "WAKEUP"),
262};
263
264struct pxa3xx_mfp_pin pxa168_mfp[] = {
265 /* pin offs f0 f1 f2 f3 f4 f5 f6 f7 */
266 MFPR_168(GPIO0, 0x04C, DFIO, NONE, NONE, MSP, MMC3_CMD, GPIO, MMC3, NONE),
267 MFPR_168(GPIO1, 0x050, DFIO, NONE, NONE, MSP, MMC3_CLK, GPIO, MMC3, NONE),
268 MFPR_168(GPIO2, 0x054, DFIO, NONE, NONE, MSP, NONE, GPIO, MMC3, NONE),
269 MFPR_168(GPIO3, 0x058, DFIO, NONE, NONE, NONE, NONE, GPIO, MMC3, NONE),
270 MFPR_168(GPIO4, 0x05C, DFIO, NONE, NONE, MSP_DAT3, NONE, GPIO, MMC3, NONE),
271 MFPR_168(GPIO5, 0x060, DFIO, NONE, NONE, MSP, NONE, GPIO, MMC3, NONE),
272 MFPR_168(GPIO6, 0x064, DFIO, NONE, NONE, MSP, NONE, GPIO, MMC3, NONE),
273 MFPR_168(GPIO7, 0x068, DFIO, NONE, NONE, MSP, NONE, GPIO, MMC3, NONE),
274 MFPR_168(GPIO8, 0x06C, DFIO, MMC2, UART3_TX, NONE, MMC2_CMD, GPIO, MMC3_CLK, NONE),
275 MFPR_168(GPIO9, 0x070, DFIO, MMC2, UART3, NONE, MMC2_CLK, GPIO, MMC3_CMD, NONE),
276 MFPR_168(GPIO10, 0x074, DFIO, MMC2, UART3, NONE, NONE, GPIO, MSP_DAT3, NONE),
277 MFPR_168(GPIO11, 0x078, DFIO, MMC2, UART3, NONE, NONE, GPIO, MSP, NONE),
278 MFPR_168(GPIO12, 0x07C, DFIO, MMC2, UART3, NONE, NONE, GPIO, MSP, NONE),
279 MFPR_168(GPIO13, 0x080, DFIO, MMC2, UART3, NONE, NONE, GPIO, MSP, NONE),
280 MFPR_168(GPIO14, 0x084, DFIO, MMC2, NONE, NONE, NONE, GPIO, MSP, NONE),
281 MFPR_168(GPIO15, 0x088, DFIO, MMC2, NONE, NONE, NONE, GPIO, MSP, NONE),
282 MFPR_168(GPIO16, 0x08C, GPIO, NAND, SMC_CS0, SMC_CS1, NONE, NONE, MMC3, NONE),
283 MFPR_168(GPIO17, 0x090, NAND, NONE, NONE, NONE, NONE, GPIO, MSP, NONE),
284 MFPR_168(GPIO18, 0x094, GPIO, NAND, SMC_CS1, SMC_CS0, NONE, NONE, NONE, NONE),
285 MFPR_168(GPIO19, 0x098, SMC_CS0, NONE, NONE, CF, NONE, GPIO, NONE, NONE),
286 MFPR_168(GPIO20, 0x09C, GPIO, NONE, SMC_CS1, CF, CF_RDY, NONE, NONE, NONE),
287 MFPR_168(GPIO21, 0x0A0, NAND, MMC2_CLK, NONE, NONE, NONE, GPIO, NONE, NONE),
288 MFPR_168(GPIO22, 0x0A4, NAND, MMC2_CMD, NONE, NONE, NONE, GPIO, NONE, NONE),
289 MFPR_168(GPIO23, 0x0A8, SMC, NAND, NONE, CF, NONE, GPIO, NONE, NONE),
290 MFPR_168(GPIO24, 0x0AC, NAND, NONE, NONE, NONE, NONE, GPIO, NONE, NONE),
291 MFPR_168(GPIO25, 0x0B0, SMC, NAND, NONE, CF, NONE, GPIO, NONE, NONE),
292 MFPR_168(GPIO26, 0x0B4, GPIO, NAND, NONE, NONE, CF, NONE, NONE, NONE),
293 MFPR_168(GPIO27, 0x0B8, SMC_INT, NAND, SMC, NONE, SMC_RDY, GPIO, NONE, NONE),
294 MFPR_168(GPIO28, 0x0BC, SMC_RDY, MMC4, SMC, CF_RDY, NONE, GPIO, MMC2_CMD, NONE),
295 MFPR_168(GPIO29, 0x0C0, SMC, MMC4, NONE, CF, NONE, GPIO, MMC2_CLK, KP_DK),
296 MFPR_168(GPIO30, 0x0C4, SMC, MMC4, UART3_TX, CF, NONE, GPIO, MMC2, KP_DK),
297 MFPR_168(GPIO31, 0x0C8, SMC, MMC4, UART3, CF, NONE, GPIO, MMC2, KP_DK),
298 MFPR_168(GPIO32, 0x0CC, SMC, MMC4, UART3, CF, NONE, GPIO, MMC2, KP_DK),
299 MFPR_168(GPIO33, 0x0D0, SMC, MMC4, UART3, CF, CF_nINPACK, GPIO, MMC2, KP_DK),
300 MFPR_168(GPIO34, 0x0D4, GPIO, NONE, SMC_CS1, CF, CF_nWAIT, NONE, MMC3, KP_DK),
301 MFPR_168(GPIO35, 0x0D8, GPIO, NONE, SMC, CF_nINPACK, NONE, NONE, MMC3_CMD, KP_DK),
302 MFPR_168(GPIO36, 0x0DC, GPIO, NONE, SMC, CF_nWAIT, NONE, NONE, MMC3_CLK, KP_DK),
303 MFPR_168(GPIO37, 0x000, GPIO, MMC1, NONE, KP_MKOUT, CCIC, XP, KP_MKIN, KP_DK),
304 MFPR_168(GPIO38, 0x004, GPIO, MMC1, NONE, KP_MKOUT, CCIC, XP, KP_MKIN, KP_DK),
305 MFPR_168(GPIO39, 0x008, GPIO, NONE, NONE, KP_MKOUT, CCIC, XP, KP_MKIN, KP_DK),
306 MFPR_168(GPIO40, 0x00C, GPIO, MMC1, MSP, KP_MKOUT, CCIC, XP, KP_MKIN, KP_DK),
307 MFPR_168(GPIO41, 0x010, GPIO, MMC1, MSP, NONE, CCIC, XP, KP_MKIN, KP_DK),
308 MFPR_168(GPIO42, 0x014, GPIO, I2C, NONE, MSP, CCIC, XP, KP_MKIN, KP_DK),
309 MFPR_168(GPIO43, 0x018, GPIO, MMC1, MSP, MSP_INS, NONE, NONE, KP_MKIN, KP_DK),
310 MFPR_168(GPIO44, 0x01C, GPIO, MMC1, MSP_DAT3, MSP, CCIC, XP, KP_MKIN, KP_DK),
311 MFPR_168(GPIO45, 0x020, GPIO, NONE, NONE, MSP, CCIC, XP, NONE, KP_DK),
312 MFPR_168(GPIO46, 0x024, GPIO, MMC1, MSP_INS, MSP, CCIC, NONE, KP_MKOUT, KP_DK),
313 MFPR_168(GPIO47, 0x028, GPIO, NONE, NONE, MSP_INS, NONE, XP, NONE, KP_DK),
314 MFPR_168(GPIO48, 0x02C, GPIO, MMC1, NONE, MSP_DAT3, CCIC, NONE, NONE, KP_DK),
315 MFPR_168(GPIO49, 0x030, GPIO, MMC1, NONE, MSP, NONE, XD, KP_MKOUT, NONE),
316 MFPR_168(GPIO50, 0x034, GPIO, I2C, NONE, MSP, CCIC, XD, KP_MKOUT, NONE),
317 MFPR_168(GPIO51, 0x038, GPIO, MMC1, NONE, MSP, NONE, XD, KP_MKOUT, NONE),
318 MFPR_168(GPIO52, 0x03C, GPIO, MMC1, NONE, MSP, NONE, XD, KP_MKOUT, NONE),
319 MFPR_168(GPIO53, 0x040, GPIO, MMC1, NONE, NONE, NONE, XD, KP_MKOUT, NONE),
320 MFPR_168(GPIO54, 0x044, GPIO, MMC1, NONE, NONE, CCIC, XD, KP_MKOUT, NONE),
321 MFPR_168(GPIO55, 0x048, GPIO, NONE, NONE, MSP, CCIC, XD, KP_MKOUT, NONE),
322 MFPR_168(GPIO56, 0x0E0, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
323 MFPR_168(GPIO57, 0x0E4, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
324 MFPR_168(GPIO58, 0x0E8, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
325 MFPR_168(GPIO59, 0x0EC, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
326 MFPR_168(GPIO60, 0x0F0, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
327 MFPR_168(GPIO61, 0x0F4, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
328 MFPR_168(GPIO62, 0x0F8, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
329 MFPR_168(GPIO63, 0x0FC, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
330 MFPR_168(GPIO64, 0x100, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
331 MFPR_168(GPIO65, 0x104, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
332 MFPR_168(GPIO66, 0x108, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
333 MFPR_168(GPIO67, 0x10C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
334 MFPR_168(GPIO68, 0x110, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
335 MFPR_168(GPIO69, 0x114, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
336 MFPR_168(GPIO70, 0x118, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
337 MFPR_168(GPIO71, 0x11C, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
338 MFPR_168(GPIO72, 0x120, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
339 MFPR_168(GPIO73, 0x124, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
340 MFPR_168(GPIO74, 0x128, GPIO, LCD, PWM, XD, NONE, NONE, NONE, NONE),
341 MFPR_168(GPIO75, 0x12C, GPIO, LCD, PWM, XD, ONE_WIRE, NONE, NONE, NONE),
342 MFPR_168(GPIO76, 0x130, GPIO, LCD, PWM, I2C, NONE, NONE, MSP_INS, NONE),
343 MFPR_168(GPIO77, 0x134, GPIO, LCD, PWM1, I2C, ONE_WIRE, NONE, XD, NONE),
344 MFPR_168(GPIO78, 0x138, GPIO, LCD, NONE, NONE, NONE, MMC4, NONE, NONE),
345 MFPR_168(GPIO79, 0x13C, GPIO, LCD, NONE, NONE, ONE_WIRE, MMC4, NONE, NONE),
346 MFPR_168(GPIO80, 0x140, GPIO, LCD, NONE, I2C, NONE, MMC4, NONE, NONE),
347 MFPR_168(GPIO81, 0x144, GPIO, LCD, NONE, I2C, ONE_WIRE, MMC4, NONE, NONE),
348 MFPR_168(GPIO82, 0x148, GPIO, LCD, PWM, NONE, NONE, MMC4, NONE, NONE),
349 MFPR_168(GPIO83, 0x14C, GPIO, LCD, PWM, NONE, RESET, MMC4, NONE, NONE),
350 MFPR_168(GPIO84, 0x150, GPIO, NONE, PWM, ONE_WIRE, PWM1, NONE, NONE, EXT_32K_IN),
351 MFPR_168(GPIO85, 0x154, GPIO, NONE, PWM1, NONE, NONE, NONE, NONE, USB),
352 MFPR_168(GPIO86, 0x158, GPIO, MMC2, UART2, NONE, JTAG, ETH_TX, SSP5_TX, SSP5),
353 MFPR_168(GPIO87, 0x15C, GPIO, MMC2, UART2, NONE, JTAG, ETH_TX, SSP5, SSP5_TX),
354 MFPR_168(GPIO88, 0x160, GPIO, MMC2, UART2, UART2_TX, JTAG, ETH_TX, ETH_RX, SSP5),
355 MFPR_168(GPIO89, 0x164, GPIO, MMC2, UART2_TX, UART2, JTAG, ETH_TX, ETH_RX, SSP5),
356 MFPR_168(GPIO90, 0x168, GPIO, MMC2, NONE, SSP3, JTAG, ETH_TX, ETH_RX, NONE),
357 MFPR_168(GPIO91, 0x16C, GPIO, MMC2, NONE, SSP3, SSP4, ETH_TX, ETH_RX, NONE),
358 MFPR_168(GPIO92, 0x170, GPIO, MMC2, NONE, SSP3, SSP3_TX, ETH, NONE, NONE),
359 MFPR_168(GPIO93, 0x174, GPIO, MMC2, NONE, SSP3_TX, SSP3, ETH, NONE, NONE),
360 MFPR_168(GPIO94, 0x178, GPIO, MMC2_CMD, SSP3, AC97_SYSCLK, AC97, ETH, NONE, NONE),
361 MFPR_168(GPIO95, 0x17C, GPIO, MMC2_CLK, NONE, NONE, AC97, ETH, NONE, NONE),
362 MFPR_168(GPIO96, 0x180, GPIO, PWM, NONE, MMC2, NONE, ETH_RX, ETH_TX, NONE),
363 MFPR_168(GPIO97, 0x184, GPIO, PWM, ONE_WIRE, NONE, NONE, ETH_RX, ETH_TX, NONE),
364 MFPR_168(GPIO98, 0x188, GPIO, PWM1, UART3_TX, UART3, NONE, ETH_RX, ETH_TX, NONE),
365 MFPR_168(GPIO99, 0x18C, GPIO, ONE_WIRE, UART3, UART3_TX, NONE, ETH_RX, ETH_TX, NONE),
366 MFPR_168(GPIO100, 0x190, GPIO, NONE, UART3_CTS, UART3, NONE, ETH, NONE, NONE),
367 MFPR_168(GPIO101, 0x194, GPIO, NONE, UART3, UART3_CTS, NONE, ETH, NONE, NONE),
368 MFPR_168(GPIO102, 0x198, GPIO, I2C, UART3, SSP4, NONE, NONE, NONE, NONE),
369 MFPR_168(GPIO103, 0x19C, GPIO, I2C, UART3, SSP4, SSP2, ETH, NONE, NONE),
370 MFPR_168(GPIO104, 0x1A0, GPIO, PWM, UART1, SSP4, SSP4_TX, AC97, KP_MKOUT, NONE),
371 MFPR_168(GPIO105, 0x1A4, GPIO, I2C, UART1, SSP4_TX, SSP4, AC97, KP_MKOUT, NONE),
372 MFPR_168(GPIO106, 0x1A8, GPIO, I2C, PWM1, AC97_SYSCLK, MMC2, NONE, KP_MKOUT, NONE),
373 MFPR_168(GPIO107, 0x1AC, GPIO, UART1_TX, UART1, NONE, SSP2, MSP_DAT3, NONE, KP_MKIN),
374 MFPR_168(GPIO108, 0x1B0, GPIO, UART1, UART1_TX, NONE, SSP2_TX, MSP, NONE, KP_MKIN),
375 MFPR_168(GPIO109, 0x1B4, GPIO, UART1_CTS, UART1, NONE, AC97_SYSCLK, MSP, NONE, KP_MKIN),
376 MFPR_168(GPIO110, 0x1B8, GPIO, UART1, UART1_CTS, NONE, SMC_RDY, MSP, NONE, KP_MKIN),
377 MFPR_168(GPIO111, 0x1BC, GPIO, UART1_nRI, UART1, SSP3, SSP2, MSP, XD, KP_MKOUT),
378 MFPR_168(GPIO112, 0x1C0, GPIO, UART1_DTR, UART1, ONE_WIRE, SSP2, MSP, XD, KP_MKOUT),
379 MFPR_168(GPIO113, 0x1C4, GPIO, NONE, NONE, NONE, NONE, NONE, AC97_SYSCLK, NONE),
380 MFPR_168(GPIO114, 0x1C8, GPIO, SSP1, NONE, NONE, NONE, NONE, AC97, NONE),
381 MFPR_168(GPIO115, 0x1CC, GPIO, SSP1, NONE, NONE, NONE, NONE, AC97, NONE),
382 MFPR_168(GPIO116, 0x1D0, GPIO, SSP1_TX, SSP1, NONE, NONE, NONE, AC97, NONE),
383 MFPR_168(GPIO117, 0x1D4, GPIO, SSP1, SSP1_TX, NONE, MMC2_CMD, NONE, AC97, NONE),
384 MFPR_168(GPIO118, 0x1D8, GPIO, SSP2, NONE, NONE, MMC2_CLK, NONE, AC97, KP_MKIN),
385 MFPR_168(GPIO119, 0x1DC, GPIO, SSP2, NONE, NONE, MMC2, NONE, AC97, KP_MKIN),
386 MFPR_168(GPIO120, 0x1E0, GPIO, SSP2, SSP2_TX, NONE, MMC2, NONE, NONE, KP_MKIN),
387 MFPR_168(GPIO121, 0x1E4, GPIO, SSP2_TX, SSP2, NONE, MMC2, NONE, NONE, KP_MKIN),
388 MFPR_168(GPIO122, 0x1E8, GPIO, AC97_SYSCLK, SSP2, PWM, MMC2, NONE, NONE, NONE),
389 MFPR_168(PWR_SCL, 0x1EC, PWRI2C, NONE, NONE, NONE, NONE, NONE, GPIO, MMC4),
390 MFPR_168(PWR_SDA, 0x1F0, PWRI2C, NONE, NONE, NONE, NONE, NONE, GPIO, NONE),
391 MFPR_168(TDI, 0x1F4, JTAG, PWM1, UART2, MMC4, SSP5, NONE, XD, MMC4),
392 MFPR_168(TMS, 0x1F8, JTAG, PWM, UART2, NONE, SSP5, NONE, XD, MMC4),
393 MFPR_168(TCK, 0x1FC, JTAG, PWM, UART2, UART2_TX, SSP5, NONE, XD, MMC4),
394 MFPR_168(TDO, 0x200, JTAG, PWM, UART2_TX, UART2, SSP5_TX, NONE, XD, MMC4),
395 MFPR_168(TRST, 0x204, JTAG, ONE_WIRE, SSP2, SSP3, AC97_SYSCLK, NONE, XD, MMC4),
396 MFPR_168(WAKEUP, 0x208, WAKEUP, ONE_WIRE, PWM1, PWM, SSP2, NONE, GPIO, MMC4),
397};
398
399static const unsigned p168_jtag_pin1[] = {TDI, TMS, TCK, TDO, TRST};
400static const unsigned p168_wakeup_pin1[] = {WAKEUP};
401static const unsigned p168_ssp1rx_pin1[] = {GPIO114, GPIO115, GPIO116};
402static const unsigned p168_ssp1tx_pin1[] = {GPIO117};
403static const unsigned p168_ssp4rx_pin1[] = {GPIO102, GPIO103, GPIO104};
404static const unsigned p168_ssp4tx_pin1[] = {GPIO105};
405static const unsigned p168_ssp5rx_pin1[] = {GPIO86, GPIO88, GPIO89};
406static const unsigned p168_ssp5tx_pin1[] = {GPIO87};
407static const unsigned p168_i2c_pin1[] = {GPIO105, GPIO106};
408static const unsigned p168_pwri2c_pin1[] = {PWR_SCL, PWR_SDA};
409static const unsigned p168_mmc1_pin1[] = {GPIO40, GPIO41, GPIO43, GPIO46,
410 GPIO49, GPIO51, GPIO52, GPIO53};
411static const unsigned p168_mmc2_data_pin1[] = {GPIO90, GPIO91, GPIO92, GPIO93};
412static const unsigned p168_mmc2_cmd_pin1[] = {GPIO94};
413static const unsigned p168_mmc2_clk_pin1[] = {GPIO95};
414static const unsigned p168_mmc3_data_pin1[] = {GPIO0, GPIO1, GPIO2, GPIO3,
415 GPIO4, GPIO5, GPIO6, GPIO7};
416static const unsigned p168_mmc3_cmd_pin1[] = {GPIO9};
417static const unsigned p168_mmc3_clk_pin1[] = {GPIO8};
418static const unsigned p168_eth_pin1[] = {GPIO92, GPIO93, GPIO100, GPIO101,
419 GPIO103};
420static const unsigned p168_ethtx_pin1[] = {GPIO86, GPIO87, GPIO88, GPIO89,
421 GPIO90, GPIO91};
422static const unsigned p168_ethrx_pin1[] = {GPIO94, GPIO95, GPIO96, GPIO97,
423 GPIO98, GPIO99};
424static const unsigned p168_uart1rx_pin1[] = {GPIO107};
425static const unsigned p168_uart1tx_pin1[] = {GPIO108};
426static const unsigned p168_uart3rx_pin1[] = {GPIO98, GPIO100, GPIO101};
427static const unsigned p168_uart3tx_pin1[] = {GPIO99};
428static const unsigned p168_msp_pin1[] = {GPIO40, GPIO41, GPIO42, GPIO43,
429 GPIO44, GPIO50};
430static const unsigned p168_ccic_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40,
431 GPIO41, GPIO42, GPIO44, GPIO45, GPIO46, GPIO48, GPIO54, GPIO55};
432static const unsigned p168_xd_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40,
433 GPIO41, GPIO42, GPIO44, GPIO45, GPIO47, GPIO48, GPIO49, GPIO50,
434 GPIO51, GPIO52};
435static const unsigned p168_lcd_pin1[] = {GPIO56, GPIO57, GPIO58, GPIO59,
436 GPIO60, GPIO61, GPIO62, GPIO63, GPIO64, GPIO65, GPIO66, GPIO67,
437 GPIO68, GPIO69, GPIO70, GPIO71, GPIO72, GPIO73, GPIO74, GPIO75,
438 GPIO76, GPIO77, GPIO78, GPIO79, GPIO80, GPIO81, GPIO82, GPIO83};
439static const unsigned p168_dfio_pin1[] = {GPIO0, GPIO1, GPIO2, GPIO3,
440 GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12,
441 GPIO13, GPIO14, GPIO15};
442static const unsigned p168_nand_pin1[] = {GPIO16, GPIO17, GPIO21, GPIO22,
443 GPIO24, GPIO26};
444static const unsigned p168_smc_pin1[] = {GPIO23, GPIO25, GPIO29, GPIO35,
445 GPIO36};
446static const unsigned p168_smccs0_pin1[] = {GPIO18};
447static const unsigned p168_smccs1_pin1[] = {GPIO34};
448static const unsigned p168_smcrdy_pin1[] = {GPIO28};
449static const unsigned p168_ac97sysclk_pin1[] = {GPIO113};
450static const unsigned p168_ac97_pin1[] = {GPIO114, GPIO115, GPIO117, GPIO118,
451 GPIO119};
452static const unsigned p168_cf_pin1[] = {GPIO19, GPIO20, GPIO23, GPIO25,
453 GPIO28, GPIO29, GPIO30, GPIO31, GPIO32, GPIO33, GPIO34, GPIO35,
454 GPIO36};
455static const unsigned p168_kpmkin_pin1[] = {GPIO109, GPIO110, GPIO121};
456static const unsigned p168_kpmkout_pin1[] = {GPIO111, GPIO112};
457static const unsigned p168_gpio86_pin1[] = {WAKEUP};
458static const unsigned p168_gpio86_pin2[] = {GPIO86};
459static const unsigned p168_gpio87_pin1[] = {GPIO87};
460static const unsigned p168_gpio87_pin2[] = {PWR_SDA};
461static const unsigned p168_gpio88_pin1[] = {GPIO88};
462static const unsigned p168_gpio88_pin2[] = {PWR_SCL};
463
464static struct pxa3xx_pin_group pxa168_grps[] = {
465 GRP_168("uart1rx-1", UART1, p168_uart1rx_pin1),
466 GRP_168("uart1tx-1", UART1_TX, p168_uart1tx_pin1),
467 GRP_168("uart3rx-1", UART3, p168_uart3rx_pin1),
468 GRP_168("uart3tx-1", UART3_TX, p168_uart3tx_pin1),
469 GRP_168("ssp1rx-1", SSP1, p168_ssp1rx_pin1),
470 GRP_168("ssp1tx-1", SSP1_TX, p168_ssp1tx_pin1),
471 GRP_168("ssp4rx-1", SSP4, p168_ssp4rx_pin1),
472 GRP_168("ssp4tx-1", SSP4_TX, p168_ssp4tx_pin1),
473 GRP_168("ssp5rx-1", SSP5, p168_ssp5rx_pin1),
474 GRP_168("ssp5tx-1", SSP5_TX, p168_ssp5tx_pin1),
475 GRP_168("jtag", JTAG, p168_jtag_pin1),
476 GRP_168("wakeup", WAKEUP, p168_wakeup_pin1),
477 GRP_168("i2c", I2C, p168_i2c_pin1),
478 GRP_168("pwri2c", PWRI2C, p168_pwri2c_pin1),
479 GRP_168("mmc1 8p1", MMC1, p168_mmc1_pin1),
480 GRP_168("mmc2 4p1", MMC2, p168_mmc2_data_pin1),
481 GRP_168("mmc2 cmd1", MMC2_CMD, p168_mmc2_cmd_pin1),
482 GRP_168("mmc2 clk1", MMC2_CLK, p168_mmc2_clk_pin1),
483 GRP_168("mmc3 8p1", MMC3, p168_mmc3_data_pin1),
484 GRP_168("mmc3 cmd1", MMC3_CMD, p168_mmc3_cmd_pin1),
485 GRP_168("mmc3 clk1", MMC3_CLK, p168_mmc3_clk_pin1),
486 GRP_168("eth", ETH, p168_eth_pin1),
487 GRP_168("eth rx", ETH_RX, p168_ethrx_pin1),
488 GRP_168("eth tx", ETH_TX, p168_ethtx_pin1),
489 GRP_168("msp", MSP, p168_msp_pin1),
490 GRP_168("ccic", CCIC, p168_ccic_pin1),
491 GRP_168("xd", XD, p168_xd_pin1),
492 GRP_168("lcd", LCD, p168_lcd_pin1),
493 GRP_168("dfio", DFIO, p168_dfio_pin1),
494 GRP_168("nand", NAND, p168_nand_pin1),
495 GRP_168("smc", SMC, p168_smc_pin1),
496 GRP_168("smc cs0", SMC_CS0, p168_smccs0_pin1),
497 GRP_168("smc cs1", SMC_CS1, p168_smccs1_pin1),
498 GRP_168("smc rdy", SMC_RDY, p168_smcrdy_pin1),
499 GRP_168("ac97 sysclk", AC97_SYSCLK, p168_ac97sysclk_pin1),
500 GRP_168("ac97", AC97, p168_ac97_pin1),
501 GRP_168("cf", CF, p168_cf_pin1),
502 GRP_168("kp mkin 3p1", KP_MKIN, p168_kpmkin_pin1),
503 GRP_168("kp mkout 2p1", KP_MKOUT, p168_kpmkout_pin1),
504 GRP_168("gpio86-1", GPIO, p168_gpio86_pin1),
505 GRP_168("gpio86-2", GPIO, p168_gpio86_pin2),
506 GRP_168("gpio87-1", GPIO, p168_gpio87_pin1),
507 GRP_168("gpio87-2", GPIO, p168_gpio87_pin2),
508 GRP_168("gpio88-1", GPIO, p168_gpio88_pin1),
509 GRP_168("gpio88-2", GPIO, p168_gpio88_pin2),
510};
511
512static const char * const p168_uart1rx_grps[] = {"uart1rx-1"};
513static const char * const p168_uart1tx_grps[] = {"uart1tx-1"};
514static const char * const p168_uart3rx_grps[] = {"uart3rx-1"};
515static const char * const p168_uart3tx_grps[] = {"uart3tx-1"};
516static const char * const p168_ssp1rx_grps[] = {"ssp1rx-1"};
517static const char * const p168_ssp1tx_grps[] = {"ssp1tx-1"};
518static const char * const p168_ssp4rx_grps[] = {"ssp4rx-1"};
519static const char * const p168_ssp4tx_grps[] = {"ssp4tx-1"};
520static const char * const p168_ssp5rx_grps[] = {"ssp5rx-1"};
521static const char * const p168_ssp5tx_grps[] = {"ssp5tx-1"};
522static const char * const p168_i2c_grps[] = {"i2c"};
523static const char * const p168_pwri2c_grps[] = {"pwri2c"};
524static const char * const p168_mmc1_grps[] = {"mmc1 8p1"};
525static const char * const p168_mmc2_data_grps[] = {"mmc2 4p1"};
526static const char * const p168_mmc2_cmd_grps[] = {"mmc2 cmd1"};
527static const char * const p168_mmc2_clk_grps[] = {"mmc2 clk1"};
528static const char * const p168_mmc3_data_grps[] = {"mmc3 8p1"};
529static const char * const p168_mmc3_cmd_grps[] = {"mmc3 cmd1"};
530static const char * const p168_mmc3_clk_grps[] = {"mmc3 clk1"};
531static const char * const p168_eth_grps[] = {"eth"};
532static const char * const p168_ethrx_grps[] = {"eth rx"};
533static const char * const p168_ethtx_grps[] = {"eth tx"};
534static const char * const p168_msp_grps[] = {"msp"};
535static const char * const p168_ccic_grps[] = {"ccic"};
536static const char * const p168_xd_grps[] = {"xd"};
537static const char * const p168_lcd_grps[] = {"lcd"};
538static const char * const p168_dfio_grps[] = {"dfio"};
539static const char * const p168_nand_grps[] = {"nand"};
540static const char * const p168_smc_grps[] = {"smc"};
541static const char * const p168_smccs0_grps[] = {"smc cs0"};
542static const char * const p168_smccs1_grps[] = {"smc cs1"};
543static const char * const p168_smcrdy_grps[] = {"smc rdy"};
544static const char * const p168_ac97sysclk_grps[] = {"ac97 sysclk"};
545static const char * const p168_ac97_grps[] = {"ac97"};
546static const char * const p168_cf_grps[] = {"cf"};
547static const char * const p168_kpmkin_grps[] = {"kp mkin 3p1"};
548static const char * const p168_kpmkout_grps[] = {"kp mkout 2p1"};
549static const char * const p168_gpio86_grps[] = {"gpio86-1", "gpio86-2"};
550static const char * const p168_gpio87_grps[] = {"gpio87-1", "gpio87-2"};
551static const char * const p168_gpio88_grps[] = {"gpio88-1", "gpio88-2"};
552
553static struct pxa3xx_pmx_func pxa168_funcs[] = {
554 {"uart1 rx", ARRAY_AND_SIZE(p168_uart1rx_grps)},
555 {"uart1 tx", ARRAY_AND_SIZE(p168_uart1tx_grps)},
556 {"uart3 rx", ARRAY_AND_SIZE(p168_uart3rx_grps)},
557 {"uart3 tx", ARRAY_AND_SIZE(p168_uart3tx_grps)},
558 {"ssp1 rx", ARRAY_AND_SIZE(p168_ssp1rx_grps)},
559 {"ssp1 tx", ARRAY_AND_SIZE(p168_ssp1tx_grps)},
560 {"ssp4 rx", ARRAY_AND_SIZE(p168_ssp4rx_grps)},
561 {"ssp4 tx", ARRAY_AND_SIZE(p168_ssp4tx_grps)},
562 {"ssp5 rx", ARRAY_AND_SIZE(p168_ssp5rx_grps)},
563 {"ssp5 tx", ARRAY_AND_SIZE(p168_ssp5tx_grps)},
564 {"i2c", ARRAY_AND_SIZE(p168_i2c_grps)},
565 {"pwri2c", ARRAY_AND_SIZE(p168_pwri2c_grps)},
566 {"mmc1", ARRAY_AND_SIZE(p168_mmc1_grps)},
567 {"mmc2", ARRAY_AND_SIZE(p168_mmc2_data_grps)},
568 {"mmc2 cmd", ARRAY_AND_SIZE(p168_mmc2_cmd_grps)},
569 {"mmc2 clk", ARRAY_AND_SIZE(p168_mmc2_clk_grps)},
570 {"mmc3", ARRAY_AND_SIZE(p168_mmc3_data_grps)},
571 {"mmc3 cmd", ARRAY_AND_SIZE(p168_mmc3_cmd_grps)},
572 {"mmc3 clk", ARRAY_AND_SIZE(p168_mmc3_clk_grps)},
573 {"eth", ARRAY_AND_SIZE(p168_eth_grps)},
574 {"eth rx", ARRAY_AND_SIZE(p168_ethrx_grps)},
575 {"eth tx", ARRAY_AND_SIZE(p168_ethtx_grps)},
576 {"msp", ARRAY_AND_SIZE(p168_msp_grps)},
577 {"ccic", ARRAY_AND_SIZE(p168_ccic_grps)},
578 {"xd", ARRAY_AND_SIZE(p168_xd_grps)},
579 {"lcd", ARRAY_AND_SIZE(p168_lcd_grps)},
580 {"dfio", ARRAY_AND_SIZE(p168_dfio_grps)},
581 {"nand", ARRAY_AND_SIZE(p168_nand_grps)},
582 {"smc", ARRAY_AND_SIZE(p168_smc_grps)},
583 {"smc cs0", ARRAY_AND_SIZE(p168_smccs0_grps)},
584 {"smc cs1", ARRAY_AND_SIZE(p168_smccs1_grps)},
585 {"smc rdy", ARRAY_AND_SIZE(p168_smcrdy_grps)},
586 {"ac97", ARRAY_AND_SIZE(p168_ac97_grps)},
587 {"ac97 sysclk", ARRAY_AND_SIZE(p168_ac97sysclk_grps)},
588 {"cf", ARRAY_AND_SIZE(p168_cf_grps)},
589 {"kpmkin", ARRAY_AND_SIZE(p168_kpmkin_grps)},
590 {"kpmkout", ARRAY_AND_SIZE(p168_kpmkout_grps)},
591 {"gpio86", ARRAY_AND_SIZE(p168_gpio86_grps)},
592 {"gpio87", ARRAY_AND_SIZE(p168_gpio87_grps)},
593 {"gpio88", ARRAY_AND_SIZE(p168_gpio88_grps)},
594};
595
596static struct pinctrl_desc pxa168_pctrl_desc = {
597 .name = "pxa168-pinctrl",
598 .owner = THIS_MODULE,
599};
600
601static struct pxa3xx_pinmux_info pxa168_info = {
602 .mfp = pxa168_mfp,
603 .num_mfp = ARRAY_SIZE(pxa168_mfp),
604 .grps = pxa168_grps,
605 .num_grps = ARRAY_SIZE(pxa168_grps),
606 .funcs = pxa168_funcs,
607 .num_funcs = ARRAY_SIZE(pxa168_funcs),
608 .num_gpio = 128,
609 .desc = &pxa168_pctrl_desc,
610 .pads = pxa168_pads,
611 .num_pads = ARRAY_SIZE(pxa168_pads),
612
613 .cputype = PINCTRL_PXA168,
614 .ds_mask = PXA168_DS_MASK,
615 .ds_shift = PXA168_DS_SHIFT,
616};
617
618static int pxa168_pinmux_probe(struct platform_device *pdev)
619{
620 return pxa3xx_pinctrl_register(pdev, &pxa168_info);
621}
622
623static int pxa168_pinmux_remove(struct platform_device *pdev)
624{
625 return pxa3xx_pinctrl_unregister(pdev);
626}
627
628static struct platform_driver pxa168_pinmux_driver = {
629 .driver = {
630 .name = "pxa168-pinmux",
631 .owner = THIS_MODULE,
632 },
633 .probe = pxa168_pinmux_probe,
634 .remove = pxa168_pinmux_remove,
635};
636
637static int __init pxa168_pinmux_init(void)
638{
639 return platform_driver_register(&pxa168_pinmux_driver);
640}
641core_initcall_sync(pxa168_pinmux_init);
642
643static void __exit pxa168_pinmux_exit(void)
644{
645 platform_driver_unregister(&pxa168_pinmux_driver);
646}
647module_exit(pxa168_pinmux_exit);
648
649MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
650MODULE_DESCRIPTION("PXA3xx pin control driver");
651MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c
deleted file mode 100644
index 1f49bb02a6af..000000000000
--- a/drivers/pinctrl/pinctrl-pxa3xx.c
+++ /dev/null
@@ -1,227 +0,0 @@
1/*
2 * linux/drivers/pinctrl/pinctrl-pxa3xx.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#include <linux/err.h>
15#include <linux/module.h>
16#include <linux/device.h>
17#include <linux/io.h>
18#include <linux/platform_device.h>
19#include <linux/slab.h>
20#include "pinctrl-pxa3xx.h"
21
22static struct pinctrl_gpio_range pxa3xx_pinctrl_gpio_range = {
23 .name = "PXA3xx GPIO",
24 .id = 0,
25 .base = 0,
26 .pin_base = 0,
27};
28
29static int pxa3xx_get_groups_count(struct pinctrl_dev *pctrldev)
30{
31 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
32
33 return info->num_grps;
34}
35
36static const char *pxa3xx_get_group_name(struct pinctrl_dev *pctrldev,
37 unsigned selector)
38{
39 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
40
41 return info->grps[selector].name;
42}
43
44static int pxa3xx_get_group_pins(struct pinctrl_dev *pctrldev,
45 unsigned selector,
46 const unsigned **pins,
47 unsigned *num_pins)
48{
49 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
50
51 *pins = info->grps[selector].pins;
52 *num_pins = info->grps[selector].npins;
53 return 0;
54}
55
56static struct pinctrl_ops pxa3xx_pctrl_ops = {
57 .get_groups_count = pxa3xx_get_groups_count,
58 .get_group_name = pxa3xx_get_group_name,
59 .get_group_pins = pxa3xx_get_group_pins,
60};
61
62static int pxa3xx_pmx_get_funcs_count(struct pinctrl_dev *pctrldev)
63{
64 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
65
66 return info->num_funcs;
67}
68
69static const char *pxa3xx_pmx_get_func_name(struct pinctrl_dev *pctrldev,
70 unsigned func)
71{
72 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
73 return info->funcs[func].name;
74}
75
76static int pxa3xx_pmx_get_groups(struct pinctrl_dev *pctrldev, unsigned func,
77 const char * const **groups,
78 unsigned * const num_groups)
79{
80 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
81 *groups = info->funcs[func].groups;
82 *num_groups = info->funcs[func].num_groups;
83 return 0;
84}
85
86/* Return function number. If failure, return negative value. */
87static int match_mux(struct pxa3xx_mfp_pin *mfp, unsigned mux)
88{
89 int i;
90 for (i = 0; i < PXA3xx_MAX_MUX; i++) {
91 if (mfp->func[i] == mux)
92 break;
93 }
94 if (i >= PXA3xx_MAX_MUX)
95 return -EINVAL;
96 return i;
97}
98
99/* check whether current pin configuration is valid. Negative for failure */
100static int match_group_mux(struct pxa3xx_pin_group *grp,
101 struct pxa3xx_pinmux_info *info,
102 unsigned mux)
103{
104 int i, pin, ret = 0;
105 for (i = 0; i < grp->npins; i++) {
106 pin = grp->pins[i];
107 ret = match_mux(&info->mfp[pin], mux);
108 if (ret < 0) {
109 dev_err(info->dev, "Can't find mux %d on pin%d\n",
110 mux, pin);
111 break;
112 }
113 }
114 return ret;
115}
116
117static int pxa3xx_pmx_enable(struct pinctrl_dev *pctrldev, unsigned func,
118 unsigned group)
119{
120 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
121 struct pxa3xx_pin_group *pin_grp = &info->grps[group];
122 unsigned int data;
123 int i, mfpr, pin, pin_func;
124
125 if (!pin_grp->npins ||
126 (match_group_mux(pin_grp, info, pin_grp->mux) < 0)) {
127 dev_err(info->dev, "Failed to set the pin group: %d\n", group);
128 return -EINVAL;
129 }
130 for (i = 0; i < pin_grp->npins; i++) {
131 pin = pin_grp->pins[i];
132 pin_func = match_mux(&info->mfp[pin], pin_grp->mux);
133 mfpr = info->mfp[pin].mfpr;
134 data = readl_relaxed(info->virt_base + mfpr);
135 data &= ~MFPR_FUNC_MASK;
136 data |= pin_func;
137 writel_relaxed(data, info->virt_base + mfpr);
138 }
139 return 0;
140}
141
142static int pxa3xx_pmx_request_gpio(struct pinctrl_dev *pctrldev,
143 struct pinctrl_gpio_range *range,
144 unsigned pin)
145{
146 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
147 unsigned int data;
148 int pin_func, mfpr;
149
150 pin_func = match_mux(&info->mfp[pin], PXA3xx_MUX_GPIO);
151 if (pin_func < 0) {
152 dev_err(info->dev, "No GPIO function on pin%d (%s)\n",
153 pin, info->pads[pin].name);
154 return -EINVAL;
155 }
156 mfpr = info->mfp[pin].mfpr;
157 /* write gpio function into mfpr register */
158 data = readl_relaxed(info->virt_base + mfpr) & ~MFPR_FUNC_MASK;
159 data |= pin_func;
160 writel_relaxed(data, info->virt_base + mfpr);
161 return 0;
162}
163
164static struct pinmux_ops pxa3xx_pmx_ops = {
165 .get_functions_count = pxa3xx_pmx_get_funcs_count,
166 .get_function_name = pxa3xx_pmx_get_func_name,
167 .get_function_groups = pxa3xx_pmx_get_groups,
168 .enable = pxa3xx_pmx_enable,
169 .gpio_request_enable = pxa3xx_pmx_request_gpio,
170};
171
172int pxa3xx_pinctrl_register(struct platform_device *pdev,
173 struct pxa3xx_pinmux_info *info)
174{
175 struct pinctrl_desc *desc;
176 struct resource *res;
177
178 if (!info || !info->cputype)
179 return -EINVAL;
180 desc = info->desc;
181 desc->pins = info->pads;
182 desc->npins = info->num_pads;
183 desc->pctlops = &pxa3xx_pctrl_ops;
184 desc->pmxops = &pxa3xx_pmx_ops;
185 info->dev = &pdev->dev;
186 pxa3xx_pinctrl_gpio_range.npins = info->num_gpio;
187
188 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
189 if (!res)
190 return -ENOENT;
191 info->virt_base = devm_ioremap_resource(&pdev->dev, res);
192 if (IS_ERR(info->virt_base))
193 return PTR_ERR(info->virt_base);
194 info->pctrl = pinctrl_register(desc, &pdev->dev, info);
195 if (!info->pctrl) {
196 dev_err(&pdev->dev, "failed to register PXA pinmux driver\n");
197 return -EINVAL;
198 }
199 pinctrl_add_gpio_range(info->pctrl, &pxa3xx_pinctrl_gpio_range);
200 platform_set_drvdata(pdev, info);
201 return 0;
202}
203
204int pxa3xx_pinctrl_unregister(struct platform_device *pdev)
205{
206 struct pxa3xx_pinmux_info *info = platform_get_drvdata(pdev);
207
208 pinctrl_unregister(info->pctrl);
209 platform_set_drvdata(pdev, NULL);
210 return 0;
211}
212
213static int __init pxa3xx_pinctrl_init(void)
214{
215 pr_info("pxa3xx-pinctrl: PXA3xx pinctrl driver initializing\n");
216 return 0;
217}
218core_initcall_sync(pxa3xx_pinctrl_init);
219
220static void __exit pxa3xx_pinctrl_exit(void)
221{
222}
223module_exit(pxa3xx_pinctrl_exit);
224
225MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
226MODULE_DESCRIPTION("PXA3xx pin control driver");
227MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.h b/drivers/pinctrl/pinctrl-pxa3xx.h
deleted file mode 100644
index 92fad0880834..000000000000
--- a/drivers/pinctrl/pinctrl-pxa3xx.h
+++ /dev/null
@@ -1,262 +0,0 @@
1/*
2 * linux/drivers/pinctrl/pinctrl-pxa3xx.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#ifndef __PINCTRL_PXA3XX_H
15
16#include <linux/pinctrl/pinctrl.h>
17#include <linux/pinctrl/pinmux.h>
18
19#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
20
21#define PXA3xx_MUX_GPIO 0
22
23#define PXA3xx_MAX_MUX 8
24#define MFPR_FUNC_MASK 0x7
25
26enum pxa_cpu_type {
27 PINCTRL_INVALID = 0,
28 PINCTRL_PXA300,
29 PINCTRL_PXA310,
30 PINCTRL_PXA320,
31 PINCTRL_PXA168,
32 PINCTRL_PXA910,
33 PINCTRL_PXA930,
34 PINCTRL_PXA955,
35 PINCTRL_MMP2,
36 PINCTRL_MAX,
37};
38
39struct pxa3xx_mfp_pin {
40 const char *name;
41 const unsigned int pin;
42 const unsigned int mfpr; /* register offset */
43 const unsigned short func[8];
44};
45
46struct pxa3xx_pin_group {
47 const char *name;
48 const unsigned mux;
49 const unsigned *pins;
50 const unsigned npins;
51};
52
53struct pxa3xx_pmx_func {
54 const char *name;
55 const char * const * groups;
56 const unsigned num_groups;
57};
58
59struct pxa3xx_pinmux_info {
60 struct device *dev;
61 struct pinctrl_dev *pctrl;
62 enum pxa_cpu_type cputype;
63 void __iomem *virt_base;
64
65 struct pxa3xx_mfp_pin *mfp;
66 unsigned int num_mfp;
67 struct pxa3xx_pin_group *grps;
68 unsigned int num_grps;
69 struct pxa3xx_pmx_func *funcs;
70 unsigned int num_funcs;
71 unsigned int num_gpio;
72 struct pinctrl_desc *desc;
73 struct pinctrl_pin_desc *pads;
74 unsigned int num_pads;
75
76 unsigned ds_mask; /* drive strength mask */
77 unsigned ds_shift; /* drive strength shift */
78 unsigned slp_mask; /* sleep mask */
79 unsigned slp_input_low;
80 unsigned slp_input_high;
81 unsigned slp_output_low;
82 unsigned slp_output_high;
83 unsigned slp_float;
84};
85
86enum pxa3xx_pin_list {
87 GPIO0 = 0,
88 GPIO1,
89 GPIO2,
90 GPIO3,
91 GPIO4,
92 GPIO5,
93 GPIO6,
94 GPIO7,
95 GPIO8,
96 GPIO9,
97 GPIO10, /* 10 */
98 GPIO11,
99 GPIO12,
100 GPIO13,
101 GPIO14,
102 GPIO15,
103 GPIO16,
104 GPIO17,
105 GPIO18,
106 GPIO19,
107 GPIO20, /* 20 */
108 GPIO21,
109 GPIO22,
110 GPIO23,
111 GPIO24,
112 GPIO25,
113 GPIO26,
114 GPIO27,
115 GPIO28,
116 GPIO29,
117 GPIO30, /* 30 */
118 GPIO31,
119 GPIO32,
120 GPIO33,
121 GPIO34,
122 GPIO35,
123 GPIO36,
124 GPIO37,
125 GPIO38,
126 GPIO39,
127 GPIO40, /* 40 */
128 GPIO41,
129 GPIO42,
130 GPIO43,
131 GPIO44,
132 GPIO45,
133 GPIO46,
134 GPIO47,
135 GPIO48,
136 GPIO49,
137 GPIO50, /* 50 */
138 GPIO51,
139 GPIO52,
140 GPIO53,
141 GPIO54,
142 GPIO55,
143 GPIO56,
144 GPIO57,
145 GPIO58,
146 GPIO59,
147 GPIO60, /* 60 */
148 GPIO61,
149 GPIO62,
150 GPIO63,
151 GPIO64,
152 GPIO65,
153 GPIO66,
154 GPIO67,
155 GPIO68,
156 GPIO69,
157 GPIO70, /* 70 */
158 GPIO71,
159 GPIO72,
160 GPIO73,
161 GPIO74,
162 GPIO75,
163 GPIO76,
164 GPIO77,
165 GPIO78,
166 GPIO79,
167 GPIO80, /* 80 */
168 GPIO81,
169 GPIO82,
170 GPIO83,
171 GPIO84,
172 GPIO85,
173 GPIO86,
174 GPIO87,
175 GPIO88,
176 GPIO89,
177 GPIO90, /* 90 */
178 GPIO91,
179 GPIO92,
180 GPIO93,
181 GPIO94,
182 GPIO95,
183 GPIO96,
184 GPIO97,
185 GPIO98,
186 GPIO99,
187 GPIO100, /* 100 */
188 GPIO101,
189 GPIO102,
190 GPIO103,
191 GPIO104,
192 GPIO105,
193 GPIO106,
194 GPIO107,
195 GPIO108,
196 GPIO109,
197 GPIO110, /* 110 */
198 GPIO111,
199 GPIO112,
200 GPIO113,
201 GPIO114,
202 GPIO115,
203 GPIO116,
204 GPIO117,
205 GPIO118,
206 GPIO119,
207 GPIO120, /* 120 */
208 GPIO121,
209 GPIO122,
210 GPIO123,
211 GPIO124,
212 GPIO125,
213 GPIO126,
214 GPIO127,
215 GPIO128,
216 GPIO129,
217 GPIO130, /* 130 */
218 GPIO131,
219 GPIO132,
220 GPIO133,
221 GPIO134,
222 GPIO135,
223 GPIO136,
224 GPIO137,
225 GPIO138,
226 GPIO139,
227 GPIO140, /* 140 */
228 GPIO141,
229 GPIO142,
230 GPIO143,
231 GPIO144,
232 GPIO145,
233 GPIO146,
234 GPIO147,
235 GPIO148,
236 GPIO149,
237 GPIO150, /* 150 */
238 GPIO151,
239 GPIO152,
240 GPIO153,
241 GPIO154,
242 GPIO155,
243 GPIO156,
244 GPIO157,
245 GPIO158,
246 GPIO159,
247 GPIO160, /* 160 */
248 GPIO161,
249 GPIO162,
250 GPIO163,
251 GPIO164,
252 GPIO165,
253 GPIO166,
254 GPIO167,
255 GPIO168,
256 GPIO169,
257};
258
259extern int pxa3xx_pinctrl_register(struct platform_device *pdev,
260 struct pxa3xx_pinmux_info *info);
261extern int pxa3xx_pinctrl_unregister(struct platform_device *pdev);
262#endif /* __PINCTRL_PXA3XX_H */
diff --git a/drivers/pinctrl/pinctrl-pxa910.c b/drivers/pinctrl/pinctrl-pxa910.c
deleted file mode 100644
index a2f917b847fb..000000000000
--- a/drivers/pinctrl/pinctrl-pxa910.c
+++ /dev/null
@@ -1,1007 +0,0 @@
1/*
2 * linux/drivers/pinctrl/pinmux-pxa910.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#include <linux/device.h>
15#include <linux/module.h>
16#include <linux/io.h>
17#include <linux/platform_device.h>
18#include "pinctrl-pxa3xx.h"
19
20#define PXA910_DS_MASK 0x1800
21#define PXA910_DS_SHIFT 11
22#define PXA910_SLEEP_MASK 0x38
23#define PXA910_SLEEP_SELECT (1 << 9)
24#define PXA910_SLEEP_DATA (1 << 8)
25#define PXA910_SLEEP_DIR (1 << 7)
26
27#define MFPR_910(a, r, f0, f1, f2, f3, f4, f5, f6, f7) \
28 { \
29 .name = #a, \
30 .pin = a, \
31 .mfpr = r, \
32 .func = { \
33 PXA910_MUX_##f0, \
34 PXA910_MUX_##f1, \
35 PXA910_MUX_##f2, \
36 PXA910_MUX_##f3, \
37 PXA910_MUX_##f4, \
38 PXA910_MUX_##f5, \
39 PXA910_MUX_##f6, \
40 PXA910_MUX_##f7, \
41 }, \
42 }
43
44#define GRP_910(a, m, p) \
45 { .name = a, .mux = PXA910_MUX_##m, .pins = p, .npins = ARRAY_SIZE(p), }
46
47/* 170 pins */
48enum pxa910_pin_list {
49 /* 0~127: GPIO0~GPIO127 */
50 ND_IO15 = 128,
51 ND_IO14,
52 ND_IO13, /* 130 */
53 ND_IO12,
54 ND_IO11,
55 ND_IO10,
56 ND_IO9,
57 ND_IO8,
58 ND_IO7,
59 ND_IO6,
60 ND_IO5,
61 ND_IO4,
62 ND_IO3, /* 140 */
63 ND_IO2,
64 ND_IO1,
65 ND_IO0,
66 ND_NCS0,
67 ND_NCS1,
68 SM_NCS0,
69 SM_NCS1,
70 ND_NWE,
71 ND_NRE,
72 ND_CLE, /* 150 */
73 ND_ALE,
74 SM_SCLK,
75 ND_RDY0,
76 SM_ADV,
77 ND_RDY1,
78 SM_ADVMUX,
79 SM_RDY,
80 MMC1_DAT7,
81 MMC1_DAT6,
82 MMC1_DAT5, /* 160 */
83 MMC1_DAT4,
84 MMC1_DAT3,
85 MMC1_DAT2,
86 MMC1_DAT1,
87 MMC1_DAT0,
88 MMC1_CMD,
89 MMC1_CLK,
90 MMC1_CD,
91 VCXO_OUT,
92};
93
94enum pxa910_mux {
95 /* PXA3xx_MUX_GPIO = 0 (predefined in pinctrl-pxa3xx.h) */
96 PXA910_MUX_GPIO = 0,
97 PXA910_MUX_NAND,
98 PXA910_MUX_USIM2,
99 PXA910_MUX_EXT_DMA,
100 PXA910_MUX_EXT_INT,
101 PXA910_MUX_MMC1,
102 PXA910_MUX_MMC2,
103 PXA910_MUX_MMC3,
104 PXA910_MUX_SM_INT,
105 PXA910_MUX_PRI_JTAG,
106 PXA910_MUX_SEC1_JTAG,
107 PXA910_MUX_SEC2_JTAG,
108 PXA910_MUX_RESET, /* SLAVE RESET OUT */
109 PXA910_MUX_CLK_REQ,
110 PXA910_MUX_VCXO_REQ,
111 PXA910_MUX_VCXO_OUT,
112 PXA910_MUX_VCXO_REQ2,
113 PXA910_MUX_VCXO_OUT2,
114 PXA910_MUX_SPI,
115 PXA910_MUX_SPI2,
116 PXA910_MUX_GSSP,
117 PXA910_MUX_SSP0,
118 PXA910_MUX_SSP1,
119 PXA910_MUX_SSP2,
120 PXA910_MUX_DSSP2,
121 PXA910_MUX_DSSP3,
122 PXA910_MUX_UART0,
123 PXA910_MUX_UART1,
124 PXA910_MUX_UART2,
125 PXA910_MUX_TWSI,
126 PXA910_MUX_CCIC,
127 PXA910_MUX_PWM0,
128 PXA910_MUX_PWM1,
129 PXA910_MUX_PWM2,
130 PXA910_MUX_PWM3,
131 PXA910_MUX_HSL,
132 PXA910_MUX_ONE_WIRE,
133 PXA910_MUX_LCD,
134 PXA910_MUX_DAC_ST23,
135 PXA910_MUX_ULPI,
136 PXA910_MUX_TB,
137 PXA910_MUX_KP_MK,
138 PXA910_MUX_KP_DK,
139 PXA910_MUX_TCU_GPOA,
140 PXA910_MUX_TCU_GPOB,
141 PXA910_MUX_ROT,
142 PXA910_MUX_TDS,
143 PXA910_MUX_32K_CLK, /* 32KHz CLK OUT */
144 PXA910_MUX_MN_CLK, /* MN CLK OUT */
145 PXA910_MUX_SMC,
146 PXA910_MUX_SM_ADDR18,
147 PXA910_MUX_SM_ADDR19,
148 PXA910_MUX_SM_ADDR20,
149 PXA910_MUX_NONE = 0xffff,
150};
151
152
153static struct pinctrl_pin_desc pxa910_pads[] = {
154 PINCTRL_PIN(GPIO0, "GPIO0"),
155 PINCTRL_PIN(GPIO1, "GPIO1"),
156 PINCTRL_PIN(GPIO2, "GPIO2"),
157 PINCTRL_PIN(GPIO3, "GPIO3"),
158 PINCTRL_PIN(GPIO4, "GPIO4"),
159 PINCTRL_PIN(GPIO5, "GPIO5"),
160 PINCTRL_PIN(GPIO6, "GPIO6"),
161 PINCTRL_PIN(GPIO7, "GPIO7"),
162 PINCTRL_PIN(GPIO8, "GPIO8"),
163 PINCTRL_PIN(GPIO9, "GPIO9"),
164 PINCTRL_PIN(GPIO10, "GPIO10"),
165 PINCTRL_PIN(GPIO11, "GPIO11"),
166 PINCTRL_PIN(GPIO12, "GPIO12"),
167 PINCTRL_PIN(GPIO13, "GPIO13"),
168 PINCTRL_PIN(GPIO14, "GPIO14"),
169 PINCTRL_PIN(GPIO15, "GPIO15"),
170 PINCTRL_PIN(GPIO16, "GPIO16"),
171 PINCTRL_PIN(GPIO17, "GPIO17"),
172 PINCTRL_PIN(GPIO18, "GPIO18"),
173 PINCTRL_PIN(GPIO19, "GPIO19"),
174 PINCTRL_PIN(GPIO20, "GPIO20"),
175 PINCTRL_PIN(GPIO21, "GPIO21"),
176 PINCTRL_PIN(GPIO22, "GPIO22"),
177 PINCTRL_PIN(GPIO23, "GPIO23"),
178 PINCTRL_PIN(GPIO24, "GPIO24"),
179 PINCTRL_PIN(GPIO25, "GPIO25"),
180 PINCTRL_PIN(GPIO26, "GPIO26"),
181 PINCTRL_PIN(GPIO27, "GPIO27"),
182 PINCTRL_PIN(GPIO28, "GPIO28"),
183 PINCTRL_PIN(GPIO29, "GPIO29"),
184 PINCTRL_PIN(GPIO30, "GPIO30"),
185 PINCTRL_PIN(GPIO31, "GPIO31"),
186 PINCTRL_PIN(GPIO32, "GPIO32"),
187 PINCTRL_PIN(GPIO33, "GPIO33"),
188 PINCTRL_PIN(GPIO34, "GPIO34"),
189 PINCTRL_PIN(GPIO35, "GPIO35"),
190 PINCTRL_PIN(GPIO36, "GPIO36"),
191 PINCTRL_PIN(GPIO37, "GPIO37"),
192 PINCTRL_PIN(GPIO38, "GPIO38"),
193 PINCTRL_PIN(GPIO39, "GPIO39"),
194 PINCTRL_PIN(GPIO40, "GPIO40"),
195 PINCTRL_PIN(GPIO41, "GPIO41"),
196 PINCTRL_PIN(GPIO42, "GPIO42"),
197 PINCTRL_PIN(GPIO43, "GPIO43"),
198 PINCTRL_PIN(GPIO44, "GPIO44"),
199 PINCTRL_PIN(GPIO45, "GPIO45"),
200 PINCTRL_PIN(GPIO46, "GPIO46"),
201 PINCTRL_PIN(GPIO47, "GPIO47"),
202 PINCTRL_PIN(GPIO48, "GPIO48"),
203 PINCTRL_PIN(GPIO49, "GPIO49"),
204 PINCTRL_PIN(GPIO50, "GPIO50"),
205 PINCTRL_PIN(GPIO51, "GPIO51"),
206 PINCTRL_PIN(GPIO52, "GPIO52"),
207 PINCTRL_PIN(GPIO53, "GPIO53"),
208 PINCTRL_PIN(GPIO54, "GPIO54"),
209 PINCTRL_PIN(GPIO55, "GPIO55"),
210 PINCTRL_PIN(GPIO56, "GPIO56"),
211 PINCTRL_PIN(GPIO57, "GPIO57"),
212 PINCTRL_PIN(GPIO58, "GPIO58"),
213 PINCTRL_PIN(GPIO59, "GPIO59"),
214 PINCTRL_PIN(GPIO60, "GPIO60"),
215 PINCTRL_PIN(GPIO61, "GPIO61"),
216 PINCTRL_PIN(GPIO62, "GPIO62"),
217 PINCTRL_PIN(GPIO63, "GPIO63"),
218 PINCTRL_PIN(GPIO64, "GPIO64"),
219 PINCTRL_PIN(GPIO65, "GPIO65"),
220 PINCTRL_PIN(GPIO66, "GPIO66"),
221 PINCTRL_PIN(GPIO67, "GPIO67"),
222 PINCTRL_PIN(GPIO68, "GPIO68"),
223 PINCTRL_PIN(GPIO69, "GPIO69"),
224 PINCTRL_PIN(GPIO70, "GPIO70"),
225 PINCTRL_PIN(GPIO71, "GPIO71"),
226 PINCTRL_PIN(GPIO72, "GPIO72"),
227 PINCTRL_PIN(GPIO73, "GPIO73"),
228 PINCTRL_PIN(GPIO74, "GPIO74"),
229 PINCTRL_PIN(GPIO75, "GPIO75"),
230 PINCTRL_PIN(GPIO76, "GPIO76"),
231 PINCTRL_PIN(GPIO77, "GPIO77"),
232 PINCTRL_PIN(GPIO78, "GPIO78"),
233 PINCTRL_PIN(GPIO79, "GPIO79"),
234 PINCTRL_PIN(GPIO80, "GPIO80"),
235 PINCTRL_PIN(GPIO81, "GPIO81"),
236 PINCTRL_PIN(GPIO82, "GPIO82"),
237 PINCTRL_PIN(GPIO83, "GPIO83"),
238 PINCTRL_PIN(GPIO84, "GPIO84"),
239 PINCTRL_PIN(GPIO85, "GPIO85"),
240 PINCTRL_PIN(GPIO86, "GPIO86"),
241 PINCTRL_PIN(GPIO87, "GPIO87"),
242 PINCTRL_PIN(GPIO88, "GPIO88"),
243 PINCTRL_PIN(GPIO89, "GPIO89"),
244 PINCTRL_PIN(GPIO90, "GPIO90"),
245 PINCTRL_PIN(GPIO91, "GPIO91"),
246 PINCTRL_PIN(GPIO92, "GPIO92"),
247 PINCTRL_PIN(GPIO93, "GPIO93"),
248 PINCTRL_PIN(GPIO94, "GPIO94"),
249 PINCTRL_PIN(GPIO95, "GPIO95"),
250 PINCTRL_PIN(GPIO96, "GPIO96"),
251 PINCTRL_PIN(GPIO97, "GPIO97"),
252 PINCTRL_PIN(GPIO98, "GPIO98"),
253 PINCTRL_PIN(GPIO99, "GPIO99"),
254 PINCTRL_PIN(GPIO100, "GPIO100"),
255 PINCTRL_PIN(GPIO101, "GPIO101"),
256 PINCTRL_PIN(GPIO102, "GPIO102"),
257 PINCTRL_PIN(GPIO103, "GPIO103"),
258 PINCTRL_PIN(GPIO104, "GPIO104"),
259 PINCTRL_PIN(GPIO105, "GPIO105"),
260 PINCTRL_PIN(GPIO106, "GPIO106"),
261 PINCTRL_PIN(GPIO107, "GPIO107"),
262 PINCTRL_PIN(GPIO108, "GPIO108"),
263 PINCTRL_PIN(GPIO109, "GPIO109"),
264 PINCTRL_PIN(GPIO110, "GPIO110"),
265 PINCTRL_PIN(GPIO111, "GPIO111"),
266 PINCTRL_PIN(GPIO112, "GPIO112"),
267 PINCTRL_PIN(GPIO113, "GPIO113"),
268 PINCTRL_PIN(GPIO114, "GPIO114"),
269 PINCTRL_PIN(GPIO115, "GPIO115"),
270 PINCTRL_PIN(GPIO116, "GPIO116"),
271 PINCTRL_PIN(GPIO117, "GPIO117"),
272 PINCTRL_PIN(GPIO118, "GPIO118"),
273 PINCTRL_PIN(GPIO119, "GPIO119"),
274 PINCTRL_PIN(GPIO120, "GPIO120"),
275 PINCTRL_PIN(GPIO121, "GPIO121"),
276 PINCTRL_PIN(GPIO122, "GPIO122"),
277 PINCTRL_PIN(GPIO123, "GPIO123"),
278 PINCTRL_PIN(GPIO124, "GPIO124"),
279 PINCTRL_PIN(GPIO125, "GPIO125"),
280 PINCTRL_PIN(GPIO126, "GPIO126"),
281 PINCTRL_PIN(GPIO127, "GPIO127"),
282 PINCTRL_PIN(ND_IO15, "ND_IO15"),
283 PINCTRL_PIN(ND_IO14, "ND_IO14"),
284 PINCTRL_PIN(ND_IO13, "ND_IO13"),
285 PINCTRL_PIN(ND_IO12, "ND_IO12"),
286 PINCTRL_PIN(ND_IO11, "ND_IO11"),
287 PINCTRL_PIN(ND_IO10, "ND_IO10"),
288 PINCTRL_PIN(ND_IO9, "ND_IO9"),
289 PINCTRL_PIN(ND_IO8, "ND_IO8"),
290 PINCTRL_PIN(ND_IO7, "ND_IO7"),
291 PINCTRL_PIN(ND_IO6, "ND_IO6"),
292 PINCTRL_PIN(ND_IO5, "ND_IO5"),
293 PINCTRL_PIN(ND_IO4, "ND_IO4"),
294 PINCTRL_PIN(ND_IO3, "ND_IO3"),
295 PINCTRL_PIN(ND_IO2, "ND_IO2"),
296 PINCTRL_PIN(ND_IO1, "ND_IO1"),
297 PINCTRL_PIN(ND_IO0, "ND_IO0"),
298 PINCTRL_PIN(ND_NCS0, "ND_NCS0_SM_NCS2"),
299 PINCTRL_PIN(ND_NCS1, "ND_NCS1_SM_NCS3"),
300 PINCTRL_PIN(SM_NCS0, "SM_NCS0"),
301 PINCTRL_PIN(SM_NCS1, "SM_NCS1"),
302 PINCTRL_PIN(ND_NWE, "ND_NWE"),
303 PINCTRL_PIN(ND_NRE, "ND_NRE"),
304 PINCTRL_PIN(ND_CLE, "ND_CLE_SM_NOE"),
305 PINCTRL_PIN(ND_ALE, "ND_ALE_SM_NWE"),
306 PINCTRL_PIN(SM_SCLK, "SM_SCLK"),
307 PINCTRL_PIN(ND_RDY0, "ND_RDY0"),
308 PINCTRL_PIN(SM_ADV, "SM_ADV"),
309 PINCTRL_PIN(ND_RDY1, "ND_RDY1"),
310 PINCTRL_PIN(SM_RDY, "SM_RDY"),
311 PINCTRL_PIN(MMC1_DAT7, "MMC1_DAT7"),
312 PINCTRL_PIN(MMC1_DAT6, "MMC1_DAT6"),
313 PINCTRL_PIN(MMC1_DAT5, "MMC1_DAT5"),
314 PINCTRL_PIN(MMC1_DAT4, "MMC1_DAT4"),
315 PINCTRL_PIN(MMC1_DAT3, "MMC1_DAT3"),
316 PINCTRL_PIN(MMC1_DAT2, "MMC1_DAT2"),
317 PINCTRL_PIN(MMC1_DAT1, "MMC1_DAT1"),
318 PINCTRL_PIN(MMC1_DAT0, "MMC1_DAT0"),
319 PINCTRL_PIN(MMC1_CMD, "MMC1 CMD"),
320 PINCTRL_PIN(MMC1_CLK, "MMC1 CLK"),
321 PINCTRL_PIN(MMC1_CD, "MMC1 CD"),
322 PINCTRL_PIN(VCXO_OUT, "VCXO_OUT"),
323};
324
325struct pxa3xx_mfp_pin pxa910_mfp[] = {
326 /* pin offs f0 f1 f2 f3 f4 f5 f6 f7 */
327 MFPR_910(GPIO0, 0x0DC, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
328 MFPR_910(GPIO1, 0x0E0, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
329 MFPR_910(GPIO2, 0x0E4, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
330 MFPR_910(GPIO3, 0x0E8, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
331 MFPR_910(GPIO4, 0x0EC, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
332 MFPR_910(GPIO5, 0x0F0, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
333 MFPR_910(GPIO6, 0x0F4, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
334 MFPR_910(GPIO7, 0x0F8, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
335 MFPR_910(GPIO8, 0x0FC, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
336 MFPR_910(GPIO9, 0x100, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
337 MFPR_910(GPIO10, 0x104, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
338 MFPR_910(GPIO11, 0x108, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
339 MFPR_910(GPIO12, 0x10C, GPIO, KP_MK, NONE, NONE, KP_DK, NONE, NONE, NONE),
340 MFPR_910(GPIO13, 0x110, GPIO, KP_MK, NONE, NONE, KP_DK, NONE, NONE, NONE),
341 MFPR_910(GPIO14, 0x114, GPIO, KP_MK, NONE, NONE, KP_DK, TB, NONE, NONE),
342 MFPR_910(GPIO15, 0x118, GPIO, KP_MK, NONE, NONE, KP_DK, TB, NONE, NONE),
343 MFPR_910(GPIO16, 0x11C, GPIO, KP_DK, NONE, NONE, NONE, TB, NONE, NONE),
344 MFPR_910(GPIO17, 0x120, GPIO, KP_DK, NONE, NONE, NONE, TB, NONE, NONE),
345 MFPR_910(GPIO18, 0x124, GPIO, KP_DK, NONE, NONE, ROT, NONE, NONE, NONE),
346 MFPR_910(GPIO19, 0x128, GPIO, KP_DK, NONE, NONE, ROT, NONE, NONE, NONE),
347 MFPR_910(GPIO20, 0x12C, GPIO, SSP1, NONE, NONE, VCXO_OUT, NONE, NONE, NONE),
348 MFPR_910(GPIO21, 0x130, GPIO, SSP1, NONE, NONE, NONE, NONE, NONE, NONE),
349 MFPR_910(GPIO22, 0x134, GPIO, SSP1, NONE, NONE, NONE, NONE, NONE, NONE),
350 MFPR_910(GPIO23, 0x138, GPIO, SSP1, NONE, NONE, NONE, NONE, NONE, NONE),
351 MFPR_910(GPIO24, 0x13C, GPIO, SSP1, NONE, NONE, NONE, NONE, NONE, NONE),
352 MFPR_910(GPIO25, 0x140, GPIO, GSSP, NONE, NONE, NONE, NONE, NONE, NONE),
353 MFPR_910(GPIO26, 0x144, GPIO, GSSP, NONE, NONE, NONE, NONE, NONE, NONE),
354 MFPR_910(GPIO27, 0x148, GPIO, GSSP, NONE, NONE, NONE, NONE, NONE, NONE),
355 MFPR_910(GPIO28, 0x14C, GPIO, GSSP, NONE, NONE, NONE, NONE, NONE, NONE),
356 MFPR_910(GPIO29, 0x150, GPIO, UART0, NONE, NONE, UART1, NONE, NONE, NONE),
357 MFPR_910(GPIO30, 0x154, GPIO, UART0, NONE, NONE, UART1, NONE, NONE, NONE),
358 MFPR_910(GPIO31, 0x158, GPIO, UART0, NONE, NONE, UART1, NONE, NONE, NONE),
359 MFPR_910(GPIO32, 0x15C, GPIO, UART0, DAC_ST23, NONE, UART1, NONE, NONE, NONE),
360 MFPR_910(GPIO33, 0x160, GPIO, MMC2, SSP0, SSP2, NONE, SPI, NONE, MMC3),
361 MFPR_910(GPIO34, 0x164, GPIO, MMC2, SSP0, SSP2, NONE, SPI, NONE, MMC3),
362 MFPR_910(GPIO35, 0x168, GPIO, MMC2, SSP0, SSP2, NONE, SPI, NONE, MMC3),
363 MFPR_910(GPIO36, 0x16C, GPIO, MMC2, SSP0, SSP2, NONE, SPI, NONE, MMC3),
364 MFPR_910(GPIO37, 0x170, GPIO, MMC2, NONE, NONE, NONE, SPI, HSL, NONE),
365 MFPR_910(GPIO38, 0x174, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
366 MFPR_910(GPIO39, 0x178, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
367 MFPR_910(GPIO40, 0x17C, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
368 MFPR_910(GPIO41, 0x180, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
369 MFPR_910(GPIO42, 0x184, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
370 MFPR_910(GPIO43, 0x188, GPIO, UART1, NONE, DAC_ST23, NONE, DSSP2, SPI, UART2),
371 MFPR_910(GPIO44, 0x18C, GPIO, UART1, NONE, EXT_INT, NONE, DSSP2, SPI, UART2),
372 MFPR_910(GPIO45, 0x190, GPIO, UART1, NONE, EXT_INT, NONE, DSSP2, SPI, UART2),
373 MFPR_910(GPIO46, 0x194, GPIO, UART1, NONE, EXT_INT, NONE, DSSP2, SPI, UART2),
374 MFPR_910(GPIO47, 0x198, GPIO, SSP0, NONE, NONE, NONE, SSP2, UART1, NONE),
375 MFPR_910(GPIO48, 0x19C, GPIO, SSP0, NONE, NONE, NONE, SSP2, UART1, NONE),
376 MFPR_910(GPIO49, 0x1A0, GPIO, SSP0, UART0, VCXO_REQ, NONE, SSP2, NONE, MMC3),
377 MFPR_910(GPIO50, 0x1A4, GPIO, SSP0, UART0, VCXO_OUT, NONE, SSP2, NONE, MMC3),
378 MFPR_910(GPIO51, 0x1A8, GPIO, UART2, PWM1, TWSI, SSP0, NONE, DSSP3, NONE),
379 MFPR_910(GPIO52, 0x1AC, GPIO, UART2, DAC_ST23, TWSI, SSP0, NONE, DSSP3, NONE),
380 MFPR_910(GPIO53, 0x1B0, GPIO, UART2, TWSI, NONE, SSP0, NONE, DSSP3, NONE),
381 MFPR_910(GPIO54, 0x1B4, GPIO, UART2, TWSI, SSP0, NONE, NONE, DSSP3, NONE),
382 MFPR_910(GPIO55, 0x2F0, TDS, GPIO, TB, NONE, NONE, NONE, NONE, NONE),
383 MFPR_910(GPIO56, 0x2F4, TDS, GPIO, TB, NONE, NONE, NONE, NONE, NONE),
384 MFPR_910(GPIO57, 0x2F8, TDS, GPIO, TB, NONE, NONE, NONE, NONE, NONE),
385 MFPR_910(GPIO58, 0x2FC, TDS, GPIO, TB, NONE, NONE, NONE, NONE, NONE),
386 MFPR_910(GPIO59, 0x300, TDS, GPIO, TCU_GPOA, TCU_GPOB, ONE_WIRE, NONE, NONE, NONE),
387 MFPR_910(GPIO60, 0x304, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, NONE),
388 MFPR_910(GPIO61, 0x308, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, HSL),
389 MFPR_910(GPIO62, 0x30C, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, HSL),
390 MFPR_910(GPIO63, 0x310, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, HSL),
391 MFPR_910(GPIO64, 0x314, GPIO, SPI2, NONE, NONE, NONE, NONE, NONE, HSL),
392 MFPR_910(GPIO65, 0x318, GPIO, SPI2, NONE, NONE, NONE, NONE, ONE_WIRE, HSL),
393 MFPR_910(GPIO66, 0x31C, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, HSL),
394 MFPR_910(GPIO67, 0x1B8, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, USIM2),
395 MFPR_910(GPIO68, 0x1BC, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, USIM2),
396 MFPR_910(GPIO69, 0x1C0, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, USIM2),
397 MFPR_910(GPIO70, 0x1C4, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, NONE),
398 MFPR_910(GPIO71, 0x1C8, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, NONE),
399 MFPR_910(GPIO72, 0x1CC, GPIO, CCIC, EXT_DMA, NONE, NONE, ULPI, NONE, NONE),
400 MFPR_910(GPIO73, 0x1D0, GPIO, CCIC, EXT_DMA, NONE, NONE, ULPI, NONE, NONE),
401 MFPR_910(GPIO74, 0x1D4, GPIO, CCIC, EXT_DMA, NONE, NONE, ULPI, NONE, NONE),
402 MFPR_910(GPIO75, 0x1D8, GPIO, CCIC, NONE, NONE, NONE, ULPI, NONE, NONE),
403 MFPR_910(GPIO76, 0x1DC, GPIO, CCIC, NONE, NONE, NONE, ULPI, NONE, NONE),
404 MFPR_910(GPIO77, 0x1E0, GPIO, CCIC, NONE, NONE, NONE, ULPI, NONE, NONE),
405 MFPR_910(GPIO78, 0x1E4, GPIO, CCIC, NONE, NONE, NONE, ULPI, NONE, NONE),
406 MFPR_910(GPIO79, 0x1E8, GPIO, TWSI, NONE, NONE, NONE, NONE, NONE, NONE),
407 MFPR_910(GPIO80, 0x1EC, GPIO, TWSI, NONE, NONE, NONE, NONE, NONE, NONE),
408 MFPR_910(GPIO81, 0x1F0, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
409 MFPR_910(GPIO82, 0x1F4, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
410 MFPR_910(GPIO83, 0x1F8, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
411 MFPR_910(GPIO84, 0x1FC, GPIO, LCD, VCXO_REQ2, NONE, NONE, NONE, NONE, NONE),
412 MFPR_910(GPIO85, 0x200, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
413 MFPR_910(GPIO86, 0x204, GPIO, LCD, VCXO_OUT2, NONE, NONE, NONE, NONE, NONE),
414 MFPR_910(GPIO87, 0x208, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
415 MFPR_910(GPIO88, 0x20C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
416 MFPR_910(GPIO89, 0x210, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
417 MFPR_910(GPIO90, 0x214, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
418 MFPR_910(GPIO91, 0x218, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
419 MFPR_910(GPIO92, 0x21C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
420 MFPR_910(GPIO93, 0x220, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
421 MFPR_910(GPIO94, 0x224, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
422 MFPR_910(GPIO95, 0x228, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
423 MFPR_910(GPIO96, 0x22C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
424 MFPR_910(GPIO97, 0x230, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
425 MFPR_910(GPIO98, 0x234, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
426 MFPR_910(GPIO99, 0x0B0, MMC1, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
427 MFPR_910(GPIO100, 0x238, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
428 MFPR_910(GPIO101, 0x23C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
429 MFPR_910(GPIO102, 0x240, GPIO, LCD, DSSP2, SPI, NONE, NONE, NONE, SPI2),
430 MFPR_910(GPIO103, 0x244, GPIO, LCD, DSSP2, SPI, NONE, NONE, NONE, SPI2),
431 MFPR_910(GPIO104, 0x248, GPIO, LCD, DSSP2, SPI, NONE, NONE, NONE, NONE),
432 MFPR_910(GPIO105, 0x24C, GPIO, LCD, DSSP2, SPI, NONE, NONE, NONE, NONE),
433 MFPR_910(GPIO106, 0x250, GPIO, LCD, DSSP3, ONE_WIRE, NONE, NONE, NONE, NONE),
434 MFPR_910(GPIO107, 0x254, GPIO, LCD, DSSP3, SPI, NONE, NONE, NONE, NONE),
435 MFPR_910(GPIO108, 0x258, GPIO, LCD, DSSP3, SPI, NONE, NONE, NONE, NONE),
436 MFPR_910(GPIO109, 0x25C, GPIO, LCD, DSSP3, SPI, NONE, NONE, NONE, NONE),
437 MFPR_910(GPIO110, 0x298, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, NONE),
438 MFPR_910(GPIO111, 0x29C, GPIO, NONE, DSSP2, NONE, NONE, NONE, NONE, NONE),
439 MFPR_910(GPIO112, 0x2A0, GPIO, NONE, DSSP2, NONE, NONE, NONE, NONE, NONE),
440 MFPR_910(GPIO113, 0x2A4, GPIO, NONE, DSSP2, NONE, NONE, NONE, NONE, NONE),
441 MFPR_910(GPIO114, 0x2A8, GPIO, NONE, DSSP3, NONE, NONE, NONE, NONE, NONE),
442 MFPR_910(GPIO115, 0x2AC, GPIO, NONE, DSSP3, NONE, NONE, NONE, NONE, NONE),
443 MFPR_910(GPIO116, 0x2B0, GPIO, NONE, DSSP3, NONE, NONE, NONE, NONE, NONE),
444 MFPR_910(GPIO117, 0x0B4, PRI_JTAG, GPIO, PWM0, NONE, NONE, NONE, NONE, NONE),
445 MFPR_910(GPIO118, 0x0B8, PRI_JTAG, GPIO, PWM1, NONE, NONE, NONE, NONE, NONE),
446 MFPR_910(GPIO119, 0x0BC, PRI_JTAG, GPIO, PWM2, NONE, NONE, NONE, NONE, NONE),
447 MFPR_910(GPIO120, 0x0C0, PRI_JTAG, GPIO, PWM3, NONE, NONE, NONE, NONE, NONE),
448 MFPR_910(GPIO121, 0x32C, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, NONE),
449 MFPR_910(GPIO122, 0x0C8, RESET, GPIO, 32K_CLK, NONE, NONE, NONE, NONE, NONE),
450 MFPR_910(GPIO123, 0x0CC, CLK_REQ, GPIO, ONE_WIRE, EXT_DMA, NONE, NONE, NONE, NONE),
451 MFPR_910(GPIO124, 0x0D0, GPIO, MN_CLK, DAC_ST23, NONE, NONE, NONE, NONE, NONE),
452 MFPR_910(GPIO125, 0x0D4, VCXO_REQ, GPIO, NONE, EXT_INT, NONE, NONE, NONE, NONE),
453 MFPR_910(GPIO126, 0x06C, GPIO, SMC, NONE, SM_ADDR18, NONE, EXT_DMA, NONE, NONE),
454 MFPR_910(GPIO127, 0x070, GPIO, SMC, NONE, NONE, NONE, NONE, NONE, NONE),
455 MFPR_910(ND_IO15, 0x004, NAND, GPIO, USIM2, EXT_DMA, NONE, NONE, NONE, NONE),
456 MFPR_910(ND_IO14, 0x008, NAND, GPIO, USIM2, NONE, NONE, NONE, NONE, NONE),
457 MFPR_910(ND_IO13, 0x00C, NAND, GPIO, USIM2, EXT_INT, NONE, NONE, NONE, NONE),
458 MFPR_910(ND_IO12, 0x010, NAND, GPIO, SSP2, EXT_INT, NONE, NONE, NONE, NONE),
459 MFPR_910(ND_IO11, 0x014, NAND, GPIO, SSP2, NONE, NONE, NONE, NONE, NONE),
460 MFPR_910(ND_IO10, 0x018, NAND, GPIO, SSP2, NONE, NONE, NONE, NONE, NONE),
461 MFPR_910(ND_IO9, 0x01C, NAND, GPIO, SSP2, NONE, VCXO_OUT2, NONE, NONE, NONE),
462 MFPR_910(ND_IO8, 0x020, NAND, GPIO, NONE, NONE, PWM3, NONE, NONE, NONE),
463 MFPR_910(ND_IO7, 0x024, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
464 MFPR_910(ND_IO6, 0x028, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
465 MFPR_910(ND_IO5, 0x02C, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
466 MFPR_910(ND_IO4, 0x030, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
467 MFPR_910(ND_IO3, 0x034, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
468 MFPR_910(ND_IO2, 0x038, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
469 MFPR_910(ND_IO1, 0x03C, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
470 MFPR_910(ND_IO0, 0x040, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
471 MFPR_910(ND_NCS0, 0x044, NAND, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
472 MFPR_910(ND_NCS1, 0x048, NAND, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
473 MFPR_910(SM_NCS0, 0x04C, SMC, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
474 MFPR_910(SM_NCS1, 0x050, SMC, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
475 MFPR_910(ND_NWE, 0x054, GPIO, NAND, NONE, SM_ADDR20, NONE, SMC, NONE, NONE),
476 MFPR_910(ND_NRE, 0x058, GPIO, NAND, NONE, SMC, NONE, EXT_DMA, NONE, NONE),
477 MFPR_910(ND_CLE, 0x05C, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
478 MFPR_910(ND_ALE, 0x060, GPIO, NAND, NONE, NONE, NONE, NONE, NONE, NONE),
479 MFPR_910(SM_SCLK, 0x064, MMC3, NONE, NONE, NONE, NONE, NONE, NONE, NONE),
480 MFPR_910(ND_RDY0, 0x068, NAND, GPIO, NONE, SMC, NONE, NONE, NONE, NONE),
481 MFPR_910(SM_ADV, 0x074, SMC, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
482 MFPR_910(ND_RDY1, 0x078, NAND, GPIO, NONE, SMC, NONE, NONE, NONE, NONE),
483 MFPR_910(SM_ADVMUX, 0x07C, SMC, GPIO, NONE, SM_ADDR19, NONE, NONE, NONE, NONE),
484 MFPR_910(SM_RDY, 0x080, SMC, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
485 MFPR_910(MMC1_DAT7, 0x084, MMC1, GPIO, SEC1_JTAG, TB, NONE, NONE, NONE, NONE),
486 MFPR_910(MMC1_DAT6, 0x088, MMC1, GPIO, SEC1_JTAG, TB, NONE, NONE, NONE, NONE),
487 MFPR_910(MMC1_DAT5, 0x08C, MMC1, GPIO, SEC1_JTAG, TB, NONE, NONE, NONE, NONE),
488 MFPR_910(MMC1_DAT4, 0x090, MMC1, GPIO, NONE, TB, NONE, NONE, NONE, NONE),
489 MFPR_910(MMC1_DAT3, 0x094, MMC1, HSL, SEC2_JTAG, SSP0, NONE, NONE, NONE, NONE),
490 MFPR_910(MMC1_DAT2, 0x098, MMC1, HSL, SEC2_JTAG, SSP2, SSP0, NONE, NONE, NONE),
491 MFPR_910(MMC1_DAT1, 0x09C, MMC1, HSL, SEC2_JTAG, SSP2, SSP0, NONE, NONE, NONE),
492 MFPR_910(MMC1_DAT0, 0x0A0, MMC1, HSL, SEC2_JTAG, SSP2, NONE, NONE, NONE, NONE),
493 MFPR_910(MMC1_CMD, 0x0A4, MMC1, HSL, SEC1_JTAG, SSP2, NONE, NONE, NONE, NONE),
494 MFPR_910(MMC1_CLK, 0x0A8, MMC1, HSL, SEC2_JTAG, SSP0, NONE, NONE, NONE, NONE),
495 MFPR_910(MMC1_CD, 0x0AC, MMC1, GPIO, SEC1_JTAG, NONE, NONE, NONE, NONE, NONE),
496 MFPR_910(VCXO_OUT, 0x0D8, VCXO_OUT, PWM3, NONE, NONE, NONE, NONE, NONE, NONE),
497};
498
499
500static const unsigned p910_usim2_pin1[] = {GPIO67, GPIO68, GPIO69};
501static const unsigned p910_usim2_pin2[] = {ND_IO15, ND_IO14, ND_IO13};
502static const unsigned p910_mmc1_pin1[] = {MMC1_DAT7, MMC1_DAT6, MMC1_DAT5,
503 MMC1_DAT4, MMC1_DAT3, MMC1_DAT2, MMC1_DAT1, MMC1_DAT0, MMC1_CMD,
504 MMC1_CLK, MMC1_CD, GPIO99};
505static const unsigned p910_mmc2_pin1[] = {GPIO33, GPIO34, GPIO35, GPIO36,
506 GPIO37, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42};
507static const unsigned p910_mmc3_pin1[] = {GPIO33, GPIO34, GPIO35, GPIO36,
508 GPIO49, GPIO50};
509static const unsigned p910_mmc3_pin2[] = {ND_IO7, ND_IO6, ND_IO5, ND_IO4,
510 ND_IO3, ND_IO2, ND_IO1, ND_IO0, ND_CLE, SM_SCLK};
511static const unsigned p910_uart0_pin1[] = {GPIO29, GPIO30, GPIO31, GPIO32};
512static const unsigned p910_uart1_pin1[] = {GPIO47, GPIO48};
513static const unsigned p910_uart1_pin2[] = {GPIO31, GPIO32};
514static const unsigned p910_uart1_pin3[] = {GPIO45, GPIO46};
515static const unsigned p910_uart1_pin4[] = {GPIO29, GPIO30, GPIO31, GPIO32};
516static const unsigned p910_uart1_pin5[] = {GPIO43, GPIO44, GPIO45, GPIO46};
517static const unsigned p910_uart2_pin1[] = {GPIO43, GPIO44};
518static const unsigned p910_uart2_pin2[] = {GPIO51, GPIO52};
519static const unsigned p910_uart2_pin3[] = {GPIO43, GPIO44, GPIO45, GPIO46};
520static const unsigned p910_uart2_pin4[] = {GPIO51, GPIO52, GPIO53, GPIO54};
521static const unsigned p910_twsi_pin1[] = {GPIO51, GPIO52};
522static const unsigned p910_twsi_pin2[] = {GPIO53, GPIO54};
523static const unsigned p910_twsi_pin3[] = {GPIO79, GPIO80};
524static const unsigned p910_ccic_pin1[] = {GPIO67, GPIO68, GPIO69, GPIO70,
525 GPIO71, GPIO72, GPIO73, GPIO74, GPIO75, GPIO76, GPIO77, GPIO78};
526static const unsigned p910_lcd_pin1[] = {GPIO81, GPIO82, GPIO83, GPIO84,
527 GPIO85, GPIO86, GPIO87, GPIO88, GPIO89, GPIO90, GPIO91, GPIO92,
528 GPIO93, GPIO94, GPIO95, GPIO96, GPIO97, GPIO98, GPIO100, GPIO101,
529 GPIO102, GPIO103};
530static const unsigned p910_spi_pin1[] = {GPIO104, GPIO105, GPIO107, GPIO108};
531static const unsigned p910_spi_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
532static const unsigned p910_spi_pin3[] = {GPIO33, GPIO34, GPIO35, GPIO36,
533 GPIO37};
534static const unsigned p910_spi_pin4[] = {GPIO67, GPIO68, GPIO69, GPIO70,
535 GPIO71};
536static const unsigned p910_spi2_pin1[] = {GPIO64, GPIO65};
537static const unsigned p910_spi2_pin2[] = {GPIO102, GPIO103};
538static const unsigned p910_dssp2_pin1[] = {GPIO102, GPIO103, GPIO104, GPIO105};
539static const unsigned p910_dssp2_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
540static const unsigned p910_dssp2_pin3[] = {GPIO111, GPIO112, GPIO113};
541static const unsigned p910_dssp3_pin1[] = {GPIO106, GPIO107, GPIO108, GPIO109};
542static const unsigned p910_dssp3_pin2[] = {GPIO51, GPIO52, GPIO53, GPIO54};
543static const unsigned p910_dssp3_pin3[] = {GPIO114, GPIO115, GPIO116};
544static const unsigned p910_ssp0_pin1[] = {MMC1_DAT3, MMC1_DAT2, MMC1_DAT1,
545 MMC1_CLK};
546static const unsigned p910_ssp0_pin2[] = {GPIO33, GPIO34, GPIO35, GPIO36};
547static const unsigned p910_ssp0_pin3[] = {GPIO47, GPIO48, GPIO49, GPIO50};
548static const unsigned p910_ssp0_pin4[] = {GPIO51, GPIO52, GPIO53, GPIO54};
549static const unsigned p910_ssp1_pin1[] = {GPIO21, GPIO22, GPIO23, GPIO24};
550static const unsigned p910_ssp1_pin2[] = {GPIO20, GPIO21, GPIO22, GPIO23,
551 GPIO24};
552static const unsigned p910_ssp2_pin1[] = {MMC1_DAT2, MMC1_DAT1, MMC1_DAT0,
553 MMC1_CMD};
554static const unsigned p910_ssp2_pin2[] = {GPIO33, GPIO34, GPIO35, GPIO36};
555static const unsigned p910_ssp2_pin3[] = {GPIO47, GPIO48, GPIO49, GPIO50};
556static const unsigned p910_ssp2_pin4[] = {ND_IO12, ND_IO11, ND_IO10, ND_IO9};
557static const unsigned p910_gssp_pin1[] = {GPIO25, GPIO26, GPIO27, GPIO28};
558static const unsigned p910_pwm0_pin1[] = {GPIO117};
559static const unsigned p910_pwm1_pin1[] = {GPIO118};
560static const unsigned p910_pwm1_pin2[] = {GPIO51};
561static const unsigned p910_pwm2_pin1[] = {GPIO119};
562static const unsigned p910_pwm3_pin1[] = {GPIO120};
563static const unsigned p910_pwm3_pin2[] = {ND_IO8};
564static const unsigned p910_pwm3_pin3[] = {VCXO_OUT};
565static const unsigned p910_pri_jtag_pin1[] = {GPIO117, GPIO118, GPIO119,
566 GPIO120};
567static const unsigned p910_sec1_jtag_pin1[] = {MMC1_DAT7, MMC1_DAT6, MMC1_DAT5,
568 MMC1_CMD, MMC1_CD};
569static const unsigned p910_sec2_jtag_pin1[] = {MMC1_DAT3, MMC1_DAT2, MMC1_DAT1,
570 MMC1_DAT0, MMC1_CLK};
571static const unsigned p910_hsl_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40,
572 GPIO41, GPIO42};
573static const unsigned p910_hsl_pin2[] = {GPIO61, GPIO62, GPIO63, GPIO64,
574 GPIO65, GPIO66};
575static const unsigned p910_hsl_pin3[] = {MMC1_DAT3, MMC1_DAT2, MMC1_DAT1,
576 MMC1_DAT0, MMC1_CMD, MMC1_CLK};
577static const unsigned p910_w1_pin1[] = {GPIO59};
578static const unsigned p910_w1_pin2[] = {GPIO65};
579static const unsigned p910_w1_pin3[] = {GPIO106};
580static const unsigned p910_w1_pin4[] = {GPIO123};
581static const unsigned p910_kpmk_pin1[] = {GPIO0, GPIO1, GPIO2, GPIO3, GPIO4,
582 GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13,
583 GPIO14, GPIO15};
584static const unsigned p910_kpmk_pin2[] = {GPIO0, GPIO1, GPIO2, GPIO3, GPIO4,
585 GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO12};
586static const unsigned p910_kpdk_pin1[] = {GPIO12, GPIO13, GPIO14, GPIO15,
587 GPIO16, GPIO17, GPIO18, GPIO19};
588static const unsigned p910_tds_pin1[] = {GPIO55, GPIO56, GPIO57, GPIO58,
589 GPIO59};
590static const unsigned p910_tds_pin2[] = {GPIO55, GPIO57, GPIO58, GPIO59};
591static const unsigned p910_tb_pin1[] = {GPIO14, GPIO15, GPIO16, GPIO17};
592static const unsigned p910_tb_pin2[] = {GPIO55, GPIO56, GPIO57, GPIO58};
593static const unsigned p910_tb_pin3[] = {MMC1_DAT7, MMC1_DAT6, MMC1_DAT5,
594 MMC1_DAT4};
595static const unsigned p910_ext_dma0_pin1[] = {GPIO72};
596static const unsigned p910_ext_dma0_pin2[] = {ND_IO15};
597static const unsigned p910_ext_dma0_pin3[] = {ND_NRE};
598static const unsigned p910_ext_dma1_pin1[] = {GPIO73};
599static const unsigned p910_ext_dma1_pin2[] = {GPIO123};
600static const unsigned p910_ext_dma1_pin3[] = {GPIO126};
601static const unsigned p910_ext_dma2_pin1[] = {GPIO74};
602static const unsigned p910_ext0_int_pin1[] = {GPIO44};
603static const unsigned p910_ext0_int_pin2[] = {ND_IO13};
604static const unsigned p910_ext1_int_pin1[] = {GPIO45};
605static const unsigned p910_ext1_int_pin2[] = {ND_IO12};
606static const unsigned p910_ext2_int_pin1[] = {GPIO46};
607static const unsigned p910_ext2_int_pin2[] = {GPIO125};
608static const unsigned p910_dac_st23_pin1[] = {GPIO32};
609static const unsigned p910_dac_st23_pin2[] = {GPIO43};
610static const unsigned p910_dac_st23_pin3[] = {GPIO52};
611static const unsigned p910_dac_st23_pin4[] = {GPIO124};
612static const unsigned p910_vcxo_out_pin1[] = {GPIO50};
613static const unsigned p910_vcxo_out_pin2[] = {VCXO_OUT};
614static const unsigned p910_vcxo_out_pin3[] = {GPIO20};
615static const unsigned p910_vcxo_req_pin1[] = {GPIO49};
616static const unsigned p910_vcxo_req_pin2[] = {GPIO125};
617static const unsigned p910_vcxo_out2_pin1[] = {GPIO86};
618static const unsigned p910_vcxo_out2_pin2[] = {ND_IO9};
619static const unsigned p910_vcxo_req2_pin1[] = {GPIO84};
620static const unsigned p910_ulpi_pin1[] = {GPIO67, GPIO68, GPIO69, GPIO70,
621 GPIO71, GPIO72, GPIO73, GPIO74, GPIO75, GPIO76, GPIO77, GPIO78};
622static const unsigned p910_nand_pin1[] = {ND_IO15, ND_IO14, ND_IO13, ND_IO12,
623 ND_IO11, ND_IO10, ND_IO9, ND_IO8, ND_IO7, ND_IO6, ND_IO5, ND_IO4,
624 ND_IO3, ND_IO2, ND_IO1, ND_IO0, ND_NCS0, ND_NWE, ND_NRE, ND_CLE,
625 ND_ALE, ND_RDY0};
626static const unsigned p910_gpio0_pin1[] = {GPIO0};
627static const unsigned p910_gpio0_pin2[] = {SM_ADV};
628static const unsigned p910_gpio1_pin1[] = {GPIO1};
629static const unsigned p910_gpio1_pin2[] = {ND_RDY1};
630static const unsigned p910_gpio2_pin1[] = {GPIO2};
631static const unsigned p910_gpio2_pin2[] = {SM_ADVMUX};
632static const unsigned p910_gpio3_pin1[] = {GPIO3};
633static const unsigned p910_gpio3_pin2[] = {SM_RDY};
634static const unsigned p910_gpio20_pin1[] = {GPIO20};
635static const unsigned p910_gpio20_pin2[] = {ND_IO15};
636static const unsigned p910_gpio20_pin3[] = {MMC1_DAT6};
637static const unsigned p910_gpio21_pin1[] = {GPIO21};
638static const unsigned p910_gpio21_pin2[] = {ND_IO14};
639static const unsigned p910_gpio21_pin3[] = {MMC1_DAT5};
640static const unsigned p910_gpio22_pin1[] = {GPIO22};
641static const unsigned p910_gpio22_pin2[] = {ND_IO13};
642static const unsigned p910_gpio22_pin3[] = {MMC1_DAT4};
643static const unsigned p910_gpio23_pin1[] = {GPIO23};
644static const unsigned p910_gpio23_pin2[] = {ND_IO12};
645static const unsigned p910_gpio23_pin3[] = {MMC1_CD};
646static const unsigned p910_gpio24_pin1[] = {GPIO24};
647static const unsigned p910_gpio24_pin2[] = {ND_IO11};
648static const unsigned p910_gpio24_pin3[] = {MMC1_DAT7};
649static const unsigned p910_gpio25_pin1[] = {GPIO25};
650static const unsigned p910_gpio25_pin2[] = {ND_IO10};
651static const unsigned p910_gpio26_pin1[] = {GPIO26};
652static const unsigned p910_gpio26_pin2[] = {ND_IO9};
653static const unsigned p910_gpio27_pin1[] = {GPIO27};
654static const unsigned p910_gpio27_pin2[] = {ND_IO8};
655static const unsigned p910_gpio85_pin1[] = {GPIO85};
656static const unsigned p910_gpio85_pin2[] = {ND_NCS0};
657static const unsigned p910_gpio86_pin1[] = {GPIO86};
658static const unsigned p910_gpio86_pin2[] = {ND_NCS1};
659static const unsigned p910_gpio87_pin1[] = {GPIO87};
660static const unsigned p910_gpio87_pin2[] = {SM_NCS0};
661static const unsigned p910_gpio88_pin1[] = {GPIO88};
662static const unsigned p910_gpio88_pin2[] = {SM_NCS1};
663static const unsigned p910_gpio89_pin1[] = {GPIO89};
664static const unsigned p910_gpio89_pin2[] = {ND_NWE};
665static const unsigned p910_gpio90_pin1[] = {GPIO90};
666static const unsigned p910_gpio90_pin2[] = {ND_NRE};
667static const unsigned p910_gpio91_pin1[] = {GPIO91};
668static const unsigned p910_gpio91_pin2[] = {ND_ALE};
669static const unsigned p910_gpio92_pin1[] = {GPIO92};
670static const unsigned p910_gpio92_pin2[] = {ND_RDY0};
671
672static struct pxa3xx_pin_group pxa910_grps[] = {
673 GRP_910("usim2 3p1", USIM2, p910_usim2_pin1),
674 GRP_910("usim2 3p2", USIM2, p910_usim2_pin2),
675 GRP_910("mmc1 12p", MMC1, p910_mmc1_pin1),
676 GRP_910("mmc2 10p", MMC2, p910_mmc2_pin1),
677 GRP_910("mmc3 6p", MMC3, p910_mmc3_pin1),
678 GRP_910("mmc3 10p", MMC3, p910_mmc3_pin2),
679 GRP_910("uart0 4p", UART0, p910_uart0_pin1),
680 GRP_910("uart1 2p1", UART1, p910_uart1_pin1),
681 GRP_910("uart1 2p2", UART1, p910_uart1_pin2),
682 GRP_910("uart1 2p3", UART1, p910_uart1_pin3),
683 GRP_910("uart1 4p4", UART1, p910_uart1_pin4),
684 GRP_910("uart1 4p5", UART1, p910_uart1_pin5),
685 GRP_910("uart2 2p1", UART2, p910_uart2_pin1),
686 GRP_910("uart2 2p2", UART2, p910_uart2_pin2),
687 GRP_910("uart2 4p3", UART2, p910_uart2_pin3),
688 GRP_910("uart2 4p4", UART2, p910_uart2_pin4),
689 GRP_910("twsi 2p1", TWSI, p910_twsi_pin1),
690 GRP_910("twsi 2p2", TWSI, p910_twsi_pin2),
691 GRP_910("twsi 2p3", TWSI, p910_twsi_pin3),
692 GRP_910("ccic", CCIC, p910_ccic_pin1),
693 GRP_910("lcd", LCD, p910_lcd_pin1),
694 GRP_910("spi 4p1", SPI, p910_spi_pin1),
695 GRP_910("spi 4p2", SPI, p910_spi_pin2),
696 GRP_910("spi 5p3", SPI, p910_spi_pin3),
697 GRP_910("spi 5p4", SPI, p910_spi_pin4),
698 GRP_910("dssp2 4p1", DSSP2, p910_dssp2_pin1),
699 GRP_910("dssp2 4p2", DSSP2, p910_dssp2_pin2),
700 GRP_910("dssp2 3p3", DSSP2, p910_dssp2_pin3),
701 GRP_910("dssp3 4p1", DSSP3, p910_dssp3_pin1),
702 GRP_910("dssp3 4p2", DSSP3, p910_dssp3_pin2),
703 GRP_910("dssp3 3p3", DSSP3, p910_dssp3_pin3),
704 GRP_910("ssp0 4p1", SSP0, p910_ssp0_pin1),
705 GRP_910("ssp0 4p2", SSP0, p910_ssp0_pin2),
706 GRP_910("ssp0 4p3", SSP0, p910_ssp0_pin3),
707 GRP_910("ssp0 4p4", SSP0, p910_ssp0_pin4),
708 GRP_910("ssp1 4p1", SSP1, p910_ssp1_pin1),
709 GRP_910("ssp1 5p2", SSP1, p910_ssp1_pin2),
710 GRP_910("ssp2 4p1", SSP2, p910_ssp2_pin1),
711 GRP_910("ssp2 4p2", SSP2, p910_ssp2_pin2),
712 GRP_910("ssp2 4p3", SSP2, p910_ssp2_pin3),
713 GRP_910("ssp2 4p4", SSP2, p910_ssp2_pin4),
714 GRP_910("gssp", GSSP, p910_gssp_pin1),
715 GRP_910("pwm0", PWM0, p910_pwm0_pin1),
716 GRP_910("pwm1-1", PWM1, p910_pwm1_pin1),
717 GRP_910("pwm1-2", PWM1, p910_pwm1_pin2),
718 GRP_910("pwm2", PWM2, p910_pwm2_pin1),
719 GRP_910("pwm3-1", PWM3, p910_pwm3_pin1),
720 GRP_910("pwm3-2", PWM3, p910_pwm3_pin2),
721 GRP_910("pwm3-3", PWM3, p910_pwm3_pin3),
722 GRP_910("pri jtag", PRI_JTAG, p910_pri_jtag_pin1),
723 GRP_910("sec1 jtag", SEC1_JTAG, p910_sec1_jtag_pin1),
724 GRP_910("sec2 jtag", SEC2_JTAG, p910_sec2_jtag_pin1),
725 GRP_910("hsl 6p1", HSL, p910_hsl_pin1),
726 GRP_910("hsl 6p2", HSL, p910_hsl_pin2),
727 GRP_910("hsl 6p3", HSL, p910_hsl_pin3),
728 GRP_910("w1-1", ONE_WIRE, p910_w1_pin1),
729 GRP_910("w1-2", ONE_WIRE, p910_w1_pin2),
730 GRP_910("w1-3", ONE_WIRE, p910_w1_pin3),
731 GRP_910("w1-4", ONE_WIRE, p910_w1_pin4),
732 GRP_910("kpmk 16p1", KP_MK, p910_kpmk_pin1),
733 GRP_910("kpmk 11p2", KP_MK, p910_kpmk_pin2),
734 GRP_910("kpdk 8p1", KP_DK, p910_kpdk_pin1),
735 GRP_910("tds 5p1", TDS, p910_tds_pin1),
736 GRP_910("tds 4p2", TDS, p910_tds_pin2),
737 GRP_910("tb 4p1", TB, p910_tb_pin1),
738 GRP_910("tb 4p2", TB, p910_tb_pin2),
739 GRP_910("tb 4p3", TB, p910_tb_pin3),
740 GRP_910("ext dma0-1", EXT_DMA, p910_ext_dma0_pin1),
741 GRP_910("ext dma0-2", EXT_DMA, p910_ext_dma0_pin2),
742 GRP_910("ext dma0-3", EXT_DMA, p910_ext_dma0_pin3),
743 GRP_910("ext dma1-1", EXT_DMA, p910_ext_dma1_pin1),
744 GRP_910("ext dma1-2", EXT_DMA, p910_ext_dma1_pin2),
745 GRP_910("ext dma1-3", EXT_DMA, p910_ext_dma1_pin3),
746 GRP_910("ext dma2", EXT_DMA, p910_ext_dma2_pin1),
747 GRP_910("ext0 int-1", EXT_INT, p910_ext0_int_pin1),
748 GRP_910("ext0 int-2", EXT_INT, p910_ext0_int_pin2),
749 GRP_910("ext1 int-1", EXT_INT, p910_ext1_int_pin1),
750 GRP_910("ext1 int-2", EXT_INT, p910_ext1_int_pin2),
751 GRP_910("ext2 int-1", EXT_INT, p910_ext2_int_pin1),
752 GRP_910("ext2 int-2", EXT_INT, p910_ext2_int_pin2),
753 GRP_910("dac st23-1", DAC_ST23, p910_dac_st23_pin1),
754 GRP_910("dac st23-2", DAC_ST23, p910_dac_st23_pin2),
755 GRP_910("dac st23-3", DAC_ST23, p910_dac_st23_pin3),
756 GRP_910("dac st23-4", DAC_ST23, p910_dac_st23_pin4),
757 GRP_910("vcxo out-1", VCXO_OUT, p910_vcxo_out_pin1),
758 GRP_910("vcxo out-2", VCXO_OUT, p910_vcxo_out_pin2),
759 GRP_910("vcxo out-3", VCXO_OUT, p910_vcxo_out_pin3),
760 GRP_910("vcxo req-1", VCXO_REQ, p910_vcxo_req_pin1),
761 GRP_910("vcxo req-2", VCXO_REQ, p910_vcxo_req_pin2),
762 GRP_910("vcxo out2-1", VCXO_OUT2, p910_vcxo_out2_pin1),
763 GRP_910("vcxo out2-2", VCXO_OUT2, p910_vcxo_out2_pin2),
764 GRP_910("vcxo req2", VCXO_REQ2, p910_vcxo_req2_pin1),
765 GRP_910("ulpi", ULPI, p910_ulpi_pin1),
766 GRP_910("nand", NAND, p910_nand_pin1),
767 GRP_910("gpio0-1", GPIO, p910_gpio0_pin1),
768 GRP_910("gpio0-2", GPIO, p910_gpio0_pin2),
769 GRP_910("gpio1-1", GPIO, p910_gpio1_pin1),
770 GRP_910("gpio1-2", GPIO, p910_gpio1_pin2),
771 GRP_910("gpio2-1", GPIO, p910_gpio2_pin1),
772 GRP_910("gpio2-2", GPIO, p910_gpio2_pin2),
773 GRP_910("gpio3-1", GPIO, p910_gpio3_pin1),
774 GRP_910("gpio3-2", GPIO, p910_gpio3_pin2),
775 GRP_910("gpio20-1", GPIO, p910_gpio20_pin1),
776 GRP_910("gpio20-2", GPIO, p910_gpio20_pin2),
777 GRP_910("gpio21-1", GPIO, p910_gpio21_pin1),
778 GRP_910("gpio21-2", GPIO, p910_gpio21_pin2),
779 GRP_910("gpio22-1", GPIO, p910_gpio22_pin1),
780 GRP_910("gpio22-2", GPIO, p910_gpio22_pin2),
781 GRP_910("gpio23-1", GPIO, p910_gpio23_pin1),
782 GRP_910("gpio23-2", GPIO, p910_gpio23_pin2),
783 GRP_910("gpio24-1", GPIO, p910_gpio24_pin1),
784 GRP_910("gpio24-2", GPIO, p910_gpio24_pin2),
785 GRP_910("gpio25-1", GPIO, p910_gpio25_pin1),
786 GRP_910("gpio25-2", GPIO, p910_gpio25_pin2),
787 GRP_910("gpio26-1", GPIO, p910_gpio26_pin1),
788 GRP_910("gpio26-2", GPIO, p910_gpio26_pin2),
789 GRP_910("gpio27-1", GPIO, p910_gpio27_pin1),
790 GRP_910("gpio27-2", GPIO, p910_gpio27_pin2),
791 GRP_910("gpio85-1", GPIO, p910_gpio85_pin1),
792 GRP_910("gpio85-2", GPIO, p910_gpio85_pin2),
793 GRP_910("gpio86-1", GPIO, p910_gpio86_pin1),
794 GRP_910("gpio86-2", GPIO, p910_gpio86_pin2),
795 GRP_910("gpio87-1", GPIO, p910_gpio87_pin1),
796 GRP_910("gpio87-2", GPIO, p910_gpio87_pin2),
797 GRP_910("gpio88-1", GPIO, p910_gpio88_pin1),
798 GRP_910("gpio88-2", GPIO, p910_gpio88_pin2),
799 GRP_910("gpio89-1", GPIO, p910_gpio89_pin1),
800 GRP_910("gpio89-2", GPIO, p910_gpio89_pin2),
801 GRP_910("gpio90-1", GPIO, p910_gpio90_pin1),
802 GRP_910("gpio90-2", GPIO, p910_gpio90_pin2),
803 GRP_910("gpio91-1", GPIO, p910_gpio91_pin1),
804 GRP_910("gpio91-2", GPIO, p910_gpio91_pin2),
805 GRP_910("gpio92-1", GPIO, p910_gpio92_pin1),
806 GRP_910("gpio92-2", GPIO, p910_gpio92_pin2),
807};
808
809static const char * const p910_usim2_grps[] = {"usim2 3p1", "usim2 3p2"};
810static const char * const p910_mmc1_grps[] = {"mmc1 12p"};
811static const char * const p910_mmc2_grps[] = {"mmc2 10p"};
812static const char * const p910_mmc3_grps[] = {"mmc3 6p", "mmc3 10p"};
813static const char * const p910_uart0_grps[] = {"uart0 4p"};
814static const char * const p910_uart1_grps[] = {"uart1 2p1", "uart1 2p2",
815 "uart1 2p3", "uart1 4p4", "uart1 4p5"};
816static const char * const p910_uart2_grps[] = {"uart2 2p1", "uart2 2p2",
817 "uart2 4p3", "uart2 4p4"};
818static const char * const p910_twsi_grps[] = {"twsi 2p1", "twsi 2p2",
819 "twsi 2p3"};
820static const char * const p910_ccic_grps[] = {"ccic"};
821static const char * const p910_lcd_grps[] = {"lcd"};
822static const char * const p910_spi_grps[] = {"spi 4p1", "spi 4p2", "spi 5p3",
823 "spi 5p4"};
824static const char * const p910_dssp2_grps[] = {"dssp2 4p1", "dssp2 4p2",
825 "dssp2 3p3"};
826static const char * const p910_dssp3_grps[] = {"dssp3 4p1", "dssp3 4p2",
827 "dssp3 3p3"};
828static const char * const p910_ssp0_grps[] = {"ssp0 4p1", "ssp0 4p2",
829 "ssp0 4p3", "ssp0 4p4"};
830static const char * const p910_ssp1_grps[] = {"ssp1 4p1", "ssp1 5p2"};
831static const char * const p910_ssp2_grps[] = {"ssp2 4p1", "ssp2 4p2",
832 "ssp2 4p3", "ssp2 4p4"};
833static const char * const p910_gssp_grps[] = {"gssp"};
834static const char * const p910_pwm0_grps[] = {"pwm0"};
835static const char * const p910_pwm1_grps[] = {"pwm1-1", "pwm1-2"};
836static const char * const p910_pwm2_grps[] = {"pwm2"};
837static const char * const p910_pwm3_grps[] = {"pwm3-1", "pwm3-2", "pwm3-3"};
838static const char * const p910_pri_jtag_grps[] = {"pri jtag"};
839static const char * const p910_sec1_jtag_grps[] = {"sec1 jtag"};
840static const char * const p910_sec2_jtag_grps[] = {"sec2 jtag"};
841static const char * const p910_hsl_grps[] = {"hsl 6p1", "hsl 6p2", "hsl 6p3"};
842static const char * const p910_w1_grps[] = {"w1-1", "w1-2", "w1-3", "w1-4"};
843static const char * const p910_kpmk_grps[] = {"kpmk 16p1", "kpmk 11p2"};
844static const char * const p910_kpdk_grps[] = {"kpdk 8p1"};
845static const char * const p910_tds_grps[] = {"tds 5p1", "tds 4p2"};
846static const char * const p910_tb_grps[] = {"tb 4p1", "tb 4p2", "tb 4p3"};
847static const char * const p910_dma0_grps[] = {"ext dma0-1", "ext dma0-2",
848 "ext dma0-3"};
849static const char * const p910_dma1_grps[] = {"ext dma1-1", "ext dma1-2",
850 "ext dma1-3"};
851static const char * const p910_dma2_grps[] = {"ext dma2"};
852static const char * const p910_int0_grps[] = {"ext0 int-1", "ext0 int-2"};
853static const char * const p910_int1_grps[] = {"ext1 int-1", "ext1 int-2"};
854static const char * const p910_int2_grps[] = {"ext2 int-1", "ext2 int-2"};
855static const char * const p910_dac_st23_grps[] = {"dac st23-1", "dac st23-2",
856 "dac st23-3", "dac st23-4"};
857static const char * const p910_vcxo_out_grps[] = {"vcxo out-1", "vcxo out-2",
858 "vcxo out-3"};
859static const char * const p910_vcxo_req_grps[] = {"vcxo req-1", "vcxo req-2"};
860static const char * const p910_vcxo_out2_grps[] = {"vcxo out2-1",
861 "vcxo out2-2"};
862static const char * const p910_vcxo_req2_grps[] = {"vcxo req2"};
863static const char * const p910_ulpi_grps[] = {"ulpi"};
864static const char * const p910_nand_grps[] = {"nand"};
865static const char * const p910_gpio0_grps[] = {"gpio0-1", "gpio0-2"};
866static const char * const p910_gpio1_grps[] = {"gpio1-1", "gpio1-2"};
867static const char * const p910_gpio2_grps[] = {"gpio2-1", "gpio2-2"};
868static const char * const p910_gpio3_grps[] = {"gpio3-1", "gpio3-2"};
869static const char * const p910_gpio20_grps[] = {"gpio20-1", "gpio20-2"};
870static const char * const p910_gpio21_grps[] = {"gpio21-1", "gpio21-2"};
871static const char * const p910_gpio22_grps[] = {"gpio22-1", "gpio22-2"};
872static const char * const p910_gpio23_grps[] = {"gpio23-1", "gpio23-2"};
873static const char * const p910_gpio24_grps[] = {"gpio24-1", "gpio24-2"};
874static const char * const p910_gpio25_grps[] = {"gpio25-1", "gpio25-2"};
875static const char * const p910_gpio26_grps[] = {"gpio26-1", "gpio26-2"};
876static const char * const p910_gpio27_grps[] = {"gpio27-1", "gpio27-2"};
877static const char * const p910_gpio85_grps[] = {"gpio85-1", "gpio85-2"};
878static const char * const p910_gpio86_grps[] = {"gpio86-1", "gpio86-2"};
879static const char * const p910_gpio87_grps[] = {"gpio87-1", "gpio87-2"};
880static const char * const p910_gpio88_grps[] = {"gpio88-1", "gpio88-2"};
881static const char * const p910_gpio89_grps[] = {"gpio89-1", "gpio89-2"};
882static const char * const p910_gpio90_grps[] = {"gpio90-1", "gpio90-2"};
883static const char * const p910_gpio91_grps[] = {"gpio91-1", "gpio91-2"};
884static const char * const p910_gpio92_grps[] = {"gpio92-1", "gpio92-2"};
885
886static struct pxa3xx_pmx_func pxa910_funcs[] = {
887 {"usim2", ARRAY_AND_SIZE(p910_usim2_grps)},
888 {"mmc1", ARRAY_AND_SIZE(p910_mmc1_grps)},
889 {"mmc2", ARRAY_AND_SIZE(p910_mmc2_grps)},
890 {"mmc3", ARRAY_AND_SIZE(p910_mmc3_grps)},
891 {"uart0", ARRAY_AND_SIZE(p910_uart0_grps)},
892 {"uart1", ARRAY_AND_SIZE(p910_uart1_grps)},
893 {"uart2", ARRAY_AND_SIZE(p910_uart2_grps)},
894 {"twsi", ARRAY_AND_SIZE(p910_twsi_grps)},
895 {"ccic", ARRAY_AND_SIZE(p910_ccic_grps)},
896 {"lcd", ARRAY_AND_SIZE(p910_lcd_grps)},
897 {"spi", ARRAY_AND_SIZE(p910_spi_grps)},
898 {"dssp2", ARRAY_AND_SIZE(p910_dssp2_grps)},
899 {"dssp3", ARRAY_AND_SIZE(p910_dssp3_grps)},
900 {"ssp0", ARRAY_AND_SIZE(p910_ssp0_grps)},
901 {"ssp1", ARRAY_AND_SIZE(p910_ssp1_grps)},
902 {"ssp2", ARRAY_AND_SIZE(p910_ssp2_grps)},
903 {"gssp", ARRAY_AND_SIZE(p910_gssp_grps)},
904 {"pwm0", ARRAY_AND_SIZE(p910_pwm0_grps)},
905 {"pwm1", ARRAY_AND_SIZE(p910_pwm1_grps)},
906 {"pwm2", ARRAY_AND_SIZE(p910_pwm2_grps)},
907 {"pwm3", ARRAY_AND_SIZE(p910_pwm3_grps)},
908 {"pri_jtag", ARRAY_AND_SIZE(p910_pri_jtag_grps)},
909 {"sec1_jtag", ARRAY_AND_SIZE(p910_sec1_jtag_grps)},
910 {"sec2_jtag", ARRAY_AND_SIZE(p910_sec2_jtag_grps)},
911 {"hsl", ARRAY_AND_SIZE(p910_hsl_grps)},
912 {"w1", ARRAY_AND_SIZE(p910_w1_grps)},
913 {"kpmk", ARRAY_AND_SIZE(p910_kpmk_grps)},
914 {"kpdk", ARRAY_AND_SIZE(p910_kpdk_grps)},
915 {"tds", ARRAY_AND_SIZE(p910_tds_grps)},
916 {"tb", ARRAY_AND_SIZE(p910_tb_grps)},
917 {"dma0", ARRAY_AND_SIZE(p910_dma0_grps)},
918 {"dma1", ARRAY_AND_SIZE(p910_dma1_grps)},
919 {"dma2", ARRAY_AND_SIZE(p910_dma2_grps)},
920 {"int0", ARRAY_AND_SIZE(p910_int0_grps)},
921 {"int1", ARRAY_AND_SIZE(p910_int1_grps)},
922 {"int2", ARRAY_AND_SIZE(p910_int2_grps)},
923 {"dac_st23", ARRAY_AND_SIZE(p910_dac_st23_grps)},
924 {"vcxo_out", ARRAY_AND_SIZE(p910_vcxo_out_grps)},
925 {"vcxo_req", ARRAY_AND_SIZE(p910_vcxo_req_grps)},
926 {"vcxo_out2", ARRAY_AND_SIZE(p910_vcxo_out2_grps)},
927 {"vcxo_req2", ARRAY_AND_SIZE(p910_vcxo_req2_grps)},
928 {"ulpi", ARRAY_AND_SIZE(p910_ulpi_grps)},
929 {"nand", ARRAY_AND_SIZE(p910_nand_grps)},
930 {"gpio0", ARRAY_AND_SIZE(p910_gpio0_grps)},
931 {"gpio1", ARRAY_AND_SIZE(p910_gpio1_grps)},
932 {"gpio2", ARRAY_AND_SIZE(p910_gpio2_grps)},
933 {"gpio3", ARRAY_AND_SIZE(p910_gpio3_grps)},
934 {"gpio20", ARRAY_AND_SIZE(p910_gpio20_grps)},
935 {"gpio21", ARRAY_AND_SIZE(p910_gpio21_grps)},
936 {"gpio22", ARRAY_AND_SIZE(p910_gpio22_grps)},
937 {"gpio23", ARRAY_AND_SIZE(p910_gpio23_grps)},
938 {"gpio24", ARRAY_AND_SIZE(p910_gpio24_grps)},
939 {"gpio25", ARRAY_AND_SIZE(p910_gpio25_grps)},
940 {"gpio26", ARRAY_AND_SIZE(p910_gpio26_grps)},
941 {"gpio27", ARRAY_AND_SIZE(p910_gpio27_grps)},
942 {"gpio85", ARRAY_AND_SIZE(p910_gpio85_grps)},
943 {"gpio86", ARRAY_AND_SIZE(p910_gpio86_grps)},
944 {"gpio87", ARRAY_AND_SIZE(p910_gpio87_grps)},
945 {"gpio88", ARRAY_AND_SIZE(p910_gpio88_grps)},
946 {"gpio89", ARRAY_AND_SIZE(p910_gpio89_grps)},
947 {"gpio90", ARRAY_AND_SIZE(p910_gpio90_grps)},
948 {"gpio91", ARRAY_AND_SIZE(p910_gpio91_grps)},
949 {"gpio92", ARRAY_AND_SIZE(p910_gpio92_grps)},
950};
951
952static struct pinctrl_desc pxa910_pctrl_desc = {
953 .name = "pxa910-pinctrl",
954 .owner = THIS_MODULE,
955};
956
957static struct pxa3xx_pinmux_info pxa910_info = {
958 .mfp = pxa910_mfp,
959 .num_mfp = ARRAY_SIZE(pxa910_mfp),
960 .grps = pxa910_grps,
961 .num_grps = ARRAY_SIZE(pxa910_grps),
962 .funcs = pxa910_funcs,
963 .num_funcs = ARRAY_SIZE(pxa910_funcs),
964 .num_gpio = 128,
965 .desc = &pxa910_pctrl_desc,
966 .pads = pxa910_pads,
967 .num_pads = ARRAY_SIZE(pxa910_pads),
968
969 .cputype = PINCTRL_PXA910,
970 .ds_mask = PXA910_DS_MASK,
971 .ds_shift = PXA910_DS_SHIFT,
972};
973
974static int pxa910_pinmux_probe(struct platform_device *pdev)
975{
976 return pxa3xx_pinctrl_register(pdev, &pxa910_info);
977}
978
979static int pxa910_pinmux_remove(struct platform_device *pdev)
980{
981 return pxa3xx_pinctrl_unregister(pdev);
982}
983
984static struct platform_driver pxa910_pinmux_driver = {
985 .driver = {
986 .name = "pxa910-pinmux",
987 .owner = THIS_MODULE,
988 },
989 .probe = pxa910_pinmux_probe,
990 .remove = pxa910_pinmux_remove,
991};
992
993static int __init pxa910_pinmux_init(void)
994{
995 return platform_driver_register(&pxa910_pinmux_driver);
996}
997core_initcall_sync(pxa910_pinmux_init);
998
999static void __exit pxa910_pinmux_exit(void)
1000{
1001 platform_driver_unregister(&pxa910_pinmux_driver);
1002}
1003module_exit(pxa910_pinmux_exit);
1004
1005MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
1006MODULE_DESCRIPTION("PXA3xx pin control driver");
1007MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/pinctrl-s3c64xx.c b/drivers/pinctrl/pinctrl-s3c64xx.c
new file mode 100644
index 000000000000..89143c903000
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-s3c64xx.c
@@ -0,0 +1,816 @@
1/*
2 * S3C64xx specific support for pinctrl-samsung driver.
3 *
4 * Copyright (c) 2013 Tomasz Figa <tomasz.figa@gmail.com>
5 *
6 * Based on pinctrl-exynos.c, please see the file for original copyrights.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This file contains the Samsung S3C64xx specific information required by the
14 * the Samsung pinctrl/gpiolib driver. It also includes the implementation of
15 * external gpio and wakeup interrupt support.
16 */
17
18#include <linux/module.h>
19#include <linux/device.h>
20#include <linux/interrupt.h>
21#include <linux/irqdomain.h>
22#include <linux/irq.h>
23#include <linux/of_irq.h>
24#include <linux/io.h>
25#include <linux/irqchip/chained_irq.h>
26#include <linux/slab.h>
27#include <linux/err.h>
28
29#include "pinctrl-samsung.h"
30
31#define NUM_EINT0 28
32#define NUM_EINT0_IRQ 4
33#define EINT_MAX_PER_REG 16
34#define EINT_MAX_PER_GROUP 16
35
36/* External GPIO and wakeup interrupt related definitions */
37#define SVC_GROUP_SHIFT 4
38#define SVC_GROUP_MASK 0xf
39#define SVC_NUM_MASK 0xf
40#define SVC_GROUP(x) ((x >> SVC_GROUP_SHIFT) & \
41 SVC_GROUP_MASK)
42
43#define EINT12CON_REG 0x200
44#define EINT12MASK_REG 0x240
45#define EINT12PEND_REG 0x260
46
47#define EINT_OFFS(i) ((i) % (2 * EINT_MAX_PER_GROUP))
48#define EINT_GROUP(i) ((i) / EINT_MAX_PER_GROUP)
49#define EINT_REG(g) (4 * ((g) / 2))
50
51#define EINTCON_REG(i) (EINT12CON_REG + EINT_REG(EINT_GROUP(i)))
52#define EINTMASK_REG(i) (EINT12MASK_REG + EINT_REG(EINT_GROUP(i)))
53#define EINTPEND_REG(i) (EINT12PEND_REG + EINT_REG(EINT_GROUP(i)))
54
55#define SERVICE_REG 0x284
56#define SERVICEPEND_REG 0x288
57
58#define EINT0CON0_REG 0x900
59#define EINT0MASK_REG 0x920
60#define EINT0PEND_REG 0x924
61
62/* S3C64xx specific external interrupt trigger types */
63#define EINT_LEVEL_LOW 0
64#define EINT_LEVEL_HIGH 1
65#define EINT_EDGE_FALLING 2
66#define EINT_EDGE_RISING 4
67#define EINT_EDGE_BOTH 6
68#define EINT_CON_MASK 0xF
69#define EINT_CON_LEN 4
70
71static struct samsung_pin_bank_type bank_type_4bit_off = {
72 .fld_width = { 4, 1, 2, 0, 2, 2, },
73 .reg_offset = { 0x00, 0x04, 0x08, 0, 0x0c, 0x10, },
74};
75
76static struct samsung_pin_bank_type bank_type_4bit_alive = {
77 .fld_width = { 4, 1, 2, },
78 .reg_offset = { 0x00, 0x04, 0x08, },
79};
80
81static struct samsung_pin_bank_type bank_type_4bit2_off = {
82 .fld_width = { 4, 1, 2, 0, 2, 2, },
83 .reg_offset = { 0x00, 0x08, 0x0c, 0, 0x10, 0x14, },
84};
85
86static struct samsung_pin_bank_type bank_type_4bit2_alive = {
87 .fld_width = { 4, 1, 2, },
88 .reg_offset = { 0x00, 0x08, 0x0c, },
89};
90
91static struct samsung_pin_bank_type bank_type_2bit_off = {
92 .fld_width = { 2, 1, 2, 0, 2, 2, },
93 .reg_offset = { 0x00, 0x04, 0x08, 0, 0x0c, 0x10, },
94};
95
96static struct samsung_pin_bank_type bank_type_2bit_alive = {
97 .fld_width = { 2, 1, 2, },
98 .reg_offset = { 0x00, 0x04, 0x08, },
99};
100
101#define PIN_BANK_4BIT(pins, reg, id) \
102 { \
103 .type = &bank_type_4bit_off, \
104 .pctl_offset = reg, \
105 .nr_pins = pins, \
106 .eint_type = EINT_TYPE_NONE, \
107 .name = id \
108 }
109
110#define PIN_BANK_4BIT_EINTG(pins, reg, id, eoffs) \
111 { \
112 .type = &bank_type_4bit_off, \
113 .pctl_offset = reg, \
114 .nr_pins = pins, \
115 .eint_type = EINT_TYPE_GPIO, \
116 .eint_func = 7, \
117 .eint_mask = (1 << (pins)) - 1, \
118 .eint_offset = eoffs, \
119 .name = id \
120 }
121
122#define PIN_BANK_4BIT_EINTW(pins, reg, id, eoffs, emask) \
123 { \
124 .type = &bank_type_4bit_alive,\
125 .pctl_offset = reg, \
126 .nr_pins = pins, \
127 .eint_type = EINT_TYPE_WKUP, \
128 .eint_func = 3, \
129 .eint_mask = emask, \
130 .eint_offset = eoffs, \
131 .name = id \
132 }
133
134#define PIN_BANK_4BIT2_EINTG(pins, reg, id, eoffs) \
135 { \
136 .type = &bank_type_4bit2_off, \
137 .pctl_offset = reg, \
138 .nr_pins = pins, \
139 .eint_type = EINT_TYPE_GPIO, \
140 .eint_func = 7, \
141 .eint_mask = (1 << (pins)) - 1, \
142 .eint_offset = eoffs, \
143 .name = id \
144 }
145
146#define PIN_BANK_4BIT2_EINTW(pins, reg, id, eoffs, emask) \
147 { \
148 .type = &bank_type_4bit2_alive,\
149 .pctl_offset = reg, \
150 .nr_pins = pins, \
151 .eint_type = EINT_TYPE_WKUP, \
152 .eint_func = 3, \
153 .eint_mask = emask, \
154 .eint_offset = eoffs, \
155 .name = id \
156 }
157
158#define PIN_BANK_4BIT2_ALIVE(pins, reg, id) \
159 { \
160 .type = &bank_type_4bit2_alive,\
161 .pctl_offset = reg, \
162 .nr_pins = pins, \
163 .eint_type = EINT_TYPE_NONE, \
164 .name = id \
165 }
166
167#define PIN_BANK_2BIT(pins, reg, id) \
168 { \
169 .type = &bank_type_2bit_off, \
170 .pctl_offset = reg, \
171 .nr_pins = pins, \
172 .eint_type = EINT_TYPE_NONE, \
173 .name = id \
174 }
175
176#define PIN_BANK_2BIT_EINTG(pins, reg, id, eoffs, emask) \
177 { \
178 .type = &bank_type_2bit_off, \
179 .pctl_offset = reg, \
180 .nr_pins = pins, \
181 .eint_type = EINT_TYPE_GPIO, \
182 .eint_func = 3, \
183 .eint_mask = emask, \
184 .eint_offset = eoffs, \
185 .name = id \
186 }
187
188#define PIN_BANK_2BIT_EINTW(pins, reg, id, eoffs) \
189 { \
190 .type = &bank_type_2bit_alive,\
191 .pctl_offset = reg, \
192 .nr_pins = pins, \
193 .eint_type = EINT_TYPE_WKUP, \
194 .eint_func = 2, \
195 .eint_mask = (1 << (pins)) - 1, \
196 .eint_offset = eoffs, \
197 .name = id \
198 }
199
200/**
201 * struct s3c64xx_eint0_data: EINT0 common data
202 * @drvdata: pin controller driver data
203 * @domains: IRQ domains of particular EINT0 interrupts
204 * @pins: pin offsets inside of banks of particular EINT0 interrupts
205 */
206struct s3c64xx_eint0_data {
207 struct samsung_pinctrl_drv_data *drvdata;
208 struct irq_domain *domains[NUM_EINT0];
209 u8 pins[NUM_EINT0];
210};
211
212/**
213 * struct s3c64xx_eint0_domain_data: EINT0 per-domain data
214 * @bank: pin bank related to the domain
215 * @eints: EINT0 interrupts related to the domain
216 */
217struct s3c64xx_eint0_domain_data {
218 struct samsung_pin_bank *bank;
219 u8 eints[];
220};
221
222/**
223 * struct s3c64xx_eint_gpio_data: GPIO EINT data
224 * @drvdata: pin controller driver data
225 * @domains: array of domains related to EINT interrupt groups
226 */
227struct s3c64xx_eint_gpio_data {
228 struct samsung_pinctrl_drv_data *drvdata;
229 struct irq_domain *domains[];
230};
231
232/*
233 * Common functions for S3C64xx EINT configuration
234 */
235
236static int s3c64xx_irq_get_trigger(unsigned int type)
237{
238 int trigger;
239
240 switch (type) {
241 case IRQ_TYPE_EDGE_RISING:
242 trigger = EINT_EDGE_RISING;
243 break;
244 case IRQ_TYPE_EDGE_FALLING:
245 trigger = EINT_EDGE_FALLING;
246 break;
247 case IRQ_TYPE_EDGE_BOTH:
248 trigger = EINT_EDGE_BOTH;
249 break;
250 case IRQ_TYPE_LEVEL_HIGH:
251 trigger = EINT_LEVEL_HIGH;
252 break;
253 case IRQ_TYPE_LEVEL_LOW:
254 trigger = EINT_LEVEL_LOW;
255 break;
256 default:
257 return -EINVAL;
258 }
259
260 return trigger;
261}
262
263static void s3c64xx_irq_set_handler(unsigned int irq, unsigned int type)
264{
265 /* Edge- and level-triggered interrupts need different handlers */
266 if (type & IRQ_TYPE_EDGE_BOTH)
267 __irq_set_handler_locked(irq, handle_edge_irq);
268 else
269 __irq_set_handler_locked(irq, handle_level_irq);
270}
271
272static void s3c64xx_irq_set_function(struct samsung_pinctrl_drv_data *d,
273 struct samsung_pin_bank *bank, int pin)
274{
275 struct samsung_pin_bank_type *bank_type = bank->type;
276 unsigned long flags;
277 void __iomem *reg;
278 u8 shift;
279 u32 mask;
280 u32 val;
281
282 /* Make sure that pin is configured as interrupt */
283 reg = d->virt_base + bank->pctl_offset;
284 shift = pin;
285 if (bank_type->fld_width[PINCFG_TYPE_FUNC] * shift >= 32) {
286 /* 4-bit bank type with 2 con regs */
287 reg += 4;
288 shift -= 8;
289 }
290
291 shift = shift * bank_type->fld_width[PINCFG_TYPE_FUNC];
292 mask = (1 << bank_type->fld_width[PINCFG_TYPE_FUNC]) - 1;
293
294 spin_lock_irqsave(&bank->slock, flags);
295
296 val = readl(reg);
297 val &= ~(mask << shift);
298 val |= bank->eint_func << shift;
299 writel(val, reg);
300
301 spin_unlock_irqrestore(&bank->slock, flags);
302}
303
304/*
305 * Functions for EINT GPIO configuration (EINT groups 1-9)
306 */
307
308static inline void s3c64xx_gpio_irq_set_mask(struct irq_data *irqd, bool mask)
309{
310 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
311 struct samsung_pinctrl_drv_data *d = bank->drvdata;
312 unsigned char index = EINT_OFFS(bank->eint_offset) + irqd->hwirq;
313 void __iomem *reg = d->virt_base + EINTMASK_REG(bank->eint_offset);
314 u32 val;
315
316 val = readl(reg);
317 if (mask)
318 val |= 1 << index;
319 else
320 val &= ~(1 << index);
321 writel(val, reg);
322}
323
324static void s3c64xx_gpio_irq_unmask(struct irq_data *irqd)
325{
326 s3c64xx_gpio_irq_set_mask(irqd, false);
327}
328
329static void s3c64xx_gpio_irq_mask(struct irq_data *irqd)
330{
331 s3c64xx_gpio_irq_set_mask(irqd, true);
332}
333
334static void s3c64xx_gpio_irq_ack(struct irq_data *irqd)
335{
336 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
337 struct samsung_pinctrl_drv_data *d = bank->drvdata;
338 unsigned char index = EINT_OFFS(bank->eint_offset) + irqd->hwirq;
339 void __iomem *reg = d->virt_base + EINTPEND_REG(bank->eint_offset);
340
341 writel(1 << index, reg);
342}
343
344static int s3c64xx_gpio_irq_set_type(struct irq_data *irqd, unsigned int type)
345{
346 struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
347 struct samsung_pinctrl_drv_data *d = bank->drvdata;
348 void __iomem *reg;
349 int trigger;
350 u8 shift;
351 u32 val;
352
353 trigger = s3c64xx_irq_get_trigger(type);
354 if (trigger < 0) {
355 pr_err("unsupported external interrupt type\n");
356 return -EINVAL;
357 }
358
359 s3c64xx_irq_set_handler(irqd->irq, type);
360
361 /* Set up interrupt trigger */
362 reg = d->virt_base + EINTCON_REG(bank->eint_offset);
363 shift = EINT_OFFS(bank->eint_offset) + irqd->hwirq;
364 shift = 4 * (shift / 4); /* 4 EINTs per trigger selector */
365
366 val = readl(reg);
367 val &= ~(EINT_CON_MASK << shift);
368 val |= trigger << shift;
369 writel(val, reg);
370
371 s3c64xx_irq_set_function(d, bank, irqd->hwirq);
372
373 return 0;
374}
375
376/*
377 * irq_chip for gpio interrupts.
378 */
379static struct irq_chip s3c64xx_gpio_irq_chip = {
380 .name = "GPIO",
381 .irq_unmask = s3c64xx_gpio_irq_unmask,
382 .irq_mask = s3c64xx_gpio_irq_mask,
383 .irq_ack = s3c64xx_gpio_irq_ack,
384 .irq_set_type = s3c64xx_gpio_irq_set_type,
385};
386
387static int s3c64xx_gpio_irq_map(struct irq_domain *h, unsigned int virq,
388 irq_hw_number_t hw)
389{
390 struct samsung_pin_bank *bank = h->host_data;
391
392 if (!(bank->eint_mask & (1 << hw)))
393 return -EINVAL;
394
395 irq_set_chip_and_handler(virq,
396 &s3c64xx_gpio_irq_chip, handle_level_irq);
397 irq_set_chip_data(virq, bank);
398 set_irq_flags(virq, IRQF_VALID);
399
400 return 0;
401}
402
403/*
404 * irq domain callbacks for external gpio interrupt controller.
405 */
406static const struct irq_domain_ops s3c64xx_gpio_irqd_ops = {
407 .map = s3c64xx_gpio_irq_map,
408 .xlate = irq_domain_xlate_twocell,
409};
410
411static void s3c64xx_eint_gpio_irq(unsigned int irq, struct irq_desc *desc)
412{
413 struct irq_chip *chip = irq_get_chip(irq);
414 struct s3c64xx_eint_gpio_data *data = irq_get_handler_data(irq);
415 struct samsung_pinctrl_drv_data *drvdata = data->drvdata;
416
417 chained_irq_enter(chip, desc);
418
419 do {
420 unsigned int svc;
421 unsigned int group;
422 unsigned int pin;
423 unsigned int virq;
424
425 svc = readl(drvdata->virt_base + SERVICE_REG);
426 group = SVC_GROUP(svc);
427 pin = svc & SVC_NUM_MASK;
428
429 if (!group)
430 break;
431
432 /* Group 1 is used for two pin banks */
433 if (group == 1) {
434 if (pin < 8)
435 group = 0;
436 else
437 pin -= 8;
438 }
439
440 virq = irq_linear_revmap(data->domains[group], pin);
441 /*
442 * Something must be really wrong if an unmapped EINT
443 * was unmasked...
444 */
445 BUG_ON(!virq);
446
447 generic_handle_irq(virq);
448 } while (1);
449
450 chained_irq_exit(chip, desc);
451}
452
453/**
454 * s3c64xx_eint_gpio_init() - setup handling of external gpio interrupts.
455 * @d: driver data of samsung pinctrl driver.
456 */
457static int s3c64xx_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
458{
459 struct s3c64xx_eint_gpio_data *data;
460 struct samsung_pin_bank *bank;
461 struct device *dev = d->dev;
462 unsigned int nr_domains;
463 unsigned int i;
464
465 if (!d->irq) {
466 dev_err(dev, "irq number not available\n");
467 return -EINVAL;
468 }
469
470 nr_domains = 0;
471 bank = d->ctrl->pin_banks;
472 for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
473 unsigned int nr_eints;
474 unsigned int mask;
475
476 if (bank->eint_type != EINT_TYPE_GPIO)
477 continue;
478
479 mask = bank->eint_mask;
480 nr_eints = fls(mask);
481
482 bank->irq_domain = irq_domain_add_linear(bank->of_node,
483 nr_eints, &s3c64xx_gpio_irqd_ops, bank);
484 if (!bank->irq_domain) {
485 dev_err(dev, "gpio irq domain add failed\n");
486 return -ENXIO;
487 }
488
489 ++nr_domains;
490 }
491
492 data = devm_kzalloc(dev, sizeof(*data)
493 + nr_domains * sizeof(*data->domains), GFP_KERNEL);
494 if (!data) {
495 dev_err(dev, "failed to allocate handler data\n");
496 return -ENOMEM;
497 }
498 data->drvdata = d;
499
500 bank = d->ctrl->pin_banks;
501 nr_domains = 0;
502 for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
503 if (bank->eint_type != EINT_TYPE_GPIO)
504 continue;
505
506 data->domains[nr_domains++] = bank->irq_domain;
507 }
508
509 irq_set_chained_handler(d->irq, s3c64xx_eint_gpio_irq);
510 irq_set_handler_data(d->irq, data);
511
512 return 0;
513}
514
515/*
516 * Functions for configuration of EINT0 wake-up interrupts
517 */
518
519static inline void s3c64xx_eint0_irq_set_mask(struct irq_data *irqd, bool mask)
520{
521 struct s3c64xx_eint0_domain_data *ddata =
522 irq_data_get_irq_chip_data(irqd);
523 struct samsung_pinctrl_drv_data *d = ddata->bank->drvdata;
524 u32 val;
525
526 val = readl(d->virt_base + EINT0MASK_REG);
527 if (mask)
528 val |= 1 << ddata->eints[irqd->hwirq];
529 else
530 val &= ~(1 << ddata->eints[irqd->hwirq]);
531 writel(val, d->virt_base + EINT0MASK_REG);
532}
533
534static void s3c64xx_eint0_irq_unmask(struct irq_data *irqd)
535{
536 s3c64xx_eint0_irq_set_mask(irqd, false);
537}
538
539static void s3c64xx_eint0_irq_mask(struct irq_data *irqd)
540{
541 s3c64xx_eint0_irq_set_mask(irqd, true);
542}
543
544static void s3c64xx_eint0_irq_ack(struct irq_data *irqd)
545{
546 struct s3c64xx_eint0_domain_data *ddata =
547 irq_data_get_irq_chip_data(irqd);
548 struct samsung_pinctrl_drv_data *d = ddata->bank->drvdata;
549
550 writel(1 << ddata->eints[irqd->hwirq],
551 d->virt_base + EINT0PEND_REG);
552}
553
554static int s3c64xx_eint0_irq_set_type(struct irq_data *irqd, unsigned int type)
555{
556 struct s3c64xx_eint0_domain_data *ddata =
557 irq_data_get_irq_chip_data(irqd);
558 struct samsung_pin_bank *bank = ddata->bank;
559 struct samsung_pinctrl_drv_data *d = bank->drvdata;
560 void __iomem *reg;
561 int trigger;
562 u8 shift;
563 u32 val;
564
565 trigger = s3c64xx_irq_get_trigger(type);
566 if (trigger < 0) {
567 pr_err("unsupported external interrupt type\n");
568 return -EINVAL;
569 }
570
571 s3c64xx_irq_set_handler(irqd->irq, type);
572
573 /* Set up interrupt trigger */
574 reg = d->virt_base + EINT0CON0_REG;
575 shift = ddata->eints[irqd->hwirq];
576 if (shift >= EINT_MAX_PER_REG) {
577 reg += 4;
578 shift -= EINT_MAX_PER_REG;
579 }
580 shift = EINT_CON_LEN * (shift / 2);
581
582 val = readl(reg);
583 val &= ~(EINT_CON_MASK << shift);
584 val |= trigger << shift;
585 writel(val, reg);
586
587 s3c64xx_irq_set_function(d, bank, irqd->hwirq);
588
589 return 0;
590}
591
592/*
593 * irq_chip for wakeup interrupts
594 */
595static struct irq_chip s3c64xx_eint0_irq_chip = {
596 .name = "EINT0",
597 .irq_unmask = s3c64xx_eint0_irq_unmask,
598 .irq_mask = s3c64xx_eint0_irq_mask,
599 .irq_ack = s3c64xx_eint0_irq_ack,
600 .irq_set_type = s3c64xx_eint0_irq_set_type,
601};
602
603static inline void s3c64xx_irq_demux_eint(unsigned int irq,
604 struct irq_desc *desc, u32 range)
605{
606 struct irq_chip *chip = irq_get_chip(irq);
607 struct s3c64xx_eint0_data *data = irq_get_handler_data(irq);
608 struct samsung_pinctrl_drv_data *drvdata = data->drvdata;
609 unsigned int pend, mask;
610
611 chained_irq_enter(chip, desc);
612
613 pend = readl(drvdata->virt_base + EINT0PEND_REG);
614 mask = readl(drvdata->virt_base + EINT0MASK_REG);
615
616 pend = pend & range & ~mask;
617 pend &= range;
618
619 while (pend) {
620 unsigned int virq;
621
622 irq = fls(pend) - 1;
623 pend &= ~(1 << irq);
624
625 virq = irq_linear_revmap(data->domains[irq], data->pins[irq]);
626 /*
627 * Something must be really wrong if an unmapped EINT
628 * was unmasked...
629 */
630 BUG_ON(!virq);
631
632 generic_handle_irq(virq);
633 }
634
635 chained_irq_exit(chip, desc);
636}
637
638static void s3c64xx_demux_eint0_3(unsigned int irq, struct irq_desc *desc)
639{
640 s3c64xx_irq_demux_eint(irq, desc, 0xf);
641}
642
643static void s3c64xx_demux_eint4_11(unsigned int irq, struct irq_desc *desc)
644{
645 s3c64xx_irq_demux_eint(irq, desc, 0xff0);
646}
647
648static void s3c64xx_demux_eint12_19(unsigned int irq, struct irq_desc *desc)
649{
650 s3c64xx_irq_demux_eint(irq, desc, 0xff000);
651}
652
653static void s3c64xx_demux_eint20_27(unsigned int irq, struct irq_desc *desc)
654{
655 s3c64xx_irq_demux_eint(irq, desc, 0xff00000);
656}
657
658static irq_flow_handler_t s3c64xx_eint0_handlers[NUM_EINT0_IRQ] = {
659 s3c64xx_demux_eint0_3,
660 s3c64xx_demux_eint4_11,
661 s3c64xx_demux_eint12_19,
662 s3c64xx_demux_eint20_27,
663};
664
665static int s3c64xx_eint0_irq_map(struct irq_domain *h, unsigned int virq,
666 irq_hw_number_t hw)
667{
668 struct s3c64xx_eint0_domain_data *ddata = h->host_data;
669 struct samsung_pin_bank *bank = ddata->bank;
670
671 if (!(bank->eint_mask & (1 << hw)))
672 return -EINVAL;
673
674 irq_set_chip_and_handler(virq,
675 &s3c64xx_eint0_irq_chip, handle_level_irq);
676 irq_set_chip_data(virq, ddata);
677 set_irq_flags(virq, IRQF_VALID);
678
679 return 0;
680}
681
682/*
683 * irq domain callbacks for external wakeup interrupt controller.
684 */
685static const struct irq_domain_ops s3c64xx_eint0_irqd_ops = {
686 .map = s3c64xx_eint0_irq_map,
687 .xlate = irq_domain_xlate_twocell,
688};
689
690/* list of external wakeup controllers supported */
691static const struct of_device_id s3c64xx_eint0_irq_ids[] = {
692 { .compatible = "samsung,s3c64xx-wakeup-eint", },
693 { }
694};
695
696/**
697 * s3c64xx_eint_eint0_init() - setup handling of external wakeup interrupts.
698 * @d: driver data of samsung pinctrl driver.
699 */
700static int s3c64xx_eint_eint0_init(struct samsung_pinctrl_drv_data *d)
701{
702 struct device *dev = d->dev;
703 struct device_node *eint0_np = NULL;
704 struct device_node *np;
705 struct samsung_pin_bank *bank;
706 struct s3c64xx_eint0_data *data;
707 unsigned int i;
708
709 for_each_child_of_node(dev->of_node, np) {
710 if (of_match_node(s3c64xx_eint0_irq_ids, np)) {
711 eint0_np = np;
712 break;
713 }
714 }
715 if (!eint0_np)
716 return -ENODEV;
717
718 data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
719 if (!data) {
720 dev_err(dev, "could not allocate memory for wkup eint data\n");
721 return -ENOMEM;
722 }
723 data->drvdata = d;
724
725 for (i = 0; i < NUM_EINT0_IRQ; ++i) {
726 unsigned int irq;
727
728 irq = irq_of_parse_and_map(eint0_np, i);
729 if (!irq) {
730 dev_err(dev, "failed to get wakeup EINT IRQ %d\n", i);
731 return -ENXIO;
732 }
733
734 irq_set_chained_handler(irq, s3c64xx_eint0_handlers[i]);
735 irq_set_handler_data(irq, data);
736 }
737
738 bank = d->ctrl->pin_banks;
739 for (i = 0; i < d->ctrl->nr_banks; ++i, ++bank) {
740 struct s3c64xx_eint0_domain_data *ddata;
741 unsigned int nr_eints;
742 unsigned int mask;
743 unsigned int irq;
744 unsigned int pin;
745
746 if (bank->eint_type != EINT_TYPE_WKUP)
747 continue;
748
749 mask = bank->eint_mask;
750 nr_eints = fls(mask);
751
752 ddata = devm_kzalloc(dev,
753 sizeof(*ddata) + nr_eints, GFP_KERNEL);
754 if (!ddata) {
755 dev_err(dev, "failed to allocate domain data\n");
756 return -ENOMEM;
757 }
758 ddata->bank = bank;
759
760 bank->irq_domain = irq_domain_add_linear(bank->of_node,
761 nr_eints, &s3c64xx_eint0_irqd_ops, ddata);
762 if (!bank->irq_domain) {
763 dev_err(dev, "wkup irq domain add failed\n");
764 return -ENXIO;
765 }
766
767 irq = bank->eint_offset;
768 mask = bank->eint_mask;
769 for (pin = 0; mask; ++pin, mask >>= 1) {
770 if (!(mask & 1))
771 continue;
772 data->domains[irq] = bank->irq_domain;
773 data->pins[irq] = pin;
774 ddata->eints[pin] = irq;
775 ++irq;
776 }
777 }
778
779 return 0;
780}
781
782/* pin banks of s3c64xx pin-controller 0 */
783static struct samsung_pin_bank s3c64xx_pin_banks0[] = {
784 PIN_BANK_4BIT_EINTG(8, 0x000, "gpa", 0),
785 PIN_BANK_4BIT_EINTG(7, 0x020, "gpb", 8),
786 PIN_BANK_4BIT_EINTG(8, 0x040, "gpc", 16),
787 PIN_BANK_4BIT_EINTG(5, 0x060, "gpd", 32),
788 PIN_BANK_4BIT(5, 0x080, "gpe"),
789 PIN_BANK_2BIT_EINTG(16, 0x0a0, "gpf", 48, 0x3fff),
790 PIN_BANK_4BIT_EINTG(7, 0x0c0, "gpg", 64),
791 PIN_BANK_4BIT2_EINTG(10, 0x0e0, "gph", 80),
792 PIN_BANK_2BIT(16, 0x100, "gpi"),
793 PIN_BANK_2BIT(12, 0x120, "gpj"),
794 PIN_BANK_4BIT2_ALIVE(16, 0x800, "gpk"),
795 PIN_BANK_4BIT2_EINTW(15, 0x810, "gpl", 16, 0x7f00),
796 PIN_BANK_4BIT_EINTW(6, 0x820, "gpm", 23, 0x1f),
797 PIN_BANK_2BIT_EINTW(16, 0x830, "gpn", 0),
798 PIN_BANK_2BIT_EINTG(16, 0x140, "gpo", 96, 0xffff),
799 PIN_BANK_2BIT_EINTG(15, 0x160, "gpp", 112, 0x7fff),
800 PIN_BANK_2BIT_EINTG(9, 0x180, "gpq", 128, 0x1ff),
801};
802
803/*
804 * Samsung pinctrl driver data for S3C64xx SoC. S3C64xx SoC includes
805 * one gpio/pin-mux/pinconfig controller.
806 */
807struct samsung_pin_ctrl s3c64xx_pin_ctrl[] = {
808 {
809 /* pin-controller instance 1 data */
810 .pin_banks = s3c64xx_pin_banks0,
811 .nr_banks = ARRAY_SIZE(s3c64xx_pin_banks0),
812 .eint_gpio_init = s3c64xx_eint_gpio_init,
813 .eint_wkup_init = s3c64xx_eint_eint0_init,
814 .label = "S3C64xx-GPIO",
815 },
816};
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c
index f206df175656..4f54faf2971f 100644
--- a/drivers/pinctrl/pinctrl-samsung.c
+++ b/drivers/pinctrl/pinctrl-samsung.c
@@ -27,6 +27,7 @@
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/irqdomain.h> 29#include <linux/irqdomain.h>
30#include <linux/spinlock.h>
30 31
31#include "core.h" 32#include "core.h"
32#include "pinctrl-samsung.h" 33#include "pinctrl-samsung.h"
@@ -214,7 +215,7 @@ static void samsung_dt_free_map(struct pinctrl_dev *pctldev,
214} 215}
215 216
216/* list of pinctrl callbacks for the pinctrl core */ 217/* list of pinctrl callbacks for the pinctrl core */
217static struct pinctrl_ops samsung_pctrl_ops = { 218static const struct pinctrl_ops samsung_pctrl_ops = {
218 .get_groups_count = samsung_get_group_count, 219 .get_groups_count = samsung_get_group_count,
219 .get_group_name = samsung_get_group_name, 220 .get_group_name = samsung_get_group_name,
220 .get_group_pins = samsung_get_group_pins, 221 .get_group_pins = samsung_get_group_pins,
@@ -274,10 +275,6 @@ static void pin_to_reg_bank(struct samsung_pinctrl_drv_data *drvdata,
274 *offset = pin - b->pin_base; 275 *offset = pin - b->pin_base;
275 if (bank) 276 if (bank)
276 *bank = b; 277 *bank = b;
277
278 /* some banks have two config registers in a single bank */
279 if (*offset * b->func_width > BITS_PER_LONG)
280 *reg += 4;
281} 278}
282 279
283/* enable or disable a pinmux function */ 280/* enable or disable a pinmux function */
@@ -289,6 +286,7 @@ static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector,
289 struct samsung_pin_bank *bank; 286 struct samsung_pin_bank *bank;
290 void __iomem *reg; 287 void __iomem *reg;
291 u32 mask, shift, data, pin_offset, cnt; 288 u32 mask, shift, data, pin_offset, cnt;
289 unsigned long flags;
292 290
293 drvdata = pinctrl_dev_get_drvdata(pctldev); 291 drvdata = pinctrl_dev_get_drvdata(pctldev);
294 pins = drvdata->pin_groups[group].pins; 292 pins = drvdata->pin_groups[group].pins;
@@ -298,16 +296,28 @@ static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector,
298 * pin function number in the config register. 296 * pin function number in the config register.
299 */ 297 */
300 for (cnt = 0; cnt < drvdata->pin_groups[group].num_pins; cnt++) { 298 for (cnt = 0; cnt < drvdata->pin_groups[group].num_pins; cnt++) {
299 struct samsung_pin_bank_type *type;
300
301 pin_to_reg_bank(drvdata, pins[cnt] - drvdata->ctrl->base, 301 pin_to_reg_bank(drvdata, pins[cnt] - drvdata->ctrl->base,
302 &reg, &pin_offset, &bank); 302 &reg, &pin_offset, &bank);
303 mask = (1 << bank->func_width) - 1; 303 type = bank->type;
304 shift = pin_offset * bank->func_width; 304 mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1;
305 shift = pin_offset * type->fld_width[PINCFG_TYPE_FUNC];
306 if (shift >= 32) {
307 /* Some banks have two config registers */
308 shift -= 32;
309 reg += 4;
310 }
311
312 spin_lock_irqsave(&bank->slock, flags);
305 313
306 data = readl(reg); 314 data = readl(reg + type->reg_offset[PINCFG_TYPE_FUNC]);
307 data &= ~(mask << shift); 315 data &= ~(mask << shift);
308 if (enable) 316 if (enable)
309 data |= drvdata->pin_groups[group].func << shift; 317 data |= drvdata->pin_groups[group].func << shift;
310 writel(data, reg); 318 writel(data, reg + type->reg_offset[PINCFG_TYPE_FUNC]);
319
320 spin_unlock_irqrestore(&bank->slock, flags);
311 } 321 }
312} 322}
313 323
@@ -334,30 +344,44 @@ static void samsung_pinmux_disable(struct pinctrl_dev *pctldev,
334static int samsung_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev, 344static int samsung_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev,
335 struct pinctrl_gpio_range *range, unsigned offset, bool input) 345 struct pinctrl_gpio_range *range, unsigned offset, bool input)
336{ 346{
347 struct samsung_pin_bank_type *type;
337 struct samsung_pin_bank *bank; 348 struct samsung_pin_bank *bank;
338 struct samsung_pinctrl_drv_data *drvdata; 349 struct samsung_pinctrl_drv_data *drvdata;
339 void __iomem *reg; 350 void __iomem *reg;
340 u32 data, pin_offset, mask, shift; 351 u32 data, pin_offset, mask, shift;
352 unsigned long flags;
341 353
342 bank = gc_to_pin_bank(range->gc); 354 bank = gc_to_pin_bank(range->gc);
355 type = bank->type;
343 drvdata = pinctrl_dev_get_drvdata(pctldev); 356 drvdata = pinctrl_dev_get_drvdata(pctldev);
344 357
345 pin_offset = offset - bank->pin_base; 358 pin_offset = offset - bank->pin_base;
346 reg = drvdata->virt_base + bank->pctl_offset; 359 reg = drvdata->virt_base + bank->pctl_offset +
360 type->reg_offset[PINCFG_TYPE_FUNC];
361
362 mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1;
363 shift = pin_offset * type->fld_width[PINCFG_TYPE_FUNC];
364 if (shift >= 32) {
365 /* Some banks have two config registers */
366 shift -= 32;
367 reg += 4;
368 }
347 369
348 mask = (1 << bank->func_width) - 1; 370 spin_lock_irqsave(&bank->slock, flags);
349 shift = pin_offset * bank->func_width;
350 371
351 data = readl(reg); 372 data = readl(reg);
352 data &= ~(mask << shift); 373 data &= ~(mask << shift);
353 if (!input) 374 if (!input)
354 data |= FUNC_OUTPUT << shift; 375 data |= FUNC_OUTPUT << shift;
355 writel(data, reg); 376 writel(data, reg);
377
378 spin_unlock_irqrestore(&bank->slock, flags);
379
356 return 0; 380 return 0;
357} 381}
358 382
359/* list of pinmux callbacks for the pinmux vertical in pinctrl core */ 383/* list of pinmux callbacks for the pinmux vertical in pinctrl core */
360static struct pinmux_ops samsung_pinmux_ops = { 384static const struct pinmux_ops samsung_pinmux_ops = {
361 .get_functions_count = samsung_get_functions_count, 385 .get_functions_count = samsung_get_functions_count,
362 .get_function_name = samsung_pinmux_get_fname, 386 .get_function_name = samsung_pinmux_get_fname,
363 .get_function_groups = samsung_pinmux_get_groups, 387 .get_function_groups = samsung_pinmux_get_groups,
@@ -371,40 +395,26 @@ static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin,
371 unsigned long *config, bool set) 395 unsigned long *config, bool set)
372{ 396{
373 struct samsung_pinctrl_drv_data *drvdata; 397 struct samsung_pinctrl_drv_data *drvdata;
398 struct samsung_pin_bank_type *type;
374 struct samsung_pin_bank *bank; 399 struct samsung_pin_bank *bank;
375 void __iomem *reg_base; 400 void __iomem *reg_base;
376 enum pincfg_type cfg_type = PINCFG_UNPACK_TYPE(*config); 401 enum pincfg_type cfg_type = PINCFG_UNPACK_TYPE(*config);
377 u32 data, width, pin_offset, mask, shift; 402 u32 data, width, pin_offset, mask, shift;
378 u32 cfg_value, cfg_reg; 403 u32 cfg_value, cfg_reg;
404 unsigned long flags;
379 405
380 drvdata = pinctrl_dev_get_drvdata(pctldev); 406 drvdata = pinctrl_dev_get_drvdata(pctldev);
381 pin_to_reg_bank(drvdata, pin - drvdata->ctrl->base, &reg_base, 407 pin_to_reg_bank(drvdata, pin - drvdata->ctrl->base, &reg_base,
382 &pin_offset, &bank); 408 &pin_offset, &bank);
409 type = bank->type;
383 410
384 switch (cfg_type) { 411 if (cfg_type >= PINCFG_TYPE_NUM || !type->fld_width[cfg_type])
385 case PINCFG_TYPE_PUD:
386 width = bank->pud_width;
387 cfg_reg = PUD_REG;
388 break;
389 case PINCFG_TYPE_DRV:
390 width = bank->drv_width;
391 cfg_reg = DRV_REG;
392 break;
393 case PINCFG_TYPE_CON_PDN:
394 width = bank->conpdn_width;
395 cfg_reg = CONPDN_REG;
396 break;
397 case PINCFG_TYPE_PUD_PDN:
398 width = bank->pudpdn_width;
399 cfg_reg = PUDPDN_REG;
400 break;
401 default:
402 WARN_ON(1);
403 return -EINVAL; 412 return -EINVAL;
404 }
405 413
406 if (!width) 414 width = type->fld_width[cfg_type];
407 return -EINVAL; 415 cfg_reg = type->reg_offset[cfg_type];
416
417 spin_lock_irqsave(&bank->slock, flags);
408 418
409 mask = (1 << width) - 1; 419 mask = (1 << width) - 1;
410 shift = pin_offset * width; 420 shift = pin_offset * width;
@@ -420,6 +430,9 @@ static int samsung_pinconf_rw(struct pinctrl_dev *pctldev, unsigned int pin,
420 data &= mask; 430 data &= mask;
421 *config = PINCFG_PACK(cfg_type, data); 431 *config = PINCFG_PACK(cfg_type, data);
422 } 432 }
433
434 spin_unlock_irqrestore(&bank->slock, flags);
435
423 return 0; 436 return 0;
424} 437}
425 438
@@ -468,7 +481,7 @@ static int samsung_pinconf_group_get(struct pinctrl_dev *pctldev,
468} 481}
469 482
470/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */ 483/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */
471static struct pinconf_ops samsung_pinconf_ops = { 484static const struct pinconf_ops samsung_pinconf_ops = {
472 .pin_config_get = samsung_pinconf_get, 485 .pin_config_get = samsung_pinconf_get,
473 .pin_config_set = samsung_pinconf_set, 486 .pin_config_set = samsung_pinconf_set,
474 .pin_config_group_get = samsung_pinconf_group_get, 487 .pin_config_group_get = samsung_pinconf_group_get,
@@ -479,16 +492,22 @@ static struct pinconf_ops samsung_pinconf_ops = {
479static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value) 492static void samsung_gpio_set(struct gpio_chip *gc, unsigned offset, int value)
480{ 493{
481 struct samsung_pin_bank *bank = gc_to_pin_bank(gc); 494 struct samsung_pin_bank *bank = gc_to_pin_bank(gc);
495 struct samsung_pin_bank_type *type = bank->type;
496 unsigned long flags;
482 void __iomem *reg; 497 void __iomem *reg;
483 u32 data; 498 u32 data;
484 499
485 reg = bank->drvdata->virt_base + bank->pctl_offset; 500 reg = bank->drvdata->virt_base + bank->pctl_offset;
486 501
487 data = readl(reg + DAT_REG); 502 spin_lock_irqsave(&bank->slock, flags);
503
504 data = readl(reg + type->reg_offset[PINCFG_TYPE_DAT]);
488 data &= ~(1 << offset); 505 data &= ~(1 << offset);
489 if (value) 506 if (value)
490 data |= 1 << offset; 507 data |= 1 << offset;
491 writel(data, reg + DAT_REG); 508 writel(data, reg + type->reg_offset[PINCFG_TYPE_DAT]);
509
510 spin_unlock_irqrestore(&bank->slock, flags);
492} 511}
493 512
494/* gpiolib gpio_get callback function */ 513/* gpiolib gpio_get callback function */
@@ -497,10 +516,11 @@ static int samsung_gpio_get(struct gpio_chip *gc, unsigned offset)
497 void __iomem *reg; 516 void __iomem *reg;
498 u32 data; 517 u32 data;
499 struct samsung_pin_bank *bank = gc_to_pin_bank(gc); 518 struct samsung_pin_bank *bank = gc_to_pin_bank(gc);
519 struct samsung_pin_bank_type *type = bank->type;
500 520
501 reg = bank->drvdata->virt_base + bank->pctl_offset; 521 reg = bank->drvdata->virt_base + bank->pctl_offset;
502 522
503 data = readl(reg + DAT_REG); 523 data = readl(reg + type->reg_offset[PINCFG_TYPE_DAT]);
504 data >>= offset; 524 data >>= offset;
505 data &= 1; 525 data &= 1;
506 return data; 526 return data;
@@ -859,6 +879,7 @@ static struct samsung_pin_ctrl *samsung_pinctrl_get_soc_data(
859 879
860 bank = ctrl->pin_banks; 880 bank = ctrl->pin_banks;
861 for (i = 0; i < ctrl->nr_banks; ++i, ++bank) { 881 for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
882 spin_lock_init(&bank->slock);
862 bank->drvdata = d; 883 bank->drvdata = d;
863 bank->pin_base = ctrl->nr_pins; 884 bank->pin_base = ctrl->nr_pins;
864 ctrl->nr_pins += bank->nr_pins; 885 ctrl->nr_pins += bank->nr_pins;
@@ -944,10 +965,16 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
944} 965}
945 966
946static const struct of_device_id samsung_pinctrl_dt_match[] = { 967static const struct of_device_id samsung_pinctrl_dt_match[] = {
968#ifdef CONFIG_PINCTRL_EXYNOS
947 { .compatible = "samsung,exynos4210-pinctrl", 969 { .compatible = "samsung,exynos4210-pinctrl",
948 .data = (void *)exynos4210_pin_ctrl }, 970 .data = (void *)exynos4210_pin_ctrl },
949 { .compatible = "samsung,exynos4x12-pinctrl", 971 { .compatible = "samsung,exynos4x12-pinctrl",
950 .data = (void *)exynos4x12_pin_ctrl }, 972 .data = (void *)exynos4x12_pin_ctrl },
973#endif
974#ifdef CONFIG_PINCTRL_S3C64XX
975 { .compatible = "samsung,s3c64xx-pinctrl",
976 .data = s3c64xx_pin_ctrl },
977#endif
951 {}, 978 {},
952}; 979};
953MODULE_DEVICE_TABLE(of, samsung_pinctrl_dt_match); 980MODULE_DEVICE_TABLE(of, samsung_pinctrl_dt_match);
diff --git a/drivers/pinctrl/pinctrl-samsung.h b/drivers/pinctrl/pinctrl-samsung.h
index e2d4e67f7e88..45f27b41e30c 100644
--- a/drivers/pinctrl/pinctrl-samsung.h
+++ b/drivers/pinctrl/pinctrl-samsung.h
@@ -25,28 +25,27 @@
25 25
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27 27
28/* register offsets within a pin bank */
29#define DAT_REG 0x4
30#define PUD_REG 0x8
31#define DRV_REG 0xC
32#define CONPDN_REG 0x10
33#define PUDPDN_REG 0x14
34
35/* pinmux function number for pin as gpio output line */ 28/* pinmux function number for pin as gpio output line */
36#define FUNC_OUTPUT 0x1 29#define FUNC_OUTPUT 0x1
37 30
38/** 31/**
39 * enum pincfg_type - possible pin configuration types supported. 32 * enum pincfg_type - possible pin configuration types supported.
33 * @PINCFG_TYPE_FUNC: Function configuration.
34 * @PINCFG_TYPE_DAT: Pin value configuration.
40 * @PINCFG_TYPE_PUD: Pull up/down configuration. 35 * @PINCFG_TYPE_PUD: Pull up/down configuration.
41 * @PINCFG_TYPE_DRV: Drive strength configuration. 36 * @PINCFG_TYPE_DRV: Drive strength configuration.
42 * @PINCFG_TYPE_CON_PDN: Pin function in power down mode. 37 * @PINCFG_TYPE_CON_PDN: Pin function in power down mode.
43 * @PINCFG_TYPE_PUD_PDN: Pull up/down configuration in power down mode. 38 * @PINCFG_TYPE_PUD_PDN: Pull up/down configuration in power down mode.
44 */ 39 */
45enum pincfg_type { 40enum pincfg_type {
41 PINCFG_TYPE_FUNC,
42 PINCFG_TYPE_DAT,
46 PINCFG_TYPE_PUD, 43 PINCFG_TYPE_PUD,
47 PINCFG_TYPE_DRV, 44 PINCFG_TYPE_DRV,
48 PINCFG_TYPE_CON_PDN, 45 PINCFG_TYPE_CON_PDN,
49 PINCFG_TYPE_PUD_PDN, 46 PINCFG_TYPE_PUD_PDN,
47
48 PINCFG_TYPE_NUM
50}; 49};
51 50
52/* 51/*
@@ -103,33 +102,40 @@ enum eint_type {
103struct samsung_pinctrl_drv_data; 102struct samsung_pinctrl_drv_data;
104 103
105/** 104/**
105 * struct samsung_pin_bank_type: pin bank type description
106 * @fld_width: widths of configuration bitfields (0 if unavailable)
107 * @reg_offset: offsets of configuration registers (don't care of width is 0)
108 */
109struct samsung_pin_bank_type {
110 u8 fld_width[PINCFG_TYPE_NUM];
111 u8 reg_offset[PINCFG_TYPE_NUM];
112};
113
114/**
106 * struct samsung_pin_bank: represent a controller pin-bank. 115 * struct samsung_pin_bank: represent a controller pin-bank.
116 * @type: type of the bank (register offsets and bitfield widths)
107 * @pctl_offset: starting offset of the pin-bank registers. 117 * @pctl_offset: starting offset of the pin-bank registers.
108 * @pin_base: starting pin number of the bank. 118 * @pin_base: starting pin number of the bank.
109 * @nr_pins: number of pins included in this bank. 119 * @nr_pins: number of pins included in this bank.
110 * @func_width: width of the function selector bit field. 120 * @eint_func: function to set in CON register to configure pin as EINT.
111 * @pud_width: width of the pin pull up/down selector bit field.
112 * @drv_width: width of the pin driver strength selector bit field.
113 * @conpdn_width: width of the sleep mode function selector bin field.
114 * @pudpdn_width: width of the sleep mode pull up/down selector bit field.
115 * @eint_type: type of the external interrupt supported by the bank. 121 * @eint_type: type of the external interrupt supported by the bank.
122 * @eint_mask: bit mask of pins which support EINT function.
116 * @name: name to be prefixed for each pin in this pin bank. 123 * @name: name to be prefixed for each pin in this pin bank.
117 * @of_node: OF node of the bank. 124 * @of_node: OF node of the bank.
118 * @drvdata: link to controller driver data 125 * @drvdata: link to controller driver data
119 * @irq_domain: IRQ domain of the bank. 126 * @irq_domain: IRQ domain of the bank.
120 * @gpio_chip: GPIO chip of the bank. 127 * @gpio_chip: GPIO chip of the bank.
121 * @grange: linux gpio pin range supported by this bank. 128 * @grange: linux gpio pin range supported by this bank.
129 * @slock: spinlock protecting bank registers
122 */ 130 */
123struct samsung_pin_bank { 131struct samsung_pin_bank {
132 struct samsung_pin_bank_type *type;
124 u32 pctl_offset; 133 u32 pctl_offset;
125 u32 pin_base; 134 u32 pin_base;
126 u8 nr_pins; 135 u8 nr_pins;
127 u8 func_width; 136 u8 eint_func;
128 u8 pud_width;
129 u8 drv_width;
130 u8 conpdn_width;
131 u8 pudpdn_width;
132 enum eint_type eint_type; 137 enum eint_type eint_type;
138 u32 eint_mask;
133 u32 eint_offset; 139 u32 eint_offset;
134 char *name; 140 char *name;
135 struct device_node *of_node; 141 struct device_node *of_node;
@@ -137,6 +143,7 @@ struct samsung_pin_bank {
137 struct irq_domain *irq_domain; 143 struct irq_domain *irq_domain;
138 struct gpio_chip gpio_chip; 144 struct gpio_chip gpio_chip;
139 struct pinctrl_gpio_range grange; 145 struct pinctrl_gpio_range grange;
146 spinlock_t slock;
140}; 147};
141 148
142/** 149/**
@@ -237,5 +244,6 @@ struct samsung_pmx_func {
237/* list of all exported SoC specific data */ 244/* list of all exported SoC specific data */
238extern struct samsung_pin_ctrl exynos4210_pin_ctrl[]; 245extern struct samsung_pin_ctrl exynos4210_pin_ctrl[];
239extern struct samsung_pin_ctrl exynos4x12_pin_ctrl[]; 246extern struct samsung_pin_ctrl exynos4x12_pin_ctrl[];
247extern struct samsung_pin_ctrl s3c64xx_pin_ctrl[];
240 248
241#endif /* __PINCTRL_SAMSUNG_H */ 249#endif /* __PINCTRL_SAMSUNG_H */
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 5c32e880bcb2..5f2d2bfd356e 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -22,8 +22,10 @@
22 22
23#include <linux/pinctrl/pinctrl.h> 23#include <linux/pinctrl/pinctrl.h>
24#include <linux/pinctrl/pinmux.h> 24#include <linux/pinctrl/pinmux.h>
25#include <linux/pinctrl/pinconf-generic.h>
25 26
26#include "core.h" 27#include "core.h"
28#include "pinconf.h"
27 29
28#define DRIVER_NAME "pinctrl-single" 30#define DRIVER_NAME "pinctrl-single"
29#define PCS_MUX_PINS_NAME "pinctrl-single,pins" 31#define PCS_MUX_PINS_NAME "pinctrl-single,pins"
@@ -59,6 +61,33 @@ struct pcs_func_vals {
59}; 61};
60 62
61/** 63/**
64 * struct pcs_conf_vals - pinconf parameter, pinconf register offset
65 * and value, enable, disable, mask
66 * @param: config parameter
67 * @val: user input bits in the pinconf register
68 * @enable: enable bits in the pinconf register
69 * @disable: disable bits in the pinconf register
70 * @mask: mask bits in the register value
71 */
72struct pcs_conf_vals {
73 enum pin_config_param param;
74 unsigned val;
75 unsigned enable;
76 unsigned disable;
77 unsigned mask;
78};
79
80/**
81 * struct pcs_conf_type - pinconf property name, pinconf param pair
82 * @name: property name in DTS file
83 * @param: config parameter
84 */
85struct pcs_conf_type {
86 const char *name;
87 enum pin_config_param param;
88};
89
90/**
62 * struct pcs_function - pinctrl function 91 * struct pcs_function - pinctrl function
63 * @name: pinctrl function name 92 * @name: pinctrl function name
64 * @vals: register and vals array 93 * @vals: register and vals array
@@ -73,6 +102,22 @@ struct pcs_function {
73 unsigned nvals; 102 unsigned nvals;
74 const char **pgnames; 103 const char **pgnames;
75 int npgnames; 104 int npgnames;
105 struct pcs_conf_vals *conf;
106 int nconfs;
107 struct list_head node;
108};
109
110/**
111 * struct pcs_gpiofunc_range - pin ranges with same mux value of gpio function
112 * @offset: offset base of pins
113 * @npins: number pins with the same mux value of gpio function
114 * @gpiofunc: mux value of gpio function
115 * @node: list node
116 */
117struct pcs_gpiofunc_range {
118 unsigned offset;
119 unsigned npins;
120 unsigned gpiofunc;
76 struct list_head node; 121 struct list_head node;
77}; 122};
78 123
@@ -117,12 +162,14 @@ struct pcs_name {
117 * @fshift: function register shift 162 * @fshift: function register shift
118 * @foff: value to turn mux off 163 * @foff: value to turn mux off
119 * @fmax: max number of functions in fmask 164 * @fmax: max number of functions in fmask
165 * @is_pinconf: whether supports pinconf
120 * @names: array of register names for pins 166 * @names: array of register names for pins
121 * @pins: physical pins on the SoC 167 * @pins: physical pins on the SoC
122 * @pgtree: pingroup index radix tree 168 * @pgtree: pingroup index radix tree
123 * @ftree: function index radix tree 169 * @ftree: function index radix tree
124 * @pingroups: list of pingroups 170 * @pingroups: list of pingroups
125 * @functions: list of functions 171 * @functions: list of functions
172 * @gpiofuncs: list of gpio functions
126 * @ngroups: number of pingroups 173 * @ngroups: number of pingroups
127 * @nfuncs: number of functions 174 * @nfuncs: number of functions
128 * @desc: pin controller descriptor 175 * @desc: pin controller descriptor
@@ -142,12 +189,14 @@ struct pcs_device {
142 unsigned foff; 189 unsigned foff;
143 unsigned fmax; 190 unsigned fmax;
144 bool bits_per_mux; 191 bool bits_per_mux;
192 bool is_pinconf;
145 struct pcs_name *names; 193 struct pcs_name *names;
146 struct pcs_data pins; 194 struct pcs_data pins;
147 struct radix_tree_root pgtree; 195 struct radix_tree_root pgtree;
148 struct radix_tree_root ftree; 196 struct radix_tree_root ftree;
149 struct list_head pingroups; 197 struct list_head pingroups;
150 struct list_head functions; 198 struct list_head functions;
199 struct list_head gpiofuncs;
151 unsigned ngroups; 200 unsigned ngroups;
152 unsigned nfuncs; 201 unsigned nfuncs;
153 struct pinctrl_desc desc; 202 struct pinctrl_desc desc;
@@ -155,6 +204,16 @@ struct pcs_device {
155 void (*write)(unsigned val, void __iomem *reg); 204 void (*write)(unsigned val, void __iomem *reg);
156}; 205};
157 206
207static int pcs_pinconf_get(struct pinctrl_dev *pctldev, unsigned pin,
208 unsigned long *config);
209static int pcs_pinconf_set(struct pinctrl_dev *pctldev, unsigned pin,
210 unsigned long config);
211
212static enum pin_config_param pcs_bias[] = {
213 PIN_CONFIG_BIAS_PULL_DOWN,
214 PIN_CONFIG_BIAS_PULL_UP,
215};
216
158/* 217/*
159 * REVISIT: Reads and writes could eventually use regmap or something 218 * REVISIT: Reads and writes could eventually use regmap or something
160 * generic. But at least on omaps, some mux registers are performance 219 * generic. But at least on omaps, some mux registers are performance
@@ -270,7 +329,7 @@ static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev,
270 struct device_node *np_config, 329 struct device_node *np_config,
271 struct pinctrl_map **map, unsigned *num_maps); 330 struct pinctrl_map **map, unsigned *num_maps);
272 331
273static struct pinctrl_ops pcs_pinctrl_ops = { 332static const struct pinctrl_ops pcs_pinctrl_ops = {
274 .get_groups_count = pcs_get_groups_count, 333 .get_groups_count = pcs_get_groups_count,
275 .get_group_name = pcs_get_group_name, 334 .get_group_name = pcs_get_group_name,
276 .get_group_pins = pcs_get_group_pins, 335 .get_group_pins = pcs_get_group_pins,
@@ -326,6 +385,28 @@ static int pcs_get_function_groups(struct pinctrl_dev *pctldev,
326 return 0; 385 return 0;
327} 386}
328 387
388static int pcs_get_function(struct pinctrl_dev *pctldev, unsigned pin,
389 struct pcs_function **func)
390{
391 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
392 struct pin_desc *pdesc = pin_desc_get(pctldev, pin);
393 const struct pinctrl_setting_mux *setting;
394 unsigned fselector;
395
396 /* If pin is not described in DTS & enabled, mux_setting is NULL. */
397 setting = pdesc->mux_setting;
398 if (!setting)
399 return -ENOTSUPP;
400 fselector = setting->func;
401 *func = radix_tree_lookup(&pcs->ftree, fselector);
402 if (!(*func)) {
403 dev_err(pcs->dev, "%s could not find function%i\n",
404 __func__, fselector);
405 return -ENOTSUPP;
406 }
407 return 0;
408}
409
329static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector, 410static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector,
330 unsigned group) 411 unsigned group)
331{ 412{
@@ -334,6 +415,9 @@ static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector,
334 int i; 415 int i;
335 416
336 pcs = pinctrl_dev_get_drvdata(pctldev); 417 pcs = pinctrl_dev_get_drvdata(pctldev);
418 /* If function mask is null, needn't enable it. */
419 if (!pcs->fmask)
420 return 0;
337 func = radix_tree_lookup(&pcs->ftree, fselector); 421 func = radix_tree_lookup(&pcs->ftree, fselector);
338 if (!func) 422 if (!func)
339 return -EINVAL; 423 return -EINVAL;
@@ -368,6 +452,10 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
368 int i; 452 int i;
369 453
370 pcs = pinctrl_dev_get_drvdata(pctldev); 454 pcs = pinctrl_dev_get_drvdata(pctldev);
455 /* If function mask is null, needn't disable it. */
456 if (!pcs->fmask)
457 return;
458
371 func = radix_tree_lookup(&pcs->ftree, fselector); 459 func = radix_tree_lookup(&pcs->ftree, fselector);
372 if (!func) { 460 if (!func) {
373 dev_err(pcs->dev, "%s could not find function%i\n", 461 dev_err(pcs->dev, "%s could not find function%i\n",
@@ -403,12 +491,33 @@ static void pcs_disable(struct pinctrl_dev *pctldev, unsigned fselector,
403} 491}
404 492
405static int pcs_request_gpio(struct pinctrl_dev *pctldev, 493static int pcs_request_gpio(struct pinctrl_dev *pctldev,
406 struct pinctrl_gpio_range *range, unsigned offset) 494 struct pinctrl_gpio_range *range, unsigned pin)
407{ 495{
408 return -ENOTSUPP; 496 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
497 struct pcs_gpiofunc_range *frange = NULL;
498 struct list_head *pos, *tmp;
499 int mux_bytes = 0;
500 unsigned data;
501
502 /* If function mask is null, return directly. */
503 if (!pcs->fmask)
504 return -ENOTSUPP;
505
506 list_for_each_safe(pos, tmp, &pcs->gpiofuncs) {
507 frange = list_entry(pos, struct pcs_gpiofunc_range, node);
508 if (pin >= frange->offset + frange->npins
509 || pin < frange->offset)
510 continue;
511 mux_bytes = pcs->width / BITS_PER_BYTE;
512 data = pcs->read(pcs->base + pin * mux_bytes) & ~pcs->fmask;
513 data |= frange->gpiofunc;
514 pcs->write(data, pcs->base + pin * mux_bytes);
515 break;
516 }
517 return 0;
409} 518}
410 519
411static struct pinmux_ops pcs_pinmux_ops = { 520static const struct pinmux_ops pcs_pinmux_ops = {
412 .get_functions_count = pcs_get_functions_count, 521 .get_functions_count = pcs_get_functions_count,
413 .get_function_name = pcs_get_function_name, 522 .get_function_name = pcs_get_function_name,
414 .get_function_groups = pcs_get_function_groups, 523 .get_function_groups = pcs_get_function_groups,
@@ -417,32 +526,190 @@ static struct pinmux_ops pcs_pinmux_ops = {
417 .gpio_request_enable = pcs_request_gpio, 526 .gpio_request_enable = pcs_request_gpio,
418}; 527};
419 528
529/* Clear BIAS value */
530static void pcs_pinconf_clear_bias(struct pinctrl_dev *pctldev, unsigned pin)
531{
532 unsigned long config;
533 int i;
534 for (i = 0; i < ARRAY_SIZE(pcs_bias); i++) {
535 config = pinconf_to_config_packed(pcs_bias[i], 0);
536 pcs_pinconf_set(pctldev, pin, config);
537 }
538}
539
540/*
541 * Check whether PIN_CONFIG_BIAS_DISABLE is valid.
542 * It's depend on that PULL_DOWN & PULL_UP configs are all invalid.
543 */
544static bool pcs_pinconf_bias_disable(struct pinctrl_dev *pctldev, unsigned pin)
545{
546 unsigned long config;
547 int i;
548
549 for (i = 0; i < ARRAY_SIZE(pcs_bias); i++) {
550 config = pinconf_to_config_packed(pcs_bias[i], 0);
551 if (!pcs_pinconf_get(pctldev, pin, &config))
552 goto out;
553 }
554 return true;
555out:
556 return false;
557}
558
420static int pcs_pinconf_get(struct pinctrl_dev *pctldev, 559static int pcs_pinconf_get(struct pinctrl_dev *pctldev,
421 unsigned pin, unsigned long *config) 560 unsigned pin, unsigned long *config)
422{ 561{
562 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
563 struct pcs_function *func;
564 enum pin_config_param param;
565 unsigned offset = 0, data = 0, i, j, ret;
566
567 ret = pcs_get_function(pctldev, pin, &func);
568 if (ret)
569 return ret;
570
571 for (i = 0; i < func->nconfs; i++) {
572 param = pinconf_to_config_param(*config);
573 if (param == PIN_CONFIG_BIAS_DISABLE) {
574 if (pcs_pinconf_bias_disable(pctldev, pin)) {
575 *config = 0;
576 return 0;
577 } else {
578 return -ENOTSUPP;
579 }
580 } else if (param != func->conf[i].param) {
581 continue;
582 }
583
584 offset = pin * (pcs->width / BITS_PER_BYTE);
585 data = pcs->read(pcs->base + offset) & func->conf[i].mask;
586 switch (func->conf[i].param) {
587 /* 4 parameters */
588 case PIN_CONFIG_BIAS_PULL_DOWN:
589 case PIN_CONFIG_BIAS_PULL_UP:
590 case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
591 if ((data != func->conf[i].enable) ||
592 (data == func->conf[i].disable))
593 return -ENOTSUPP;
594 *config = 0;
595 break;
596 /* 2 parameters */
597 case PIN_CONFIG_INPUT_SCHMITT:
598 for (j = 0; j < func->nconfs; j++) {
599 switch (func->conf[j].param) {
600 case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
601 if (data != func->conf[j].enable)
602 return -ENOTSUPP;
603 break;
604 default:
605 break;
606 }
607 }
608 *config = data;
609 break;
610 case PIN_CONFIG_DRIVE_STRENGTH:
611 case PIN_CONFIG_SLEW_RATE:
612 default:
613 *config = data;
614 break;
615 }
616 return 0;
617 }
423 return -ENOTSUPP; 618 return -ENOTSUPP;
424} 619}
425 620
426static int pcs_pinconf_set(struct pinctrl_dev *pctldev, 621static int pcs_pinconf_set(struct pinctrl_dev *pctldev,
427 unsigned pin, unsigned long config) 622 unsigned pin, unsigned long config)
428{ 623{
624 struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
625 struct pcs_function *func;
626 unsigned offset = 0, shift = 0, i, data, ret;
627 u16 arg;
628
629 ret = pcs_get_function(pctldev, pin, &func);
630 if (ret)
631 return ret;
632
633 for (i = 0; i < func->nconfs; i++) {
634 if (pinconf_to_config_param(config) == func->conf[i].param) {
635 offset = pin * (pcs->width / BITS_PER_BYTE);
636 data = pcs->read(pcs->base + offset);
637 arg = pinconf_to_config_argument(config);
638 switch (func->conf[i].param) {
639 /* 2 parameters */
640 case PIN_CONFIG_INPUT_SCHMITT:
641 case PIN_CONFIG_DRIVE_STRENGTH:
642 case PIN_CONFIG_SLEW_RATE:
643 shift = ffs(func->conf[i].mask) - 1;
644 data &= ~func->conf[i].mask;
645 data |= (arg << shift) & func->conf[i].mask;
646 break;
647 /* 4 parameters */
648 case PIN_CONFIG_BIAS_DISABLE:
649 pcs_pinconf_clear_bias(pctldev, pin);
650 break;
651 case PIN_CONFIG_BIAS_PULL_DOWN:
652 case PIN_CONFIG_BIAS_PULL_UP:
653 if (arg)
654 pcs_pinconf_clear_bias(pctldev, pin);
655 /* fall through */
656 case PIN_CONFIG_INPUT_SCHMITT_ENABLE:
657 data &= ~func->conf[i].mask;
658 if (arg)
659 data |= func->conf[i].enable;
660 else
661 data |= func->conf[i].disable;
662 break;
663 default:
664 return -ENOTSUPP;
665 }
666 pcs->write(data, pcs->base + offset);
667 return 0;
668 }
669 }
429 return -ENOTSUPP; 670 return -ENOTSUPP;
430} 671}
431 672
432static int pcs_pinconf_group_get(struct pinctrl_dev *pctldev, 673static int pcs_pinconf_group_get(struct pinctrl_dev *pctldev,
433 unsigned group, unsigned long *config) 674 unsigned group, unsigned long *config)
434{ 675{
435 return -ENOTSUPP; 676 const unsigned *pins;
677 unsigned npins, old = 0;
678 int i, ret;
679
680 ret = pcs_get_group_pins(pctldev, group, &pins, &npins);
681 if (ret)
682 return ret;
683 for (i = 0; i < npins; i++) {
684 if (pcs_pinconf_get(pctldev, pins[i], config))
685 return -ENOTSUPP;
686 /* configs do not match between two pins */
687 if (i && (old != *config))
688 return -ENOTSUPP;
689 old = *config;
690 }
691 return 0;
436} 692}
437 693
438static int pcs_pinconf_group_set(struct pinctrl_dev *pctldev, 694static int pcs_pinconf_group_set(struct pinctrl_dev *pctldev,
439 unsigned group, unsigned long config) 695 unsigned group, unsigned long config)
440{ 696{
441 return -ENOTSUPP; 697 const unsigned *pins;
698 unsigned npins;
699 int i, ret;
700
701 ret = pcs_get_group_pins(pctldev, group, &pins, &npins);
702 if (ret)
703 return ret;
704 for (i = 0; i < npins; i++) {
705 if (pcs_pinconf_set(pctldev, pins[i], config))
706 return -ENOTSUPP;
707 }
708 return 0;
442} 709}
443 710
444static void pcs_pinconf_dbg_show(struct pinctrl_dev *pctldev, 711static void pcs_pinconf_dbg_show(struct pinctrl_dev *pctldev,
445 struct seq_file *s, unsigned offset) 712 struct seq_file *s, unsigned pin)
446{ 713{
447} 714}
448 715
@@ -451,13 +718,22 @@ static void pcs_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
451{ 718{
452} 719}
453 720
454static struct pinconf_ops pcs_pinconf_ops = { 721static void pcs_pinconf_config_dbg_show(struct pinctrl_dev *pctldev,
722 struct seq_file *s,
723 unsigned long config)
724{
725 pinconf_generic_dump_config(pctldev, s, config);
726}
727
728static const struct pinconf_ops pcs_pinconf_ops = {
455 .pin_config_get = pcs_pinconf_get, 729 .pin_config_get = pcs_pinconf_get,
456 .pin_config_set = pcs_pinconf_set, 730 .pin_config_set = pcs_pinconf_set,
457 .pin_config_group_get = pcs_pinconf_group_get, 731 .pin_config_group_get = pcs_pinconf_group_get,
458 .pin_config_group_set = pcs_pinconf_group_set, 732 .pin_config_group_set = pcs_pinconf_group_set,
459 .pin_config_dbg_show = pcs_pinconf_dbg_show, 733 .pin_config_dbg_show = pcs_pinconf_dbg_show,
460 .pin_config_group_dbg_show = pcs_pinconf_group_dbg_show, 734 .pin_config_group_dbg_show = pcs_pinconf_group_dbg_show,
735 .pin_config_config_dbg_show = pcs_pinconf_config_dbg_show,
736 .is_generic = true,
461}; 737};
462 738
463/** 739/**
@@ -648,11 +924,158 @@ static int pcs_get_pin_by_offset(struct pcs_device *pcs, unsigned offset)
648 return index; 924 return index;
649} 925}
650 926
927/*
928 * check whether data matches enable bits or disable bits
929 * Return value: 1 for matching enable bits, 0 for matching disable bits,
930 * and negative value for matching failure.
931 */
932static int pcs_config_match(unsigned data, unsigned enable, unsigned disable)
933{
934 int ret = -EINVAL;
935
936 if (data == enable)
937 ret = 1;
938 else if (data == disable)
939 ret = 0;
940 return ret;
941}
942
943static void add_config(struct pcs_conf_vals **conf, enum pin_config_param param,
944 unsigned value, unsigned enable, unsigned disable,
945 unsigned mask)
946{
947 (*conf)->param = param;
948 (*conf)->val = value;
949 (*conf)->enable = enable;
950 (*conf)->disable = disable;
951 (*conf)->mask = mask;
952 (*conf)++;
953}
954
955static void add_setting(unsigned long **setting, enum pin_config_param param,
956 unsigned arg)
957{
958 **setting = pinconf_to_config_packed(param, arg);
959 (*setting)++;
960}
961
962/* add pinconf setting with 2 parameters */
963static void pcs_add_conf2(struct pcs_device *pcs, struct device_node *np,
964 const char *name, enum pin_config_param param,
965 struct pcs_conf_vals **conf, unsigned long **settings)
966{
967 unsigned value[2], shift;
968 int ret;
969
970 ret = of_property_read_u32_array(np, name, value, 2);
971 if (ret)
972 return;
973 /* set value & mask */
974 value[0] &= value[1];
975 shift = ffs(value[1]) - 1;
976 /* skip enable & disable */
977 add_config(conf, param, value[0], 0, 0, value[1]);
978 add_setting(settings, param, value[0] >> shift);
979}
980
981/* add pinconf setting with 4 parameters */
982static void pcs_add_conf4(struct pcs_device *pcs, struct device_node *np,
983 const char *name, enum pin_config_param param,
984 struct pcs_conf_vals **conf, unsigned long **settings)
985{
986 unsigned value[4];
987 int ret;
988
989 /* value to set, enable, disable, mask */
990 ret = of_property_read_u32_array(np, name, value, 4);
991 if (ret)
992 return;
993 if (!value[3]) {
994 dev_err(pcs->dev, "mask field of the property can't be 0\n");
995 return;
996 }
997 value[0] &= value[3];
998 value[1] &= value[3];
999 value[2] &= value[3];
1000 ret = pcs_config_match(value[0], value[1], value[2]);
1001 if (ret < 0)
1002 dev_dbg(pcs->dev, "failed to match enable or disable bits\n");
1003 add_config(conf, param, value[0], value[1], value[2], value[3]);
1004 add_setting(settings, param, ret);
1005}
1006
1007static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np,
1008 struct pcs_function *func,
1009 struct pinctrl_map **map)
1010
1011{
1012 struct pinctrl_map *m = *map;
1013 int i = 0, nconfs = 0;
1014 unsigned long *settings = NULL, *s = NULL;
1015 struct pcs_conf_vals *conf = NULL;
1016 struct pcs_conf_type prop2[] = {
1017 { "pinctrl-single,drive-strength", PIN_CONFIG_DRIVE_STRENGTH, },
1018 { "pinctrl-single,slew-rate", PIN_CONFIG_SLEW_RATE, },
1019 { "pinctrl-single,input-schmitt", PIN_CONFIG_INPUT_SCHMITT, },
1020 };
1021 struct pcs_conf_type prop4[] = {
1022 { "pinctrl-single,bias-pullup", PIN_CONFIG_BIAS_PULL_UP, },
1023 { "pinctrl-single,bias-pulldown", PIN_CONFIG_BIAS_PULL_DOWN, },
1024 { "pinctrl-single,input-schmitt-enable",
1025 PIN_CONFIG_INPUT_SCHMITT_ENABLE, },
1026 };
1027
1028 /* If pinconf isn't supported, don't parse properties in below. */
1029 if (!pcs->is_pinconf)
1030 return 0;
1031
1032 /* cacluate how much properties are supported in current node */
1033 for (i = 0; i < ARRAY_SIZE(prop2); i++) {
1034 if (of_find_property(np, prop2[i].name, NULL))
1035 nconfs++;
1036 }
1037 for (i = 0; i < ARRAY_SIZE(prop4); i++) {
1038 if (of_find_property(np, prop4[i].name, NULL))
1039 nconfs++;
1040 }
1041 if (!nconfs)
1042 return 0;
1043
1044 func->conf = devm_kzalloc(pcs->dev,
1045 sizeof(struct pcs_conf_vals) * nconfs,
1046 GFP_KERNEL);
1047 if (!func->conf)
1048 return -ENOMEM;
1049 func->nconfs = nconfs;
1050 conf = &(func->conf[0]);
1051 m++;
1052 settings = devm_kzalloc(pcs->dev, sizeof(unsigned long) * nconfs,
1053 GFP_KERNEL);
1054 if (!settings)
1055 return -ENOMEM;
1056 s = &settings[0];
1057
1058 for (i = 0; i < ARRAY_SIZE(prop2); i++)
1059 pcs_add_conf2(pcs, np, prop2[i].name, prop2[i].param,
1060 &conf, &s);
1061 for (i = 0; i < ARRAY_SIZE(prop4); i++)
1062 pcs_add_conf4(pcs, np, prop4[i].name, prop4[i].param,
1063 &conf, &s);
1064 m->type = PIN_MAP_TYPE_CONFIGS_GROUP;
1065 m->data.configs.group_or_pin = np->name;
1066 m->data.configs.configs = settings;
1067 m->data.configs.num_configs = nconfs;
1068 return 0;
1069}
1070
1071static void pcs_free_pingroups(struct pcs_device *pcs);
1072
651/** 1073/**
652 * smux_parse_one_pinctrl_entry() - parses a device tree mux entry 1074 * smux_parse_one_pinctrl_entry() - parses a device tree mux entry
653 * @pcs: pinctrl driver instance 1075 * @pcs: pinctrl driver instance
654 * @np: device node of the mux entry 1076 * @np: device node of the mux entry
655 * @map: map entry 1077 * @map: map entry
1078 * @num_maps: number of map
656 * @pgnames: pingroup names 1079 * @pgnames: pingroup names
657 * 1080 *
658 * Note that this binding currently supports only sets of one register + value. 1081 * Note that this binding currently supports only sets of one register + value.
@@ -669,6 +1092,7 @@ static int pcs_get_pin_by_offset(struct pcs_device *pcs, unsigned offset)
669static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs, 1092static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
670 struct device_node *np, 1093 struct device_node *np,
671 struct pinctrl_map **map, 1094 struct pinctrl_map **map,
1095 unsigned *num_maps,
672 const char **pgnames) 1096 const char **pgnames)
673{ 1097{
674 struct pcs_func_vals *vals; 1098 struct pcs_func_vals *vals;
@@ -741,8 +1165,18 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
741 (*map)->data.mux.group = np->name; 1165 (*map)->data.mux.group = np->name;
742 (*map)->data.mux.function = np->name; 1166 (*map)->data.mux.function = np->name;
743 1167
1168 if (pcs->is_pinconf) {
1169 if (pcs_parse_pinconf(pcs, np, function, map))
1170 goto free_pingroups;
1171 *num_maps = 2;
1172 } else {
1173 *num_maps = 1;
1174 }
744 return 0; 1175 return 0;
745 1176
1177free_pingroups:
1178 pcs_free_pingroups(pcs);
1179 *num_maps = 1;
746free_function: 1180free_function:
747 pcs_remove_function(pcs, function); 1181 pcs_remove_function(pcs, function);
748 1182
@@ -771,7 +1205,8 @@ static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev,
771 1205
772 pcs = pinctrl_dev_get_drvdata(pctldev); 1206 pcs = pinctrl_dev_get_drvdata(pctldev);
773 1207
774 *map = devm_kzalloc(pcs->dev, sizeof(**map), GFP_KERNEL); 1208 /* create 2 maps. One is for pinmux, and the other is for pinconf. */
1209 *map = devm_kzalloc(pcs->dev, sizeof(**map) * 2, GFP_KERNEL);
775 if (!*map) 1210 if (!*map)
776 return -ENOMEM; 1211 return -ENOMEM;
777 1212
@@ -783,13 +1218,13 @@ static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev,
783 goto free_map; 1218 goto free_map;
784 } 1219 }
785 1220
786 ret = pcs_parse_one_pinctrl_entry(pcs, np_config, map, pgnames); 1221 ret = pcs_parse_one_pinctrl_entry(pcs, np_config, map, num_maps,
1222 pgnames);
787 if (ret < 0) { 1223 if (ret < 0) {
788 dev_err(pcs->dev, "no pins entries for %s\n", 1224 dev_err(pcs->dev, "no pins entries for %s\n",
789 np_config->name); 1225 np_config->name);
790 goto free_pgnames; 1226 goto free_pgnames;
791 } 1227 }
792 *num_maps = 1;
793 1228
794 return 0; 1229 return 0;
795 1230
@@ -879,6 +1314,37 @@ static void pcs_free_resources(struct pcs_device *pcs)
879 1314
880static struct of_device_id pcs_of_match[]; 1315static struct of_device_id pcs_of_match[];
881 1316
1317static int pcs_add_gpio_func(struct device_node *node, struct pcs_device *pcs)
1318{
1319 const char *propname = "pinctrl-single,gpio-range";
1320 const char *cellname = "#pinctrl-single,gpio-range-cells";
1321 struct of_phandle_args gpiospec;
1322 struct pcs_gpiofunc_range *range;
1323 int ret, i;
1324
1325 for (i = 0; ; i++) {
1326 ret = of_parse_phandle_with_args(node, propname, cellname,
1327 i, &gpiospec);
1328 /* Do not treat it as error. Only treat it as end condition. */
1329 if (ret) {
1330 ret = 0;
1331 break;
1332 }
1333 range = devm_kzalloc(pcs->dev, sizeof(*range), GFP_KERNEL);
1334 if (!range) {
1335 ret = -ENOMEM;
1336 break;
1337 }
1338 range->offset = gpiospec.args[0];
1339 range->npins = gpiospec.args[1];
1340 range->gpiofunc = gpiospec.args[2];
1341 mutex_lock(&pcs->mutex);
1342 list_add_tail(&range->node, &pcs->gpiofuncs);
1343 mutex_unlock(&pcs->mutex);
1344 }
1345 return ret;
1346}
1347
882static int pcs_probe(struct platform_device *pdev) 1348static int pcs_probe(struct platform_device *pdev)
883{ 1349{
884 struct device_node *np = pdev->dev.of_node; 1350 struct device_node *np = pdev->dev.of_node;
@@ -900,14 +1366,23 @@ static int pcs_probe(struct platform_device *pdev)
900 mutex_init(&pcs->mutex); 1366 mutex_init(&pcs->mutex);
901 INIT_LIST_HEAD(&pcs->pingroups); 1367 INIT_LIST_HEAD(&pcs->pingroups);
902 INIT_LIST_HEAD(&pcs->functions); 1368 INIT_LIST_HEAD(&pcs->functions);
1369 INIT_LIST_HEAD(&pcs->gpiofuncs);
1370 pcs->is_pinconf = match->data;
903 1371
904 PCS_GET_PROP_U32("pinctrl-single,register-width", &pcs->width, 1372 PCS_GET_PROP_U32("pinctrl-single,register-width", &pcs->width,
905 "register width not specified\n"); 1373 "register width not specified\n");
906 1374
907 PCS_GET_PROP_U32("pinctrl-single,function-mask", &pcs->fmask, 1375 ret = of_property_read_u32(np, "pinctrl-single,function-mask",
908 "function register mask not specified\n"); 1376 &pcs->fmask);
909 pcs->fshift = ffs(pcs->fmask) - 1; 1377 if (!ret) {
910 pcs->fmax = pcs->fmask >> pcs->fshift; 1378 pcs->fshift = ffs(pcs->fmask) - 1;
1379 pcs->fmax = pcs->fmask >> pcs->fshift;
1380 } else {
1381 /* If mask property doesn't exist, function mux is invalid. */
1382 pcs->fmask = 0;
1383 pcs->fshift = 0;
1384 pcs->fmax = 0;
1385 }
911 1386
912 ret = of_property_read_u32(np, "pinctrl-single,function-off", 1387 ret = of_property_read_u32(np, "pinctrl-single,function-off",
913 &pcs->foff); 1388 &pcs->foff);
@@ -961,7 +1436,8 @@ static int pcs_probe(struct platform_device *pdev)
961 pcs->desc.name = DRIVER_NAME; 1436 pcs->desc.name = DRIVER_NAME;
962 pcs->desc.pctlops = &pcs_pinctrl_ops; 1437 pcs->desc.pctlops = &pcs_pinctrl_ops;
963 pcs->desc.pmxops = &pcs_pinmux_ops; 1438 pcs->desc.pmxops = &pcs_pinmux_ops;
964 pcs->desc.confops = &pcs_pinconf_ops; 1439 if (pcs->is_pinconf)
1440 pcs->desc.confops = &pcs_pinconf_ops;
965 pcs->desc.owner = THIS_MODULE; 1441 pcs->desc.owner = THIS_MODULE;
966 1442
967 ret = pcs_allocate_pin_table(pcs); 1443 ret = pcs_allocate_pin_table(pcs);
@@ -975,6 +1451,10 @@ static int pcs_probe(struct platform_device *pdev)
975 goto free; 1451 goto free;
976 } 1452 }
977 1453
1454 ret = pcs_add_gpio_func(np, pcs);
1455 if (ret < 0)
1456 goto free;
1457
978 dev_info(pcs->dev, "%i pins at pa %p size %u\n", 1458 dev_info(pcs->dev, "%i pins at pa %p size %u\n",
979 pcs->desc.npins, pcs->base, pcs->size); 1459 pcs->desc.npins, pcs->base, pcs->size);
980 1460
@@ -999,7 +1479,8 @@ static int pcs_remove(struct platform_device *pdev)
999} 1479}
1000 1480
1001static struct of_device_id pcs_of_match[] = { 1481static struct of_device_id pcs_of_match[] = {
1002 { .compatible = DRIVER_NAME, }, 1482 { .compatible = "pinctrl-single", .data = (void *)false },
1483 { .compatible = "pinconf-single", .data = (void *)true },
1003 { }, 1484 { },
1004}; 1485};
1005MODULE_DEVICE_TABLE(of, pcs_of_match); 1486MODULE_DEVICE_TABLE(of, pcs_of_match);
diff --git a/drivers/pinctrl/pinctrl-sirf.c b/drivers/pinctrl/pinctrl-sirf.c
index d02498b30c6e..fb9062570745 100644
--- a/drivers/pinctrl/pinctrl-sirf.c
+++ b/drivers/pinctrl/pinctrl-sirf.c
@@ -979,7 +979,7 @@ static void sirfsoc_dt_free_map(struct pinctrl_dev *pctldev,
979 kfree(map); 979 kfree(map);
980} 980}
981 981
982static struct pinctrl_ops sirfsoc_pctrl_ops = { 982static const struct pinctrl_ops sirfsoc_pctrl_ops = {
983 .get_groups_count = sirfsoc_get_groups_count, 983 .get_groups_count = sirfsoc_get_groups_count,
984 .get_group_name = sirfsoc_get_group_name, 984 .get_group_name = sirfsoc_get_group_name,
985 .get_group_pins = sirfsoc_get_group_pins, 985 .get_group_pins = sirfsoc_get_group_pins,
@@ -1181,7 +1181,7 @@ static int sirfsoc_pinmux_request_gpio(struct pinctrl_dev *pmxdev,
1181 return 0; 1181 return 0;
1182} 1182}
1183 1183
1184static struct pinmux_ops sirfsoc_pinmux_ops = { 1184static const struct pinmux_ops sirfsoc_pinmux_ops = {
1185 .enable = sirfsoc_pinmux_enable, 1185 .enable = sirfsoc_pinmux_enable,
1186 .disable = sirfsoc_pinmux_disable, 1186 .disable = sirfsoc_pinmux_disable,
1187 .get_functions_count = sirfsoc_pinmux_get_funcs_count, 1187 .get_functions_count = sirfsoc_pinmux_get_funcs_count,
@@ -1685,15 +1685,12 @@ static void sirfsoc_gpio_set_pullup(const u32 *pullups)
1685 const unsigned long *p = (const unsigned long *)pullups; 1685 const unsigned long *p = (const unsigned long *)pullups;
1686 1686
1687 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { 1687 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
1688 n = find_first_bit(p + i, BITS_PER_LONG); 1688 for_each_set_bit(n, p + i, BITS_PER_LONG) {
1689 while (n < BITS_PER_LONG) {
1690 u32 offset = SIRFSOC_GPIO_CTRL(i, n); 1689 u32 offset = SIRFSOC_GPIO_CTRL(i, n);
1691 u32 val = readl(sgpio_bank[i].chip.regs + offset); 1690 u32 val = readl(sgpio_bank[i].chip.regs + offset);
1692 val |= SIRFSOC_GPIO_CTL_PULL_MASK; 1691 val |= SIRFSOC_GPIO_CTL_PULL_MASK;
1693 val |= SIRFSOC_GPIO_CTL_PULL_HIGH; 1692 val |= SIRFSOC_GPIO_CTL_PULL_HIGH;
1694 writel(val, sgpio_bank[i].chip.regs + offset); 1693 writel(val, sgpio_bank[i].chip.regs + offset);
1695
1696 n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
1697 } 1694 }
1698 } 1695 }
1699} 1696}
@@ -1704,15 +1701,12 @@ static void sirfsoc_gpio_set_pulldown(const u32 *pulldowns)
1704 const unsigned long *p = (const unsigned long *)pulldowns; 1701 const unsigned long *p = (const unsigned long *)pulldowns;
1705 1702
1706 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) { 1703 for (i = 0; i < SIRFSOC_GPIO_NO_OF_BANKS; i++) {
1707 n = find_first_bit(p + i, BITS_PER_LONG); 1704 for_each_set_bit(n, p + i, BITS_PER_LONG) {
1708 while (n < BITS_PER_LONG) {
1709 u32 offset = SIRFSOC_GPIO_CTRL(i, n); 1705 u32 offset = SIRFSOC_GPIO_CTRL(i, n);
1710 u32 val = readl(sgpio_bank[i].chip.regs + offset); 1706 u32 val = readl(sgpio_bank[i].chip.regs + offset);
1711 val |= SIRFSOC_GPIO_CTL_PULL_MASK; 1707 val |= SIRFSOC_GPIO_CTL_PULL_MASK;
1712 val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH; 1708 val &= ~SIRFSOC_GPIO_CTL_PULL_HIGH;
1713 writel(val, sgpio_bank[i].chip.regs + offset); 1709 writel(val, sgpio_bank[i].chip.regs + offset);
1714
1715 n = find_next_bit(p + i, BITS_PER_LONG, n + 1);
1716 } 1710 }
1717 } 1711 }
1718} 1712}
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c
index 80b11e3415bc..c52fc2c08732 100644
--- a/drivers/pinctrl/pinctrl-sunxi.c
+++ b/drivers/pinctrl/pinctrl-sunxi.c
@@ -11,6 +11,7 @@
11 */ 11 */
12 12
13#include <linux/io.h> 13#include <linux/io.h>
14#include <linux/clk.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
15#include <linux/module.h> 16#include <linux/module.h>
16#include <linux/of.h> 17#include <linux/of.h>
@@ -30,482 +31,856 @@
30static const struct sunxi_desc_pin sun4i_a10_pins[] = { 31static const struct sunxi_desc_pin sun4i_a10_pins[] = {
31 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA0, 32 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA0,
32 SUNXI_FUNCTION(0x0, "gpio_in"), 33 SUNXI_FUNCTION(0x0, "gpio_in"),
33 SUNXI_FUNCTION(0x1, "gpio_out")), 34 SUNXI_FUNCTION(0x1, "gpio_out"),
35 SUNXI_FUNCTION(0x2, "emac"), /* ERXD3 */
36 SUNXI_FUNCTION(0x3, "spi1"), /* CS0 */
37 SUNXI_FUNCTION(0x4, "uart2")), /* RTS */
34 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA1, 38 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA1,
35 SUNXI_FUNCTION(0x0, "gpio_in"), 39 SUNXI_FUNCTION(0x0, "gpio_in"),
36 SUNXI_FUNCTION(0x1, "gpio_out")), 40 SUNXI_FUNCTION(0x1, "gpio_out"),
41 SUNXI_FUNCTION(0x2, "emac"), /* ERXD2 */
42 SUNXI_FUNCTION(0x3, "spi1"), /* CLK */
43 SUNXI_FUNCTION(0x4, "uart2")), /* CTS */
37 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA2, 44 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA2,
38 SUNXI_FUNCTION(0x0, "gpio_in"), 45 SUNXI_FUNCTION(0x0, "gpio_in"),
39 SUNXI_FUNCTION(0x1, "gpio_out")), 46 SUNXI_FUNCTION(0x1, "gpio_out"),
47 SUNXI_FUNCTION(0x2, "emac"), /* ERXD1 */
48 SUNXI_FUNCTION(0x3, "spi1"), /* MOSI */
49 SUNXI_FUNCTION(0x4, "uart2")), /* TX */
40 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA3, 50 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA3,
41 SUNXI_FUNCTION(0x0, "gpio_in"), 51 SUNXI_FUNCTION(0x0, "gpio_in"),
42 SUNXI_FUNCTION(0x1, "gpio_out")), 52 SUNXI_FUNCTION(0x1, "gpio_out"),
53 SUNXI_FUNCTION(0x2, "emac"), /* ERXD0 */
54 SUNXI_FUNCTION(0x3, "spi1"), /* MISO */
55 SUNXI_FUNCTION(0x4, "uart2")), /* RX */
43 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA4, 56 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA4,
44 SUNXI_FUNCTION(0x0, "gpio_in"), 57 SUNXI_FUNCTION(0x0, "gpio_in"),
45 SUNXI_FUNCTION(0x1, "gpio_out")), 58 SUNXI_FUNCTION(0x1, "gpio_out"),
59 SUNXI_FUNCTION(0x2, "emac"), /* ETXD3 */
60 SUNXI_FUNCTION(0x3, "spi1")), /* CS1 */
46 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA5, 61 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA5,
47 SUNXI_FUNCTION(0x0, "gpio_in"), 62 SUNXI_FUNCTION(0x0, "gpio_in"),
48 SUNXI_FUNCTION(0x1, "gpio_out")), 63 SUNXI_FUNCTION(0x1, "gpio_out"),
64 SUNXI_FUNCTION(0x2, "emac"), /* ETXD2 */
65 SUNXI_FUNCTION(0x3, "spi3")), /* CS0 */
49 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA6, 66 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA6,
50 SUNXI_FUNCTION(0x0, "gpio_in"), 67 SUNXI_FUNCTION(0x0, "gpio_in"),
51 SUNXI_FUNCTION(0x1, "gpio_out")), 68 SUNXI_FUNCTION(0x1, "gpio_out"),
69 SUNXI_FUNCTION(0x2, "emac"), /* ETXD1 */
70 SUNXI_FUNCTION(0x3, "spi3")), /* CLK */
52 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA7, 71 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA7,
53 SUNXI_FUNCTION(0x0, "gpio_in"), 72 SUNXI_FUNCTION(0x0, "gpio_in"),
54 SUNXI_FUNCTION(0x1, "gpio_out")), 73 SUNXI_FUNCTION(0x1, "gpio_out"),
74 SUNXI_FUNCTION(0x2, "emac"), /* ETXD0 */
75 SUNXI_FUNCTION(0x3, "spi3")), /* MOSI */
55 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA8, 76 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA8,
56 SUNXI_FUNCTION(0x0, "gpio_in"), 77 SUNXI_FUNCTION(0x0, "gpio_in"),
57 SUNXI_FUNCTION(0x1, "gpio_out")), 78 SUNXI_FUNCTION(0x1, "gpio_out"),
79 SUNXI_FUNCTION(0x2, "emac"), /* ERXCK */
80 SUNXI_FUNCTION(0x3, "spi3")), /* MISO */
58 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA9, 81 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA9,
59 SUNXI_FUNCTION(0x0, "gpio_in"), 82 SUNXI_FUNCTION(0x0, "gpio_in"),
60 SUNXI_FUNCTION(0x1, "gpio_out")), 83 SUNXI_FUNCTION(0x1, "gpio_out"),
84 SUNXI_FUNCTION(0x2, "emac"), /* ERXERR */
85 SUNXI_FUNCTION(0x3, "spi3")), /* CS1 */
61 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA10, 86 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA10,
62 SUNXI_FUNCTION(0x0, "gpio_in"), 87 SUNXI_FUNCTION(0x0, "gpio_in"),
63 SUNXI_FUNCTION(0x1, "gpio_out"), 88 SUNXI_FUNCTION(0x1, "gpio_out"),
89 SUNXI_FUNCTION(0x2, "emac"), /* ERXDV */
64 SUNXI_FUNCTION(0x4, "uart1")), /* TX */ 90 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
65 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA11, 91 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA11,
66 SUNXI_FUNCTION(0x0, "gpio_in"), 92 SUNXI_FUNCTION(0x0, "gpio_in"),
67 SUNXI_FUNCTION(0x1, "gpio_out"), 93 SUNXI_FUNCTION(0x1, "gpio_out"),
94 SUNXI_FUNCTION(0x2, "emac"), /* EMDC */
68 SUNXI_FUNCTION(0x4, "uart1")), /* RX */ 95 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
69 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA12, 96 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA12,
70 SUNXI_FUNCTION(0x0, "gpio_in"), 97 SUNXI_FUNCTION(0x0, "gpio_in"),
71 SUNXI_FUNCTION(0x1, "gpio_out"), 98 SUNXI_FUNCTION(0x1, "gpio_out"),
99 SUNXI_FUNCTION(0x2, "emac"), /* EMDIO */
100 SUNXI_FUNCTION(0x3, "uart6"), /* TX */
72 SUNXI_FUNCTION(0x4, "uart1")), /* RTS */ 101 SUNXI_FUNCTION(0x4, "uart1")), /* RTS */
73 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA13, 102 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA13,
74 SUNXI_FUNCTION(0x0, "gpio_in"), 103 SUNXI_FUNCTION(0x0, "gpio_in"),
75 SUNXI_FUNCTION(0x1, "gpio_out"), 104 SUNXI_FUNCTION(0x1, "gpio_out"),
105 SUNXI_FUNCTION(0x2, "emac"), /* ETXEN */
106 SUNXI_FUNCTION(0x3, "uart6"), /* RX */
76 SUNXI_FUNCTION(0x4, "uart1")), /* CTS */ 107 SUNXI_FUNCTION(0x4, "uart1")), /* CTS */
77 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA14, 108 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA14,
78 SUNXI_FUNCTION(0x0, "gpio_in"), 109 SUNXI_FUNCTION(0x0, "gpio_in"),
79 SUNXI_FUNCTION(0x1, "gpio_out"), 110 SUNXI_FUNCTION(0x1, "gpio_out"),
111 SUNXI_FUNCTION(0x2, "emac"), /* ETXCK */
112 SUNXI_FUNCTION(0x3, "uart7"), /* TX */
80 SUNXI_FUNCTION(0x4, "uart1")), /* DTR */ 113 SUNXI_FUNCTION(0x4, "uart1")), /* DTR */
81 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA15, 114 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA15,
82 SUNXI_FUNCTION(0x0, "gpio_in"), 115 SUNXI_FUNCTION(0x0, "gpio_in"),
83 SUNXI_FUNCTION(0x1, "gpio_out"), 116 SUNXI_FUNCTION(0x1, "gpio_out"),
117 SUNXI_FUNCTION(0x2, "emac"), /* ECRS */
118 SUNXI_FUNCTION(0x3, "uart7"), /* RX */
84 SUNXI_FUNCTION(0x4, "uart1")), /* DSR */ 119 SUNXI_FUNCTION(0x4, "uart1")), /* DSR */
85 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA16, 120 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA16,
86 SUNXI_FUNCTION(0x0, "gpio_in"), 121 SUNXI_FUNCTION(0x0, "gpio_in"),
87 SUNXI_FUNCTION(0x1, "gpio_out"), 122 SUNXI_FUNCTION(0x1, "gpio_out"),
123 SUNXI_FUNCTION(0x2, "emac"), /* ECOL */
124 SUNXI_FUNCTION(0x3, "can"), /* TX */
88 SUNXI_FUNCTION(0x4, "uart1")), /* DCD */ 125 SUNXI_FUNCTION(0x4, "uart1")), /* DCD */
89 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA17, 126 SUNXI_PIN(SUNXI_PINCTRL_PIN_PA17,
90 SUNXI_FUNCTION(0x0, "gpio_in"), 127 SUNXI_FUNCTION(0x0, "gpio_in"),
91 SUNXI_FUNCTION(0x1, "gpio_out"), 128 SUNXI_FUNCTION(0x1, "gpio_out"),
129 SUNXI_FUNCTION(0x2, "emac"), /* ETXERR */
130 SUNXI_FUNCTION(0x3, "can"), /* RX */
92 SUNXI_FUNCTION(0x4, "uart1")), /* RING */ 131 SUNXI_FUNCTION(0x4, "uart1")), /* RING */
93 /* Hole */ 132 /* Hole */
94 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0, 133 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0,
95 SUNXI_FUNCTION(0x0, "gpio_in"), 134 SUNXI_FUNCTION(0x0, "gpio_in"),
96 SUNXI_FUNCTION(0x1, "gpio_out")), 135 SUNXI_FUNCTION(0x1, "gpio_out"),
136 SUNXI_FUNCTION(0x2, "i2c0")), /* SCK */
97 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1, 137 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1,
98 SUNXI_FUNCTION(0x0, "gpio_in"), 138 SUNXI_FUNCTION(0x0, "gpio_in"),
99 SUNXI_FUNCTION(0x1, "gpio_out")), 139 SUNXI_FUNCTION(0x1, "gpio_out"),
140 SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
100 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2, 141 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2,
101 SUNXI_FUNCTION(0x0, "gpio_in"), 142 SUNXI_FUNCTION(0x0, "gpio_in"),
102 SUNXI_FUNCTION(0x1, "gpio_out")), 143 SUNXI_FUNCTION(0x1, "gpio_out"),
144 SUNXI_FUNCTION(0x2, "pwm")), /* PWM0 */
103 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3, 145 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3,
104 SUNXI_FUNCTION(0x0, "gpio_in"), 146 SUNXI_FUNCTION(0x0, "gpio_in"),
105 SUNXI_FUNCTION(0x1, "gpio_out")), 147 SUNXI_FUNCTION(0x1, "gpio_out"),
148 SUNXI_FUNCTION(0x2, "ir0")), /* TX */
106 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4, 149 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4,
107 SUNXI_FUNCTION(0x0, "gpio_in"), 150 SUNXI_FUNCTION(0x0, "gpio_in"),
108 SUNXI_FUNCTION(0x1, "gpio_out")), 151 SUNXI_FUNCTION(0x1, "gpio_out"),
152 SUNXI_FUNCTION(0x2, "ir0")), /* RX */
109 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB5, 153 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB5,
110 SUNXI_FUNCTION(0x0, "gpio_in"), 154 SUNXI_FUNCTION(0x0, "gpio_in"),
111 SUNXI_FUNCTION(0x1, "gpio_out")), 155 SUNXI_FUNCTION(0x1, "gpio_out"),
156 SUNXI_FUNCTION(0x2, "i2s"), /* MCLK */
157 SUNXI_FUNCTION(0x3, "ac97")), /* MCLK */
112 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB6, 158 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB6,
113 SUNXI_FUNCTION(0x0, "gpio_in"), 159 SUNXI_FUNCTION(0x0, "gpio_in"),
114 SUNXI_FUNCTION(0x1, "gpio_out")), 160 SUNXI_FUNCTION(0x1, "gpio_out"),
161 SUNXI_FUNCTION(0x2, "i2s"), /* BCLK */
162 SUNXI_FUNCTION(0x3, "ac97")), /* BCLK */
115 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB7, 163 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB7,
116 SUNXI_FUNCTION(0x0, "gpio_in"), 164 SUNXI_FUNCTION(0x0, "gpio_in"),
117 SUNXI_FUNCTION(0x1, "gpio_out")), 165 SUNXI_FUNCTION(0x1, "gpio_out"),
166 SUNXI_FUNCTION(0x2, "i2s"), /* LRCK */
167 SUNXI_FUNCTION(0x3, "ac97")), /* SYNC */
118 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB8, 168 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB8,
119 SUNXI_FUNCTION(0x0, "gpio_in"), 169 SUNXI_FUNCTION(0x0, "gpio_in"),
120 SUNXI_FUNCTION(0x1, "gpio_out")), 170 SUNXI_FUNCTION(0x1, "gpio_out"),
171 SUNXI_FUNCTION(0x2, "i2s"), /* DO0 */
172 SUNXI_FUNCTION(0x3, "ac97")), /* DO */
121 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB9, 173 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB9,
122 SUNXI_FUNCTION(0x0, "gpio_in"), 174 SUNXI_FUNCTION(0x0, "gpio_in"),
123 SUNXI_FUNCTION(0x1, "gpio_out")), 175 SUNXI_FUNCTION(0x1, "gpio_out"),
176 SUNXI_FUNCTION(0x2, "i2s")), /* DO1 */
124 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10, 177 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10,
125 SUNXI_FUNCTION(0x0, "gpio_in"), 178 SUNXI_FUNCTION(0x0, "gpio_in"),
126 SUNXI_FUNCTION(0x1, "gpio_out")), 179 SUNXI_FUNCTION(0x1, "gpio_out"),
180 SUNXI_FUNCTION(0x2, "i2s")), /* DO2 */
127 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB11, 181 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB11,
128 SUNXI_FUNCTION(0x0, "gpio_in"), 182 SUNXI_FUNCTION(0x0, "gpio_in"),
129 SUNXI_FUNCTION(0x1, "gpio_out")), 183 SUNXI_FUNCTION(0x1, "gpio_out"),
184 SUNXI_FUNCTION(0x2, "i2s")), /* DO3 */
130 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB12, 185 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB12,
131 SUNXI_FUNCTION(0x0, "gpio_in"), 186 SUNXI_FUNCTION(0x0, "gpio_in"),
132 SUNXI_FUNCTION(0x1, "gpio_out")), 187 SUNXI_FUNCTION(0x1, "gpio_out"),
188 SUNXI_FUNCTION(0x2, "i2s"), /* DI */
189 SUNXI_FUNCTION(0x3, "ac97")), /* DI */
133 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB13, 190 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB13,
134 SUNXI_FUNCTION(0x0, "gpio_in"), 191 SUNXI_FUNCTION(0x0, "gpio_in"),
135 SUNXI_FUNCTION(0x1, "gpio_out")), 192 SUNXI_FUNCTION(0x1, "gpio_out"),
193 SUNXI_FUNCTION(0x2, "spi2")), /* CS1 */
136 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB14, 194 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB14,
137 SUNXI_FUNCTION(0x0, "gpio_in"), 195 SUNXI_FUNCTION(0x0, "gpio_in"),
138 SUNXI_FUNCTION(0x1, "gpio_out")), 196 SUNXI_FUNCTION(0x1, "gpio_out"),
197 SUNXI_FUNCTION(0x2, "spi2"), /* CS0 */
198 SUNXI_FUNCTION(0x3, "jtag")), /* MS0 */
139 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15, 199 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15,
140 SUNXI_FUNCTION(0x0, "gpio_in"), 200 SUNXI_FUNCTION(0x0, "gpio_in"),
141 SUNXI_FUNCTION(0x1, "gpio_out")), 201 SUNXI_FUNCTION(0x1, "gpio_out"),
202 SUNXI_FUNCTION(0x2, "spi2"), /* CLK */
203 SUNXI_FUNCTION(0x3, "jtag")), /* CK0 */
142 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16, 204 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16,
143 SUNXI_FUNCTION(0x0, "gpio_in"), 205 SUNXI_FUNCTION(0x0, "gpio_in"),
144 SUNXI_FUNCTION(0x1, "gpio_out")), 206 SUNXI_FUNCTION(0x1, "gpio_out"),
207 SUNXI_FUNCTION(0x2, "spi2"), /* MOSI */
208 SUNXI_FUNCTION(0x3, "jtag")), /* DO0 */
145 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17, 209 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17,
146 SUNXI_FUNCTION(0x0, "gpio_in"), 210 SUNXI_FUNCTION(0x0, "gpio_in"),
147 SUNXI_FUNCTION(0x1, "gpio_out")), 211 SUNXI_FUNCTION(0x1, "gpio_out"),
212 SUNXI_FUNCTION(0x2, "spi2"), /* MISO */
213 SUNXI_FUNCTION(0x3, "jtag")), /* DI0 */
148 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18, 214 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18,
149 SUNXI_FUNCTION(0x0, "gpio_in"), 215 SUNXI_FUNCTION(0x0, "gpio_in"),
150 SUNXI_FUNCTION(0x1, "gpio_out")), 216 SUNXI_FUNCTION(0x1, "gpio_out"),
217 SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
151 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB19, 218 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB19,
152 SUNXI_FUNCTION(0x0, "gpio_in"), 219 SUNXI_FUNCTION(0x0, "gpio_in"),
153 SUNXI_FUNCTION(0x1, "gpio_out")), 220 SUNXI_FUNCTION(0x1, "gpio_out"),
221 SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
154 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB20, 222 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB20,
155 SUNXI_FUNCTION(0x0, "gpio_in"), 223 SUNXI_FUNCTION(0x0, "gpio_in"),
156 SUNXI_FUNCTION(0x1, "gpio_out")), 224 SUNXI_FUNCTION(0x1, "gpio_out"),
225 SUNXI_FUNCTION(0x2, "i2c2")), /* SCK */
157 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB21, 226 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB21,
158 SUNXI_FUNCTION(0x0, "gpio_in"), 227 SUNXI_FUNCTION(0x0, "gpio_in"),
159 SUNXI_FUNCTION(0x1, "gpio_out")), 228 SUNXI_FUNCTION(0x1, "gpio_out"),
229 SUNXI_FUNCTION(0x2, "i2c2")), /* SDA */
160 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB22, 230 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB22,
161 SUNXI_FUNCTION(0x0, "gpio_in"), 231 SUNXI_FUNCTION(0x0, "gpio_in"),
162 SUNXI_FUNCTION(0x1, "gpio_out"), 232 SUNXI_FUNCTION(0x1, "gpio_out"),
163 SUNXI_FUNCTION(0x2, "uart0")), /* TX */ 233 SUNXI_FUNCTION(0x2, "uart0"), /* TX */
234 SUNXI_FUNCTION(0x3, "ir1")), /* TX */
164 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB23, 235 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB23,
165 SUNXI_FUNCTION(0x0, "gpio_in"), 236 SUNXI_FUNCTION(0x0, "gpio_in"),
166 SUNXI_FUNCTION(0x1, "gpio_out"), 237 SUNXI_FUNCTION(0x1, "gpio_out"),
167 SUNXI_FUNCTION(0x2, "uart0")), /* RX */ 238 SUNXI_FUNCTION(0x2, "uart0"), /* RX */
239 SUNXI_FUNCTION(0x3, "ir1")), /* RX */
168 /* Hole */ 240 /* Hole */
169 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0, 241 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0,
170 SUNXI_FUNCTION(0x0, "gpio_in"), 242 SUNXI_FUNCTION(0x0, "gpio_in"),
171 SUNXI_FUNCTION(0x1, "gpio_out")), 243 SUNXI_FUNCTION(0x1, "gpio_out"),
244 SUNXI_FUNCTION(0x2, "nand0"), /* NWE */
245 SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
172 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1, 246 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1,
173 SUNXI_FUNCTION(0x0, "gpio_in"), 247 SUNXI_FUNCTION(0x0, "gpio_in"),
174 SUNXI_FUNCTION(0x1, "gpio_out")), 248 SUNXI_FUNCTION(0x1, "gpio_out"),
249 SUNXI_FUNCTION(0x2, "nand0"), /* NALE */
250 SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
175 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2, 251 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2,
176 SUNXI_FUNCTION(0x0, "gpio_in"), 252 SUNXI_FUNCTION(0x0, "gpio_in"),
177 SUNXI_FUNCTION(0x1, "gpio_out")), 253 SUNXI_FUNCTION(0x1, "gpio_out"),
254 SUNXI_FUNCTION(0x2, "nand0"), /* NCLE */
255 SUNXI_FUNCTION(0x3, "spi0")), /* SCK */
178 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3, 256 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3,
179 SUNXI_FUNCTION(0x0, "gpio_in"), 257 SUNXI_FUNCTION(0x0, "gpio_in"),
180 SUNXI_FUNCTION(0x1, "gpio_out")), 258 SUNXI_FUNCTION(0x1, "gpio_out"),
259 SUNXI_FUNCTION(0x2, "nand0")), /* NCE1 */
181 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4, 260 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4,
182 SUNXI_FUNCTION(0x0, "gpio_in"), 261 SUNXI_FUNCTION(0x0, "gpio_in"),
183 SUNXI_FUNCTION(0x1, "gpio_out")), 262 SUNXI_FUNCTION(0x1, "gpio_out"),
263 SUNXI_FUNCTION(0x2, "nand0")), /* NCE0 */
184 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5, 264 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5,
185 SUNXI_FUNCTION(0x0, "gpio_in"), 265 SUNXI_FUNCTION(0x0, "gpio_in"),
186 SUNXI_FUNCTION(0x1, "gpio_out")), 266 SUNXI_FUNCTION(0x1, "gpio_out"),
267 SUNXI_FUNCTION(0x2, "nand0")), /* NRE# */
187 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6, 268 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6,
188 SUNXI_FUNCTION(0x0, "gpio_in"), 269 SUNXI_FUNCTION(0x0, "gpio_in"),
189 SUNXI_FUNCTION(0x1, "gpio_out")), 270 SUNXI_FUNCTION(0x1, "gpio_out"),
271 SUNXI_FUNCTION(0x2, "nand0"), /* NRB0 */
272 SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
190 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7, 273 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7,
191 SUNXI_FUNCTION(0x0, "gpio_in"), 274 SUNXI_FUNCTION(0x0, "gpio_in"),
192 SUNXI_FUNCTION(0x1, "gpio_out")), 275 SUNXI_FUNCTION(0x1, "gpio_out"),
276 SUNXI_FUNCTION(0x2, "nand0"), /* NRB1 */
277 SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
193 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8, 278 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8,
194 SUNXI_FUNCTION(0x0, "gpio_in"), 279 SUNXI_FUNCTION(0x0, "gpio_in"),
195 SUNXI_FUNCTION(0x1, "gpio_out")), 280 SUNXI_FUNCTION(0x1, "gpio_out"),
281 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ0 */
282 SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
196 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9, 283 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9,
197 SUNXI_FUNCTION(0x0, "gpio_in"), 284 SUNXI_FUNCTION(0x0, "gpio_in"),
198 SUNXI_FUNCTION(0x1, "gpio_out")), 285 SUNXI_FUNCTION(0x1, "gpio_out"),
286 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ1 */
287 SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
199 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10, 288 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10,
200 SUNXI_FUNCTION(0x0, "gpio_in"), 289 SUNXI_FUNCTION(0x0, "gpio_in"),
201 SUNXI_FUNCTION(0x1, "gpio_out")), 290 SUNXI_FUNCTION(0x1, "gpio_out"),
291 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ2 */
292 SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
202 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11, 293 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11,
203 SUNXI_FUNCTION(0x0, "gpio_in"), 294 SUNXI_FUNCTION(0x0, "gpio_in"),
204 SUNXI_FUNCTION(0x1, "gpio_out")), 295 SUNXI_FUNCTION(0x1, "gpio_out"),
296 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ3 */
297 SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
205 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12, 298 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12,
206 SUNXI_FUNCTION(0x0, "gpio_in"), 299 SUNXI_FUNCTION(0x0, "gpio_in"),
207 SUNXI_FUNCTION(0x1, "gpio_out")), 300 SUNXI_FUNCTION(0x1, "gpio_out"),
301 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ4 */
208 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13, 302 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13,
209 SUNXI_FUNCTION(0x0, "gpio_in"), 303 SUNXI_FUNCTION(0x0, "gpio_in"),
210 SUNXI_FUNCTION(0x1, "gpio_out")), 304 SUNXI_FUNCTION(0x1, "gpio_out"),
305 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ5 */
211 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14, 306 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14,
212 SUNXI_FUNCTION(0x0, "gpio_in"), 307 SUNXI_FUNCTION(0x0, "gpio_in"),
213 SUNXI_FUNCTION(0x1, "gpio_out")), 308 SUNXI_FUNCTION(0x1, "gpio_out"),
309 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ6 */
214 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15, 310 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15,
215 SUNXI_FUNCTION(0x0, "gpio_in"), 311 SUNXI_FUNCTION(0x0, "gpio_in"),
216 SUNXI_FUNCTION(0x1, "gpio_out")), 312 SUNXI_FUNCTION(0x1, "gpio_out"),
313 SUNXI_FUNCTION(0x2, "nand0")), /* NDQ7 */
217 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC16, 314 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC16,
218 SUNXI_FUNCTION(0x0, "gpio_in"), 315 SUNXI_FUNCTION(0x0, "gpio_in"),
219 SUNXI_FUNCTION(0x1, "gpio_out")), 316 SUNXI_FUNCTION(0x1, "gpio_out"),
317 SUNXI_FUNCTION(0x2, "nand0")), /* NWP */
220 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC17, 318 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC17,
221 SUNXI_FUNCTION(0x0, "gpio_in"), 319 SUNXI_FUNCTION(0x0, "gpio_in"),
222 SUNXI_FUNCTION(0x1, "gpio_out")), 320 SUNXI_FUNCTION(0x1, "gpio_out"),
321 SUNXI_FUNCTION(0x2, "nand0")), /* NCE2 */
223 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC18, 322 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC18,
224 SUNXI_FUNCTION(0x0, "gpio_in"), 323 SUNXI_FUNCTION(0x0, "gpio_in"),
225 SUNXI_FUNCTION(0x1, "gpio_out")), 324 SUNXI_FUNCTION(0x1, "gpio_out"),
325 SUNXI_FUNCTION(0x2, "nand0")), /* NCE3 */
226 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19, 326 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19,
227 SUNXI_FUNCTION(0x0, "gpio_in"), 327 SUNXI_FUNCTION(0x0, "gpio_in"),
228 SUNXI_FUNCTION(0x1, "gpio_out")), 328 SUNXI_FUNCTION(0x1, "gpio_out"),
329 SUNXI_FUNCTION(0x2, "nand0"), /* NCE4 */
330 SUNXI_FUNCTION(0x3, "spi2")), /* CS0 */
229 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC20, 331 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC20,
230 SUNXI_FUNCTION(0x0, "gpio_in"), 332 SUNXI_FUNCTION(0x0, "gpio_in"),
231 SUNXI_FUNCTION(0x1, "gpio_out")), 333 SUNXI_FUNCTION(0x1, "gpio_out"),
334 SUNXI_FUNCTION(0x2, "nand0"), /* NCE5 */
335 SUNXI_FUNCTION(0x3, "spi2")), /* CLK */
232 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC21, 336 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC21,
233 SUNXI_FUNCTION(0x0, "gpio_in"), 337 SUNXI_FUNCTION(0x0, "gpio_in"),
234 SUNXI_FUNCTION(0x1, "gpio_out")), 338 SUNXI_FUNCTION(0x1, "gpio_out"),
339 SUNXI_FUNCTION(0x2, "nand0"), /* NCE6 */
340 SUNXI_FUNCTION(0x3, "spi2")), /* MOSI */
235 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC22, 341 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC22,
236 SUNXI_FUNCTION(0x0, "gpio_in"), 342 SUNXI_FUNCTION(0x0, "gpio_in"),
237 SUNXI_FUNCTION(0x1, "gpio_out")), 343 SUNXI_FUNCTION(0x1, "gpio_out"),
344 SUNXI_FUNCTION(0x2, "nand0"), /* NCE7 */
345 SUNXI_FUNCTION(0x3, "spi2")), /* MISO */
238 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC23, 346 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC23,
239 SUNXI_FUNCTION(0x0, "gpio_in"), 347 SUNXI_FUNCTION(0x0, "gpio_in"),
240 SUNXI_FUNCTION(0x1, "gpio_out")), 348 SUNXI_FUNCTION(0x1, "gpio_out"),
349 SUNXI_FUNCTION(0x3, "spi0")), /* CS0 */
241 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC24, 350 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC24,
242 SUNXI_FUNCTION(0x0, "gpio_in"), 351 SUNXI_FUNCTION(0x0, "gpio_in"),
243 SUNXI_FUNCTION(0x1, "gpio_out")), 352 SUNXI_FUNCTION(0x1, "gpio_out"),
353 SUNXI_FUNCTION(0x2, "nand0")), /* NDQS */
244 /* Hole */ 354 /* Hole */
245 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD0, 355 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD0,
246 SUNXI_FUNCTION(0x0, "gpio_in"), 356 SUNXI_FUNCTION(0x0, "gpio_in"),
247 SUNXI_FUNCTION(0x1, "gpio_out")), 357 SUNXI_FUNCTION(0x1, "gpio_out"),
358 SUNXI_FUNCTION(0x2, "lcd0"), /* D0 */
359 SUNXI_FUNCTION(0x3, "lvds0")), /* VP0 */
248 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD1, 360 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD1,
249 SUNXI_FUNCTION(0x0, "gpio_in"), 361 SUNXI_FUNCTION(0x0, "gpio_in"),
250 SUNXI_FUNCTION(0x1, "gpio_out")), 362 SUNXI_FUNCTION(0x1, "gpio_out"),
363 SUNXI_FUNCTION(0x2, "lcd0"), /* D1 */
364 SUNXI_FUNCTION(0x3, "lvds0")), /* VN0 */
251 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2, 365 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2,
252 SUNXI_FUNCTION(0x0, "gpio_in"), 366 SUNXI_FUNCTION(0x0, "gpio_in"),
253 SUNXI_FUNCTION(0x1, "gpio_out")), 367 SUNXI_FUNCTION(0x1, "gpio_out"),
368 SUNXI_FUNCTION(0x2, "lcd0"), /* D2 */
369 SUNXI_FUNCTION(0x3, "lvds0")), /* VP1 */
254 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3, 370 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3,
255 SUNXI_FUNCTION(0x0, "gpio_in"), 371 SUNXI_FUNCTION(0x0, "gpio_in"),
256 SUNXI_FUNCTION(0x1, "gpio_out")), 372 SUNXI_FUNCTION(0x1, "gpio_out"),
373 SUNXI_FUNCTION(0x2, "lcd0"), /* D3 */
374 SUNXI_FUNCTION(0x3, "lvds0")), /* VN1 */
257 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4, 375 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4,
258 SUNXI_FUNCTION(0x0, "gpio_in"), 376 SUNXI_FUNCTION(0x0, "gpio_in"),
259 SUNXI_FUNCTION(0x1, "gpio_out")), 377 SUNXI_FUNCTION(0x1, "gpio_out"),
378 SUNXI_FUNCTION(0x2, "lcd0"), /* D4 */
379 SUNXI_FUNCTION(0x3, "lvds0")), /* VP2 */
260 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5, 380 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5,
261 SUNXI_FUNCTION(0x0, "gpio_in"), 381 SUNXI_FUNCTION(0x0, "gpio_in"),
262 SUNXI_FUNCTION(0x1, "gpio_out")), 382 SUNXI_FUNCTION(0x1, "gpio_out"),
383 SUNXI_FUNCTION(0x2, "lcd0"), /* D5 */
384 SUNXI_FUNCTION(0x3, "lvds0")), /* VN2 */
263 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6, 385 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6,
264 SUNXI_FUNCTION(0x0, "gpio_in"), 386 SUNXI_FUNCTION(0x0, "gpio_in"),
265 SUNXI_FUNCTION(0x1, "gpio_out")), 387 SUNXI_FUNCTION(0x1, "gpio_out"),
388 SUNXI_FUNCTION(0x2, "lcd0"), /* D6 */
389 SUNXI_FUNCTION(0x3, "lvds0")), /* VPC */
266 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7, 390 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7,
267 SUNXI_FUNCTION(0x0, "gpio_in"), 391 SUNXI_FUNCTION(0x0, "gpio_in"),
268 SUNXI_FUNCTION(0x1, "gpio_out")), 392 SUNXI_FUNCTION(0x1, "gpio_out"),
393 SUNXI_FUNCTION(0x2, "lcd0"), /* D7 */
394 SUNXI_FUNCTION(0x3, "lvds0")), /* VNC */
269 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD8, 395 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD8,
270 SUNXI_FUNCTION(0x0, "gpio_in"), 396 SUNXI_FUNCTION(0x0, "gpio_in"),
271 SUNXI_FUNCTION(0x1, "gpio_out")), 397 SUNXI_FUNCTION(0x1, "gpio_out"),
398 SUNXI_FUNCTION(0x2, "lcd0"), /* D8 */
399 SUNXI_FUNCTION(0x3, "lvds0")), /* VP3 */
272 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD9, 400 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD9,
273 SUNXI_FUNCTION(0x0, "gpio_in"), 401 SUNXI_FUNCTION(0x0, "gpio_in"),
274 SUNXI_FUNCTION(0x1, "gpio_out")), 402 SUNXI_FUNCTION(0x1, "gpio_out"),
403 SUNXI_FUNCTION(0x2, "lcd0"), /* D9 */
404 SUNXI_FUNCTION(0x3, "lvds0")), /* VM3 */
275 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10, 405 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10,
276 SUNXI_FUNCTION(0x0, "gpio_in"), 406 SUNXI_FUNCTION(0x0, "gpio_in"),
277 SUNXI_FUNCTION(0x1, "gpio_out")), 407 SUNXI_FUNCTION(0x1, "gpio_out"),
408 SUNXI_FUNCTION(0x2, "lcd0"), /* D10 */
409 SUNXI_FUNCTION(0x3, "lvds1")), /* VP0 */
278 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11, 410 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11,
279 SUNXI_FUNCTION(0x0, "gpio_in"), 411 SUNXI_FUNCTION(0x0, "gpio_in"),
280 SUNXI_FUNCTION(0x1, "gpio_out")), 412 SUNXI_FUNCTION(0x1, "gpio_out"),
413 SUNXI_FUNCTION(0x2, "lcd0"), /* D11 */
414 SUNXI_FUNCTION(0x3, "lvds1")), /* VN0 */
281 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12, 415 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12,
282 SUNXI_FUNCTION(0x0, "gpio_in"), 416 SUNXI_FUNCTION(0x0, "gpio_in"),
283 SUNXI_FUNCTION(0x1, "gpio_out")), 417 SUNXI_FUNCTION(0x1, "gpio_out"),
418 SUNXI_FUNCTION(0x2, "lcd0"), /* D12 */
419 SUNXI_FUNCTION(0x3, "lvds1")), /* VP1 */
284 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13, 420 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13,
285 SUNXI_FUNCTION(0x0, "gpio_in"), 421 SUNXI_FUNCTION(0x0, "gpio_in"),
286 SUNXI_FUNCTION(0x1, "gpio_out")), 422 SUNXI_FUNCTION(0x1, "gpio_out"),
423 SUNXI_FUNCTION(0x2, "lcd0"), /* D13 */
424 SUNXI_FUNCTION(0x3, "lvds1")), /* VN1 */
287 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14, 425 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14,
288 SUNXI_FUNCTION(0x0, "gpio_in"), 426 SUNXI_FUNCTION(0x0, "gpio_in"),
289 SUNXI_FUNCTION(0x1, "gpio_out")), 427 SUNXI_FUNCTION(0x1, "gpio_out"),
428 SUNXI_FUNCTION(0x2, "lcd0"), /* D14 */
429 SUNXI_FUNCTION(0x3, "lvds1")), /* VP2 */
290 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15, 430 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15,
291 SUNXI_FUNCTION(0x0, "gpio_in"), 431 SUNXI_FUNCTION(0x0, "gpio_in"),
292 SUNXI_FUNCTION(0x1, "gpio_out")), 432 SUNXI_FUNCTION(0x1, "gpio_out"),
433 SUNXI_FUNCTION(0x2, "lcd0"), /* D15 */
434 SUNXI_FUNCTION(0x3, "lvds1")), /* VN2 */
293 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD16, 435 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD16,
294 SUNXI_FUNCTION(0x0, "gpio_in"), 436 SUNXI_FUNCTION(0x0, "gpio_in"),
295 SUNXI_FUNCTION(0x1, "gpio_out")), 437 SUNXI_FUNCTION(0x1, "gpio_out"),
438 SUNXI_FUNCTION(0x2, "lcd0"), /* D16 */
439 SUNXI_FUNCTION(0x3, "lvds1")), /* VPC */
296 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD17, 440 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD17,
297 SUNXI_FUNCTION(0x0, "gpio_in"), 441 SUNXI_FUNCTION(0x0, "gpio_in"),
298 SUNXI_FUNCTION(0x1, "gpio_out")), 442 SUNXI_FUNCTION(0x1, "gpio_out"),
443 SUNXI_FUNCTION(0x2, "lcd0"), /* D17 */
444 SUNXI_FUNCTION(0x3, "lvds1")), /* VNC */
299 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18, 445 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18,
300 SUNXI_FUNCTION(0x0, "gpio_in"), 446 SUNXI_FUNCTION(0x0, "gpio_in"),
301 SUNXI_FUNCTION(0x1, "gpio_out")), 447 SUNXI_FUNCTION(0x1, "gpio_out"),
448 SUNXI_FUNCTION(0x2, "lcd0"), /* D18 */
449 SUNXI_FUNCTION(0x3, "lvds1")), /* VP3 */
302 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19, 450 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19,
303 SUNXI_FUNCTION(0x0, "gpio_in"), 451 SUNXI_FUNCTION(0x0, "gpio_in"),
304 SUNXI_FUNCTION(0x1, "gpio_out")), 452 SUNXI_FUNCTION(0x1, "gpio_out"),
453 SUNXI_FUNCTION(0x2, "lcd0"), /* D19 */
454 SUNXI_FUNCTION(0x3, "lvds1")), /* VN3 */
305 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20, 455 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20,
306 SUNXI_FUNCTION(0x0, "gpio_in"), 456 SUNXI_FUNCTION(0x0, "gpio_in"),
307 SUNXI_FUNCTION(0x1, "gpio_out")), 457 SUNXI_FUNCTION(0x1, "gpio_out"),
458 SUNXI_FUNCTION(0x2, "lcd0"), /* D20 */
459 SUNXI_FUNCTION(0x3, "csi1")), /* MCLK */
308 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21, 460 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21,
309 SUNXI_FUNCTION(0x0, "gpio_in"), 461 SUNXI_FUNCTION(0x0, "gpio_in"),
310 SUNXI_FUNCTION(0x1, "gpio_out")), 462 SUNXI_FUNCTION(0x1, "gpio_out"),
463 SUNXI_FUNCTION(0x2, "lcd0"), /* D21 */
464 SUNXI_FUNCTION(0x3, "sim")), /* VPPEN */
311 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22, 465 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22,
312 SUNXI_FUNCTION(0x0, "gpio_in"), 466 SUNXI_FUNCTION(0x0, "gpio_in"),
313 SUNXI_FUNCTION(0x1, "gpio_out")), 467 SUNXI_FUNCTION(0x1, "gpio_out"),
468 SUNXI_FUNCTION(0x2, "lcd0"), /* D22 */
469 SUNXI_FUNCTION(0x3, "sim")), /* VPPPP */
314 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23, 470 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23,
315 SUNXI_FUNCTION(0x0, "gpio_in"), 471 SUNXI_FUNCTION(0x0, "gpio_in"),
316 SUNXI_FUNCTION(0x1, "gpio_out")), 472 SUNXI_FUNCTION(0x1, "gpio_out"),
473 SUNXI_FUNCTION(0x2, "lcd0"), /* D23 */
474 SUNXI_FUNCTION(0x3, "sim")), /* DET */
317 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24, 475 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24,
318 SUNXI_FUNCTION(0x0, "gpio_in"), 476 SUNXI_FUNCTION(0x0, "gpio_in"),
319 SUNXI_FUNCTION(0x1, "gpio_out")), 477 SUNXI_FUNCTION(0x1, "gpio_out"),
478 SUNXI_FUNCTION(0x2, "lcd0"), /* CLK */
479 SUNXI_FUNCTION(0x3, "sim")), /* VCCEN */
320 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25, 480 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25,
321 SUNXI_FUNCTION(0x0, "gpio_in"), 481 SUNXI_FUNCTION(0x0, "gpio_in"),
322 SUNXI_FUNCTION(0x1, "gpio_out")), 482 SUNXI_FUNCTION(0x1, "gpio_out"),
483 SUNXI_FUNCTION(0x2, "lcd0"), /* DE */
484 SUNXI_FUNCTION(0x3, "sim")), /* RST */
323 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26, 485 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26,
324 SUNXI_FUNCTION(0x0, "gpio_in"), 486 SUNXI_FUNCTION(0x0, "gpio_in"),
325 SUNXI_FUNCTION(0x1, "gpio_out")), 487 SUNXI_FUNCTION(0x1, "gpio_out"),
488 SUNXI_FUNCTION(0x2, "lcd0"), /* HSYNC */
489 SUNXI_FUNCTION(0x3, "sim")), /* SCK */
326 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27, 490 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27,
327 SUNXI_FUNCTION(0x0, "gpio_in"), 491 SUNXI_FUNCTION(0x0, "gpio_in"),
328 SUNXI_FUNCTION(0x1, "gpio_out")), 492 SUNXI_FUNCTION(0x1, "gpio_out"),
493 SUNXI_FUNCTION(0x2, "lcd0"), /* VSYNC */
494 SUNXI_FUNCTION(0x3, "sim")), /* SDA */
329 /* Hole */ 495 /* Hole */
330 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0, 496 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0,
331 SUNXI_FUNCTION(0x0, "gpio_in"), 497 SUNXI_FUNCTION(0x0, "gpio_in"),
332 SUNXI_FUNCTION(0x1, "gpio_out")), 498 SUNXI_FUNCTION(0x1, "gpio_out"),
499 SUNXI_FUNCTION(0x2, "ts0"), /* CLK */
500 SUNXI_FUNCTION(0x3, "csi0")), /* PCK */
333 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1, 501 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1,
334 SUNXI_FUNCTION(0x0, "gpio_in"), 502 SUNXI_FUNCTION(0x0, "gpio_in"),
335 SUNXI_FUNCTION(0x1, "gpio_out")), 503 SUNXI_FUNCTION(0x1, "gpio_out"),
504 SUNXI_FUNCTION(0x2, "ts0"), /* ERR */
505 SUNXI_FUNCTION(0x3, "csi0")), /* CK */
336 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2, 506 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2,
337 SUNXI_FUNCTION(0x0, "gpio_in"), 507 SUNXI_FUNCTION(0x0, "gpio_in"),
338 SUNXI_FUNCTION(0x1, "gpio_out")), 508 SUNXI_FUNCTION(0x1, "gpio_out"),
509 SUNXI_FUNCTION(0x2, "ts0"), /* SYNC */
510 SUNXI_FUNCTION(0x3, "csi0")), /* HSYNC */
339 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3, 511 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3,
340 SUNXI_FUNCTION(0x0, "gpio_in"), 512 SUNXI_FUNCTION(0x0, "gpio_in"),
341 SUNXI_FUNCTION(0x1, "gpio_out")), 513 SUNXI_FUNCTION(0x1, "gpio_out"),
514 SUNXI_FUNCTION(0x2, "ts0"), /* DVLD */
515 SUNXI_FUNCTION(0x3, "csi0")), /* VSYNC */
342 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4, 516 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4,
343 SUNXI_FUNCTION(0x0, "gpio_in"), 517 SUNXI_FUNCTION(0x0, "gpio_in"),
344 SUNXI_FUNCTION(0x1, "gpio_out")), 518 SUNXI_FUNCTION(0x1, "gpio_out"),
519 SUNXI_FUNCTION(0x2, "ts0"), /* D0 */
520 SUNXI_FUNCTION(0x3, "csi0")), /* D0 */
345 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5, 521 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5,
346 SUNXI_FUNCTION(0x0, "gpio_in"), 522 SUNXI_FUNCTION(0x0, "gpio_in"),
347 SUNXI_FUNCTION(0x1, "gpio_out")), 523 SUNXI_FUNCTION(0x1, "gpio_out"),
524 SUNXI_FUNCTION(0x2, "ts0"), /* D1 */
525 SUNXI_FUNCTION(0x3, "csi0"), /* D1 */
526 SUNXI_FUNCTION(0x4, "sim")), /* VPPEN */
348 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6, 527 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6,
349 SUNXI_FUNCTION(0x0, "gpio_in"), 528 SUNXI_FUNCTION(0x0, "gpio_in"),
350 SUNXI_FUNCTION(0x1, "gpio_out")), 529 SUNXI_FUNCTION(0x1, "gpio_out"),
530 SUNXI_FUNCTION(0x2, "ts0"), /* D2 */
531 SUNXI_FUNCTION(0x3, "csi0")), /* D2 */
351 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7, 532 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7,
352 SUNXI_FUNCTION(0x0, "gpio_in"), 533 SUNXI_FUNCTION(0x0, "gpio_in"),
353 SUNXI_FUNCTION(0x1, "gpio_out")), 534 SUNXI_FUNCTION(0x1, "gpio_out"),
535 SUNXI_FUNCTION(0x2, "ts0"), /* D3 */
536 SUNXI_FUNCTION(0x3, "csi0")), /* D3 */
354 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8, 537 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8,
355 SUNXI_FUNCTION(0x0, "gpio_in"), 538 SUNXI_FUNCTION(0x0, "gpio_in"),
356 SUNXI_FUNCTION(0x1, "gpio_out")), 539 SUNXI_FUNCTION(0x1, "gpio_out"),
540 SUNXI_FUNCTION(0x2, "ts0"), /* D4 */
541 SUNXI_FUNCTION(0x3, "csi0")), /* D4 */
357 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9, 542 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9,
358 SUNXI_FUNCTION(0x0, "gpio_in"), 543 SUNXI_FUNCTION(0x0, "gpio_in"),
359 SUNXI_FUNCTION(0x1, "gpio_out")), 544 SUNXI_FUNCTION(0x1, "gpio_out"),
545 SUNXI_FUNCTION(0x2, "ts0"), /* D5 */
546 SUNXI_FUNCTION(0x3, "csi0")), /* D5 */
360 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10, 547 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10,
361 SUNXI_FUNCTION(0x0, "gpio_in"), 548 SUNXI_FUNCTION(0x0, "gpio_in"),
362 SUNXI_FUNCTION(0x1, "gpio_out")), 549 SUNXI_FUNCTION(0x1, "gpio_out"),
550 SUNXI_FUNCTION(0x2, "ts0"), /* D6 */
551 SUNXI_FUNCTION(0x3, "csi0")), /* D6 */
363 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11, 552 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11,
364 SUNXI_FUNCTION(0x0, "gpio_in"), 553 SUNXI_FUNCTION(0x0, "gpio_in"),
365 SUNXI_FUNCTION(0x1, "gpio_out")), 554 SUNXI_FUNCTION(0x1, "gpio_out"),
555 SUNXI_FUNCTION(0x2, "ts0"), /* D7 */
556 SUNXI_FUNCTION(0x3, "csi0")), /* D7 */
366 /* Hole */ 557 /* Hole */
367 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0, 558 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0,
368 SUNXI_FUNCTION(0x0, "gpio_in"), 559 SUNXI_FUNCTION(0x0, "gpio_in"),
369 SUNXI_FUNCTION(0x1, "gpio_out")), 560 SUNXI_FUNCTION(0x1, "gpio_out"),
561 SUNXI_FUNCTION(0x2, "mmc0"), /* D1 */
562 SUNXI_FUNCTION(0x4, "jtag")), /* MSI */
370 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1, 563 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1,
371 SUNXI_FUNCTION(0x0, "gpio_in"), 564 SUNXI_FUNCTION(0x0, "gpio_in"),
372 SUNXI_FUNCTION(0x1, "gpio_out")), 565 SUNXI_FUNCTION(0x1, "gpio_out"),
566 SUNXI_FUNCTION(0x2, "mmc0"), /* D0 */
567 SUNXI_FUNCTION(0x4, "jtag")), /* DI1 */
373 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2, 568 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2,
374 SUNXI_FUNCTION(0x0, "gpio_in"), 569 SUNXI_FUNCTION(0x0, "gpio_in"),
375 SUNXI_FUNCTION(0x1, "gpio_out"), 570 SUNXI_FUNCTION(0x1, "gpio_out"),
571 SUNXI_FUNCTION(0x2, "mmc0"), /* CLK */
376 SUNXI_FUNCTION(0x4, "uart0")), /* TX */ 572 SUNXI_FUNCTION(0x4, "uart0")), /* TX */
377 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3, 573 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3,
378 SUNXI_FUNCTION(0x0, "gpio_in"), 574 SUNXI_FUNCTION(0x0, "gpio_in"),
379 SUNXI_FUNCTION(0x1, "gpio_out")), 575 SUNXI_FUNCTION(0x1, "gpio_out"),
576 SUNXI_FUNCTION(0x2, "mmc0"), /* CMD */
577 SUNXI_FUNCTION(0x4, "jtag")), /* DO1 */
380 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4, 578 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4,
381 SUNXI_FUNCTION(0x0, "gpio_in"), 579 SUNXI_FUNCTION(0x0, "gpio_in"),
382 SUNXI_FUNCTION(0x1, "gpio_out"), 580 SUNXI_FUNCTION(0x1, "gpio_out"),
581 SUNXI_FUNCTION(0x2, "mmc0"), /* D3 */
383 SUNXI_FUNCTION(0x4, "uart0")), /* RX */ 582 SUNXI_FUNCTION(0x4, "uart0")), /* RX */
384 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5, 583 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5,
385 SUNXI_FUNCTION(0x0, "gpio_in"), 584 SUNXI_FUNCTION(0x0, "gpio_in"),
386 SUNXI_FUNCTION(0x1, "gpio_out")), 585 SUNXI_FUNCTION(0x1, "gpio_out"),
586 SUNXI_FUNCTION(0x2, "mmc0"), /* D2 */
587 SUNXI_FUNCTION(0x4, "jtag")), /* CK1 */
387 /* Hole */ 588 /* Hole */
388 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0, 589 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0,
389 SUNXI_FUNCTION(0x0, "gpio_in"), 590 SUNXI_FUNCTION(0x0, "gpio_in"),
390 SUNXI_FUNCTION(0x1, "gpio_out")), 591 SUNXI_FUNCTION(0x1, "gpio_out"),
592 SUNXI_FUNCTION(0x2, "ts1"), /* CLK */
593 SUNXI_FUNCTION(0x3, "csi1"), /* PCK */
594 SUNXI_FUNCTION(0x4, "mmc1")), /* CMD */
391 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG1, 595 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG1,
392 SUNXI_FUNCTION(0x0, "gpio_in"), 596 SUNXI_FUNCTION(0x0, "gpio_in"),
393 SUNXI_FUNCTION(0x1, "gpio_out")), 597 SUNXI_FUNCTION(0x1, "gpio_out"),
598 SUNXI_FUNCTION(0x2, "ts1"), /* ERR */
599 SUNXI_FUNCTION(0x3, "csi1"), /* CK */
600 SUNXI_FUNCTION(0x4, "mmc1")), /* CLK */
394 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG2, 601 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG2,
395 SUNXI_FUNCTION(0x0, "gpio_in"), 602 SUNXI_FUNCTION(0x0, "gpio_in"),
396 SUNXI_FUNCTION(0x1, "gpio_out")), 603 SUNXI_FUNCTION(0x1, "gpio_out"),
604 SUNXI_FUNCTION(0x2, "ts1"), /* SYNC */
605 SUNXI_FUNCTION(0x3, "csi1"), /* HSYNC */
606 SUNXI_FUNCTION(0x4, "mmc1")), /* D0 */
397 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3, 607 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3,
398 SUNXI_FUNCTION(0x0, "gpio_in"), 608 SUNXI_FUNCTION(0x0, "gpio_in"),
399 SUNXI_FUNCTION(0x1, "gpio_out")), 609 SUNXI_FUNCTION(0x1, "gpio_out"),
610 SUNXI_FUNCTION(0x2, "ts1"), /* DVLD */
611 SUNXI_FUNCTION(0x3, "csi1"), /* VSYNC */
612 SUNXI_FUNCTION(0x4, "mmc1")), /* D1 */
400 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4, 613 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4,
401 SUNXI_FUNCTION(0x0, "gpio_in"), 614 SUNXI_FUNCTION(0x0, "gpio_in"),
402 SUNXI_FUNCTION(0x1, "gpio_out")), 615 SUNXI_FUNCTION(0x1, "gpio_out"),
616 SUNXI_FUNCTION(0x2, "ts1"), /* D0 */
617 SUNXI_FUNCTION(0x3, "csi1"), /* D0 */
618 SUNXI_FUNCTION(0x4, "mmc1"), /* D2 */
619 SUNXI_FUNCTION(0x5, "csi0")), /* D8 */
403 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG5, 620 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG5,
404 SUNXI_FUNCTION(0x0, "gpio_in"), 621 SUNXI_FUNCTION(0x0, "gpio_in"),
405 SUNXI_FUNCTION(0x1, "gpio_out")), 622 SUNXI_FUNCTION(0x1, "gpio_out"),
623 SUNXI_FUNCTION(0x2, "ts1"), /* D1 */
624 SUNXI_FUNCTION(0x3, "csi1"), /* D1 */
625 SUNXI_FUNCTION(0x4, "mmc1"), /* D3 */
626 SUNXI_FUNCTION(0x5, "csi0")), /* D9 */
406 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG6, 627 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG6,
407 SUNXI_FUNCTION(0x0, "gpio_in"), 628 SUNXI_FUNCTION(0x0, "gpio_in"),
408 SUNXI_FUNCTION(0x1, "gpio_out")), 629 SUNXI_FUNCTION(0x1, "gpio_out"),
630 SUNXI_FUNCTION(0x2, "ts1"), /* D2 */
631 SUNXI_FUNCTION(0x3, "csi1"), /* D2 */
632 SUNXI_FUNCTION(0x4, "uart3"), /* TX */
633 SUNXI_FUNCTION(0x5, "csi0")), /* D10 */
409 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG7, 634 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG7,
410 SUNXI_FUNCTION(0x0, "gpio_in"), 635 SUNXI_FUNCTION(0x0, "gpio_in"),
411 SUNXI_FUNCTION(0x1, "gpio_out")), 636 SUNXI_FUNCTION(0x1, "gpio_out"),
637 SUNXI_FUNCTION(0x2, "ts1"), /* D3 */
638 SUNXI_FUNCTION(0x3, "csi1"), /* D3 */
639 SUNXI_FUNCTION(0x4, "uart3"), /* RX */
640 SUNXI_FUNCTION(0x5, "csi0")), /* D11 */
412 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG8, 641 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG8,
413 SUNXI_FUNCTION(0x0, "gpio_in"), 642 SUNXI_FUNCTION(0x0, "gpio_in"),
414 SUNXI_FUNCTION(0x1, "gpio_out")), 643 SUNXI_FUNCTION(0x1, "gpio_out"),
644 SUNXI_FUNCTION(0x2, "ts1"), /* D4 */
645 SUNXI_FUNCTION(0x3, "csi1"), /* D4 */
646 SUNXI_FUNCTION(0x4, "uart3"), /* RTS */
647 SUNXI_FUNCTION(0x5, "csi0")), /* D12 */
415 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9, 648 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9,
416 SUNXI_FUNCTION(0x0, "gpio_in"), 649 SUNXI_FUNCTION(0x0, "gpio_in"),
417 SUNXI_FUNCTION(0x1, "gpio_out")), 650 SUNXI_FUNCTION(0x1, "gpio_out"),
651 SUNXI_FUNCTION(0x2, "ts1"), /* D5 */
652 SUNXI_FUNCTION(0x3, "csi1"), /* D5 */
653 SUNXI_FUNCTION(0x4, "uart3"), /* CTS */
654 SUNXI_FUNCTION(0x5, "csi0")), /* D13 */
418 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10, 655 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10,
419 SUNXI_FUNCTION(0x0, "gpio_in"), 656 SUNXI_FUNCTION(0x0, "gpio_in"),
420 SUNXI_FUNCTION(0x1, "gpio_out")), 657 SUNXI_FUNCTION(0x1, "gpio_out"),
658 SUNXI_FUNCTION(0x2, "ts1"), /* D6 */
659 SUNXI_FUNCTION(0x3, "csi1"), /* D6 */
660 SUNXI_FUNCTION(0x4, "uart4"), /* TX */
661 SUNXI_FUNCTION(0x5, "csi0")), /* D14 */
421 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11, 662 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11,
422 SUNXI_FUNCTION(0x0, "gpio_in"), 663 SUNXI_FUNCTION(0x0, "gpio_in"),
423 SUNXI_FUNCTION(0x1, "gpio_out")), 664 SUNXI_FUNCTION(0x1, "gpio_out"),
665 SUNXI_FUNCTION(0x2, "ts1"), /* D7 */
666 SUNXI_FUNCTION(0x3, "csi1"), /* D7 */
667 SUNXI_FUNCTION(0x4, "uart4"), /* RX */
668 SUNXI_FUNCTION(0x5, "csi0")), /* D15 */
424 /* Hole */ 669 /* Hole */
425 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH0, 670 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH0,
426 SUNXI_FUNCTION(0x0, "gpio_in"), 671 SUNXI_FUNCTION(0x0, "gpio_in"),
427 SUNXI_FUNCTION(0x1, "gpio_out")), 672 SUNXI_FUNCTION(0x1, "gpio_out"),
673 SUNXI_FUNCTION(0x2, "lcd1"), /* D0 */
674 SUNXI_FUNCTION(0x3, "pata"), /* ATAA0 */
675 SUNXI_FUNCTION(0x4, "uart3"), /* TX */
676 SUNXI_FUNCTION(0x7, "csi1")), /* D0 */
428 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH1, 677 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH1,
429 SUNXI_FUNCTION(0x0, "gpio_in"), 678 SUNXI_FUNCTION(0x0, "gpio_in"),
430 SUNXI_FUNCTION(0x1, "gpio_out")), 679 SUNXI_FUNCTION(0x1, "gpio_out"),
680 SUNXI_FUNCTION(0x2, "lcd1"), /* D1 */
681 SUNXI_FUNCTION(0x3, "pata"), /* ATAA1 */
682 SUNXI_FUNCTION(0x4, "uart3"), /* RX */
683 SUNXI_FUNCTION(0x7, "csi1")), /* D1 */
431 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH2, 684 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH2,
432 SUNXI_FUNCTION(0x0, "gpio_in"), 685 SUNXI_FUNCTION(0x0, "gpio_in"),
433 SUNXI_FUNCTION(0x1, "gpio_out")), 686 SUNXI_FUNCTION(0x1, "gpio_out"),
687 SUNXI_FUNCTION(0x2, "lcd1"), /* D2 */
688 SUNXI_FUNCTION(0x3, "pata"), /* ATAA2 */
689 SUNXI_FUNCTION(0x4, "uart3"), /* RTS */
690 SUNXI_FUNCTION(0x7, "csi1")), /* D2 */
434 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH3, 691 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH3,
435 SUNXI_FUNCTION(0x0, "gpio_in"), 692 SUNXI_FUNCTION(0x0, "gpio_in"),
436 SUNXI_FUNCTION(0x1, "gpio_out")), 693 SUNXI_FUNCTION(0x1, "gpio_out"),
694 SUNXI_FUNCTION(0x2, "lcd1"), /* D3 */
695 SUNXI_FUNCTION(0x3, "pata"), /* ATAIRQ */
696 SUNXI_FUNCTION(0x4, "uart3"), /* CTS */
697 SUNXI_FUNCTION(0x7, "csi1")), /* D3 */
437 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH4, 698 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH4,
438 SUNXI_FUNCTION(0x0, "gpio_in"), 699 SUNXI_FUNCTION(0x0, "gpio_in"),
439 SUNXI_FUNCTION(0x1, "gpio_out")), 700 SUNXI_FUNCTION(0x1, "gpio_out"),
701 SUNXI_FUNCTION(0x2, "lcd1"), /* D4 */
702 SUNXI_FUNCTION(0x3, "pata"), /* ATAD0 */
703 SUNXI_FUNCTION(0x4, "uart4"), /* TX */
704 SUNXI_FUNCTION(0x7, "csi1")), /* D4 */
440 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH5, 705 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH5,
441 SUNXI_FUNCTION(0x0, "gpio_in"), 706 SUNXI_FUNCTION(0x0, "gpio_in"),
442 SUNXI_FUNCTION(0x1, "gpio_out")), 707 SUNXI_FUNCTION(0x1, "gpio_out"),
708 SUNXI_FUNCTION(0x2, "lcd1"), /* D5 */
709 SUNXI_FUNCTION(0x3, "pata"), /* ATAD1 */
710 SUNXI_FUNCTION(0x4, "uart4"), /* RX */
711 SUNXI_FUNCTION(0x7, "csi1")), /* D5 */
443 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH6, 712 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH6,
444 SUNXI_FUNCTION(0x0, "gpio_in"), 713 SUNXI_FUNCTION(0x0, "gpio_in"),
445 SUNXI_FUNCTION(0x1, "gpio_out")), 714 SUNXI_FUNCTION(0x1, "gpio_out"),
715 SUNXI_FUNCTION(0x2, "lcd1"), /* D6 */
716 SUNXI_FUNCTION(0x3, "pata"), /* ATAD2 */
717 SUNXI_FUNCTION(0x4, "uart5"), /* TX */
718 SUNXI_FUNCTION(0x5, "ms"), /* BS */
719 SUNXI_FUNCTION(0x7, "csi1")), /* D6 */
446 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH7, 720 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH7,
447 SUNXI_FUNCTION(0x0, "gpio_in"), 721 SUNXI_FUNCTION(0x0, "gpio_in"),
448 SUNXI_FUNCTION(0x1, "gpio_out")), 722 SUNXI_FUNCTION(0x1, "gpio_out"),
723 SUNXI_FUNCTION(0x2, "lcd1"), /* D7 */
724 SUNXI_FUNCTION(0x3, "pata"), /* ATAD3 */
725 SUNXI_FUNCTION(0x4, "uart5"), /* RX */
726 SUNXI_FUNCTION(0x5, "ms"), /* CLK */
727 SUNXI_FUNCTION(0x7, "csi1")), /* D7 */
449 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH8, 728 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH8,
450 SUNXI_FUNCTION(0x0, "gpio_in"), 729 SUNXI_FUNCTION(0x0, "gpio_in"),
451 SUNXI_FUNCTION(0x1, "gpio_out")), 730 SUNXI_FUNCTION(0x1, "gpio_out"),
731 SUNXI_FUNCTION(0x2, "lcd1"), /* D8 */
732 SUNXI_FUNCTION(0x3, "pata"), /* ATAD4 */
733 SUNXI_FUNCTION(0x4, "keypad"), /* IN0 */
734 SUNXI_FUNCTION(0x5, "ms"), /* D0 */
735 SUNXI_FUNCTION(0x7, "csi1")), /* D8 */
452 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH9, 736 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH9,
453 SUNXI_FUNCTION(0x0, "gpio_in"), 737 SUNXI_FUNCTION(0x0, "gpio_in"),
454 SUNXI_FUNCTION(0x1, "gpio_out")), 738 SUNXI_FUNCTION(0x1, "gpio_out"),
739 SUNXI_FUNCTION(0x2, "lcd1"), /* D9 */
740 SUNXI_FUNCTION(0x3, "pata"), /* ATAD5 */
741 SUNXI_FUNCTION(0x4, "keypad"), /* IN1 */
742 SUNXI_FUNCTION(0x5, "ms"), /* D1 */
743 SUNXI_FUNCTION(0x7, "csi1")), /* D9 */
455 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH10, 744 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH10,
456 SUNXI_FUNCTION(0x0, "gpio_in"), 745 SUNXI_FUNCTION(0x0, "gpio_in"),
457 SUNXI_FUNCTION(0x1, "gpio_out")), 746 SUNXI_FUNCTION(0x1, "gpio_out"),
747 SUNXI_FUNCTION(0x2, "lcd1"), /* D10 */
748 SUNXI_FUNCTION(0x3, "pata"), /* ATAD6 */
749 SUNXI_FUNCTION(0x4, "keypad"), /* IN2 */
750 SUNXI_FUNCTION(0x5, "ms"), /* D2 */
751 SUNXI_FUNCTION(0x7, "csi1")), /* D10 */
458 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH11, 752 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH11,
459 SUNXI_FUNCTION(0x0, "gpio_in"), 753 SUNXI_FUNCTION(0x0, "gpio_in"),
460 SUNXI_FUNCTION(0x1, "gpio_out")), 754 SUNXI_FUNCTION(0x1, "gpio_out"),
755 SUNXI_FUNCTION(0x2, "lcd1"), /* D11 */
756 SUNXI_FUNCTION(0x3, "pata"), /* ATAD7 */
757 SUNXI_FUNCTION(0x4, "keypad"), /* IN3 */
758 SUNXI_FUNCTION(0x5, "ms"), /* D3 */
759 SUNXI_FUNCTION(0x7, "csi1")), /* D11 */
461 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH12, 760 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH12,
462 SUNXI_FUNCTION(0x0, "gpio_in"), 761 SUNXI_FUNCTION(0x0, "gpio_in"),
463 SUNXI_FUNCTION(0x1, "gpio_out")), 762 SUNXI_FUNCTION(0x1, "gpio_out"),
763 SUNXI_FUNCTION(0x2, "lcd1"), /* D12 */
764 SUNXI_FUNCTION(0x3, "pata"), /* ATAD8 */
765 SUNXI_FUNCTION(0x4, "ps2"), /* SCK1 */
766 SUNXI_FUNCTION(0x7, "csi1")), /* D12 */
464 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH13, 767 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH13,
465 SUNXI_FUNCTION(0x0, "gpio_in"), 768 SUNXI_FUNCTION(0x0, "gpio_in"),
466 SUNXI_FUNCTION(0x1, "gpio_out")), 769 SUNXI_FUNCTION(0x1, "gpio_out"),
770 SUNXI_FUNCTION(0x2, "lcd1"), /* D13 */
771 SUNXI_FUNCTION(0x3, "pata"), /* ATAD9 */
772 SUNXI_FUNCTION(0x4, "ps2"), /* SDA1 */
773 SUNXI_FUNCTION(0x5, "sim"), /* RST */
774 SUNXI_FUNCTION(0x7, "csi1")), /* D13 */
467 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH14, 775 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH14,
468 SUNXI_FUNCTION(0x0, "gpio_in"), 776 SUNXI_FUNCTION(0x0, "gpio_in"),
469 SUNXI_FUNCTION(0x1, "gpio_out")), 777 SUNXI_FUNCTION(0x1, "gpio_out"),
778 SUNXI_FUNCTION(0x2, "lcd1"), /* D14 */
779 SUNXI_FUNCTION(0x3, "pata"), /* ATAD10 */
780 SUNXI_FUNCTION(0x4, "keypad"), /* IN4 */
781 SUNXI_FUNCTION(0x5, "sim"), /* VPPEN */
782 SUNXI_FUNCTION(0x7, "csi1")), /* D14 */
470 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH15, 783 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH15,
471 SUNXI_FUNCTION(0x0, "gpio_in"), 784 SUNXI_FUNCTION(0x0, "gpio_in"),
472 SUNXI_FUNCTION(0x1, "gpio_out")), 785 SUNXI_FUNCTION(0x1, "gpio_out"),
786 SUNXI_FUNCTION(0x2, "lcd1"), /* D15 */
787 SUNXI_FUNCTION(0x3, "pata"), /* ATAD11 */
788 SUNXI_FUNCTION(0x4, "keypad"), /* IN5 */
789 SUNXI_FUNCTION(0x5, "sim"), /* VPPPP */
790 SUNXI_FUNCTION(0x7, "csi1")), /* D15 */
473 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH16, 791 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH16,
474 SUNXI_FUNCTION(0x0, "gpio_in"), 792 SUNXI_FUNCTION(0x0, "gpio_in"),
475 SUNXI_FUNCTION(0x1, "gpio_out")), 793 SUNXI_FUNCTION(0x1, "gpio_out"),
794 SUNXI_FUNCTION(0x2, "lcd1"), /* D16 */
795 SUNXI_FUNCTION(0x3, "pata"), /* ATAD12 */
796 SUNXI_FUNCTION(0x4, "keypad"), /* IN6 */
797 SUNXI_FUNCTION(0x7, "csi1")), /* D16 */
476 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH17, 798 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH17,
477 SUNXI_FUNCTION(0x0, "gpio_in"), 799 SUNXI_FUNCTION(0x0, "gpio_in"),
478 SUNXI_FUNCTION(0x1, "gpio_out")), 800 SUNXI_FUNCTION(0x1, "gpio_out"),
801 SUNXI_FUNCTION(0x2, "lcd1"), /* D17 */
802 SUNXI_FUNCTION(0x3, "pata"), /* ATAD13 */
803 SUNXI_FUNCTION(0x4, "keypad"), /* IN7 */
804 SUNXI_FUNCTION(0x5, "sim"), /* VCCEN */
805 SUNXI_FUNCTION(0x7, "csi1")), /* D17 */
479 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH18, 806 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH18,
480 SUNXI_FUNCTION(0x0, "gpio_in"), 807 SUNXI_FUNCTION(0x0, "gpio_in"),
481 SUNXI_FUNCTION(0x1, "gpio_out")), 808 SUNXI_FUNCTION(0x1, "gpio_out"),
809 SUNXI_FUNCTION(0x2, "lcd1"), /* D18 */
810 SUNXI_FUNCTION(0x3, "pata"), /* ATAD14 */
811 SUNXI_FUNCTION(0x4, "keypad"), /* OUT0 */
812 SUNXI_FUNCTION(0x5, "sim"), /* SCK */
813 SUNXI_FUNCTION(0x7, "csi1")), /* D18 */
482 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH19, 814 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH19,
483 SUNXI_FUNCTION(0x0, "gpio_in"), 815 SUNXI_FUNCTION(0x0, "gpio_in"),
484 SUNXI_FUNCTION(0x1, "gpio_out")), 816 SUNXI_FUNCTION(0x1, "gpio_out"),
817 SUNXI_FUNCTION(0x2, "lcd1"), /* D19 */
818 SUNXI_FUNCTION(0x3, "pata"), /* ATAD15 */
819 SUNXI_FUNCTION(0x4, "keypad"), /* OUT1 */
820 SUNXI_FUNCTION(0x5, "sim"), /* SDA */
821 SUNXI_FUNCTION(0x7, "csi1")), /* D19 */
485 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH20, 822 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH20,
486 SUNXI_FUNCTION(0x0, "gpio_in"), 823 SUNXI_FUNCTION(0x0, "gpio_in"),
487 SUNXI_FUNCTION(0x1, "gpio_out")), 824 SUNXI_FUNCTION(0x1, "gpio_out"),
825 SUNXI_FUNCTION(0x2, "lcd1"), /* D20 */
826 SUNXI_FUNCTION(0x3, "pata"), /* ATAOE */
827 SUNXI_FUNCTION(0x4, "can"), /* TX */
828 SUNXI_FUNCTION(0x7, "csi1")), /* D20 */
488 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH21, 829 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH21,
489 SUNXI_FUNCTION(0x0, "gpio_in"), 830 SUNXI_FUNCTION(0x0, "gpio_in"),
490 SUNXI_FUNCTION(0x1, "gpio_out")), 831 SUNXI_FUNCTION(0x1, "gpio_out"),
832 SUNXI_FUNCTION(0x2, "lcd1"), /* D21 */
833 SUNXI_FUNCTION(0x3, "pata"), /* ATADREQ */
834 SUNXI_FUNCTION(0x4, "can"), /* RX */
835 SUNXI_FUNCTION(0x7, "csi1")), /* D21 */
491 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH22, 836 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH22,
492 SUNXI_FUNCTION(0x0, "gpio_in"), 837 SUNXI_FUNCTION(0x0, "gpio_in"),
493 SUNXI_FUNCTION(0x1, "gpio_out")), 838 SUNXI_FUNCTION(0x1, "gpio_out"),
839 SUNXI_FUNCTION(0x2, "lcd1"), /* D22 */
840 SUNXI_FUNCTION(0x3, "pata"), /* ATADACK */
841 SUNXI_FUNCTION(0x4, "keypad"), /* OUT2 */
842 SUNXI_FUNCTION(0x5, "mmc1"), /* CMD */
843 SUNXI_FUNCTION(0x7, "csi1")), /* D22 */
494 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH23, 844 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH23,
495 SUNXI_FUNCTION(0x0, "gpio_in"), 845 SUNXI_FUNCTION(0x0, "gpio_in"),
496 SUNXI_FUNCTION(0x1, "gpio_out")), 846 SUNXI_FUNCTION(0x1, "gpio_out"),
847 SUNXI_FUNCTION(0x2, "lcd1"), /* D23 */
848 SUNXI_FUNCTION(0x3, "pata"), /* ATACS0 */
849 SUNXI_FUNCTION(0x4, "keypad"), /* OUT3 */
850 SUNXI_FUNCTION(0x5, "mmc1"), /* CLK */
851 SUNXI_FUNCTION(0x7, "csi1")), /* D23 */
497 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH24, 852 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH24,
498 SUNXI_FUNCTION(0x0, "gpio_in"), 853 SUNXI_FUNCTION(0x0, "gpio_in"),
499 SUNXI_FUNCTION(0x1, "gpio_out")), 854 SUNXI_FUNCTION(0x1, "gpio_out"),
855 SUNXI_FUNCTION(0x2, "lcd1"), /* CLK */
856 SUNXI_FUNCTION(0x3, "pata"), /* ATACS1 */
857 SUNXI_FUNCTION(0x4, "keypad"), /* OUT4 */
858 SUNXI_FUNCTION(0x5, "mmc1"), /* D0 */
859 SUNXI_FUNCTION(0x7, "csi1")), /* PCLK */
500 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH25, 860 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH25,
501 SUNXI_FUNCTION(0x0, "gpio_in"), 861 SUNXI_FUNCTION(0x0, "gpio_in"),
502 SUNXI_FUNCTION(0x1, "gpio_out")), 862 SUNXI_FUNCTION(0x1, "gpio_out"),
863 SUNXI_FUNCTION(0x2, "lcd1"), /* DE */
864 SUNXI_FUNCTION(0x3, "pata"), /* ATAIORDY */
865 SUNXI_FUNCTION(0x4, "keypad"), /* OUT5 */
866 SUNXI_FUNCTION(0x5, "mmc1"), /* D1 */
867 SUNXI_FUNCTION(0x7, "csi1")), /* FIELD */
503 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH26, 868 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH26,
504 SUNXI_FUNCTION(0x0, "gpio_in"), 869 SUNXI_FUNCTION(0x0, "gpio_in"),
505 SUNXI_FUNCTION(0x1, "gpio_out")), 870 SUNXI_FUNCTION(0x1, "gpio_out"),
871 SUNXI_FUNCTION(0x2, "lcd1"), /* HSYNC */
872 SUNXI_FUNCTION(0x3, "pata"), /* ATAIOR */
873 SUNXI_FUNCTION(0x4, "keypad"), /* OUT6 */
874 SUNXI_FUNCTION(0x5, "mmc1"), /* D2 */
875 SUNXI_FUNCTION(0x7, "csi1")), /* HSYNC */
506 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH27, 876 SUNXI_PIN(SUNXI_PINCTRL_PIN_PH27,
507 SUNXI_FUNCTION(0x0, "gpio_in"), 877 SUNXI_FUNCTION(0x0, "gpio_in"),
508 SUNXI_FUNCTION(0x1, "gpio_out")), 878 SUNXI_FUNCTION(0x1, "gpio_out"),
879 SUNXI_FUNCTION(0x2, "lcd1"), /* VSYNC */
880 SUNXI_FUNCTION(0x3, "pata"), /* ATAIOW */
881 SUNXI_FUNCTION(0x4, "keypad"), /* OUT7 */
882 SUNXI_FUNCTION(0x5, "mmc1"), /* D3 */
883 SUNXI_FUNCTION(0x7, "csi1")), /* VSYNC */
509 /* Hole */ 884 /* Hole */
510 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI0, 885 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI0,
511 SUNXI_FUNCTION(0x0, "gpio_in"), 886 SUNXI_FUNCTION(0x0, "gpio_in"),
@@ -518,277 +893,401 @@ static const struct sunxi_desc_pin sun4i_a10_pins[] = {
518 SUNXI_FUNCTION(0x1, "gpio_out")), 893 SUNXI_FUNCTION(0x1, "gpio_out")),
519 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI3, 894 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI3,
520 SUNXI_FUNCTION(0x0, "gpio_in"), 895 SUNXI_FUNCTION(0x0, "gpio_in"),
521 SUNXI_FUNCTION(0x1, "gpio_out")), 896 SUNXI_FUNCTION(0x1, "gpio_out"),
897 SUNXI_FUNCTION(0x2, "pwm")), /* PWM1 */
522 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI4, 898 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI4,
523 SUNXI_FUNCTION(0x0, "gpio_in"), 899 SUNXI_FUNCTION(0x0, "gpio_in"),
524 SUNXI_FUNCTION(0x1, "gpio_out")), 900 SUNXI_FUNCTION(0x1, "gpio_out"),
901 SUNXI_FUNCTION(0x2, "mmc3")), /* CMD */
525 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI5, 902 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI5,
526 SUNXI_FUNCTION(0x0, "gpio_in"), 903 SUNXI_FUNCTION(0x0, "gpio_in"),
527 SUNXI_FUNCTION(0x1, "gpio_out")), 904 SUNXI_FUNCTION(0x1, "gpio_out"),
905 SUNXI_FUNCTION(0x2, "mmc3")), /* CLK */
528 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI6, 906 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI6,
529 SUNXI_FUNCTION(0x0, "gpio_in"), 907 SUNXI_FUNCTION(0x0, "gpio_in"),
530 SUNXI_FUNCTION(0x1, "gpio_out")), 908 SUNXI_FUNCTION(0x1, "gpio_out"),
909 SUNXI_FUNCTION(0x2, "mmc3")), /* D0 */
531 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI7, 910 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI7,
532 SUNXI_FUNCTION(0x0, "gpio_in"), 911 SUNXI_FUNCTION(0x0, "gpio_in"),
533 SUNXI_FUNCTION(0x1, "gpio_out")), 912 SUNXI_FUNCTION(0x1, "gpio_out"),
913 SUNXI_FUNCTION(0x2, "mmc3")), /* D1 */
534 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI8, 914 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI8,
535 SUNXI_FUNCTION(0x0, "gpio_in"), 915 SUNXI_FUNCTION(0x0, "gpio_in"),
536 SUNXI_FUNCTION(0x1, "gpio_out")), 916 SUNXI_FUNCTION(0x1, "gpio_out"),
917 SUNXI_FUNCTION(0x2, "mmc3")), /* D2 */
537 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI9, 918 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI9,
538 SUNXI_FUNCTION(0x0, "gpio_in"), 919 SUNXI_FUNCTION(0x0, "gpio_in"),
539 SUNXI_FUNCTION(0x1, "gpio_out")), 920 SUNXI_FUNCTION(0x1, "gpio_out"),
921 SUNXI_FUNCTION(0x2, "mmc3")), /* D3 */
540 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI10, 922 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI10,
541 SUNXI_FUNCTION(0x0, "gpio_in"), 923 SUNXI_FUNCTION(0x0, "gpio_in"),
542 SUNXI_FUNCTION(0x1, "gpio_out")), 924 SUNXI_FUNCTION(0x1, "gpio_out"),
925 SUNXI_FUNCTION(0x2, "spi0"), /* CS0 */
926 SUNXI_FUNCTION(0x3, "uart5")), /* TX */
543 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI11, 927 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI11,
544 SUNXI_FUNCTION(0x0, "gpio_in"), 928 SUNXI_FUNCTION(0x0, "gpio_in"),
545 SUNXI_FUNCTION(0x1, "gpio_out")), 929 SUNXI_FUNCTION(0x1, "gpio_out"),
930 SUNXI_FUNCTION(0x2, "spi0"), /* CLK */
931 SUNXI_FUNCTION(0x3, "uart5")), /* RX */
546 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI12, 932 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI12,
547 SUNXI_FUNCTION(0x0, "gpio_in"), 933 SUNXI_FUNCTION(0x0, "gpio_in"),
548 SUNXI_FUNCTION(0x1, "gpio_out")), 934 SUNXI_FUNCTION(0x1, "gpio_out"),
935 SUNXI_FUNCTION(0x2, "spi0"), /* MOSI */
936 SUNXI_FUNCTION(0x3, "uart6")), /* TX */
549 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI13, 937 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI13,
550 SUNXI_FUNCTION(0x0, "gpio_in"), 938 SUNXI_FUNCTION(0x0, "gpio_in"),
551 SUNXI_FUNCTION(0x1, "gpio_out")), 939 SUNXI_FUNCTION(0x1, "gpio_out"),
940 SUNXI_FUNCTION(0x2, "spi0"), /* MISO */
941 SUNXI_FUNCTION(0x3, "uart6")), /* RX */
552 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI14, 942 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI14,
553 SUNXI_FUNCTION(0x0, "gpio_in"), 943 SUNXI_FUNCTION(0x0, "gpio_in"),
554 SUNXI_FUNCTION(0x1, "gpio_out")), 944 SUNXI_FUNCTION(0x1, "gpio_out"),
945 SUNXI_FUNCTION(0x2, "spi0"), /* CS1 */
946 SUNXI_FUNCTION(0x3, "ps2"), /* SCK1 */
947 SUNXI_FUNCTION(0x4, "timer4")), /* TCLKIN0 */
555 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI15, 948 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI15,
556 SUNXI_FUNCTION(0x0, "gpio_in"), 949 SUNXI_FUNCTION(0x0, "gpio_in"),
557 SUNXI_FUNCTION(0x1, "gpio_out")), 950 SUNXI_FUNCTION(0x1, "gpio_out"),
951 SUNXI_FUNCTION(0x2, "spi1"), /* CS1 */
952 SUNXI_FUNCTION(0x3, "ps2"), /* SDA1 */
953 SUNXI_FUNCTION(0x4, "timer5")), /* TCLKIN1 */
558 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI16, 954 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI16,
559 SUNXI_FUNCTION(0x0, "gpio_in"), 955 SUNXI_FUNCTION(0x0, "gpio_in"),
560 SUNXI_FUNCTION(0x1, "gpio_out")), 956 SUNXI_FUNCTION(0x1, "gpio_out"),
957 SUNXI_FUNCTION(0x2, "spi1"), /* CS0 */
958 SUNXI_FUNCTION(0x3, "uart2")), /* RTS */
561 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI17, 959 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI17,
562 SUNXI_FUNCTION(0x0, "gpio_in"), 960 SUNXI_FUNCTION(0x0, "gpio_in"),
563 SUNXI_FUNCTION(0x1, "gpio_out")), 961 SUNXI_FUNCTION(0x1, "gpio_out"),
962 SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
963 SUNXI_FUNCTION(0x3, "uart2")), /* CTS */
564 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI18, 964 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI18,
565 SUNXI_FUNCTION(0x0, "gpio_in"), 965 SUNXI_FUNCTION(0x0, "gpio_in"),
566 SUNXI_FUNCTION(0x1, "gpio_out")), 966 SUNXI_FUNCTION(0x1, "gpio_out"),
967 SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
968 SUNXI_FUNCTION(0x3, "uart2")), /* TX */
567 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI19, 969 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI19,
568 SUNXI_FUNCTION(0x0, "gpio_in"), 970 SUNXI_FUNCTION(0x0, "gpio_in"),
569 SUNXI_FUNCTION(0x1, "gpio_out")), 971 SUNXI_FUNCTION(0x1, "gpio_out"),
972 SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
973 SUNXI_FUNCTION(0x3, "uart2")), /* RX */
570 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI20, 974 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI20,
571 SUNXI_FUNCTION(0x0, "gpio_in"), 975 SUNXI_FUNCTION(0x0, "gpio_in"),
572 SUNXI_FUNCTION(0x1, "gpio_out")), 976 SUNXI_FUNCTION(0x1, "gpio_out"),
977 SUNXI_FUNCTION(0x2, "ps2"), /* SCK0 */
978 SUNXI_FUNCTION(0x3, "uart7"), /* TX */
979 SUNXI_FUNCTION(0x4, "hdmi")), /* HSCL */
573 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI21, 980 SUNXI_PIN(SUNXI_PINCTRL_PIN_PI21,
574 SUNXI_FUNCTION(0x0, "gpio_in"), 981 SUNXI_FUNCTION(0x0, "gpio_in"),
575 SUNXI_FUNCTION(0x1, "gpio_out")), 982 SUNXI_FUNCTION(0x1, "gpio_out"),
983 SUNXI_FUNCTION(0x2, "ps2"), /* SDA0 */
984 SUNXI_FUNCTION(0x3, "uart7"), /* RX */
985 SUNXI_FUNCTION(0x4, "hdmi")), /* HSDA */
576}; 986};
577 987
578static const struct sunxi_desc_pin sun5i_a13_pins[] = { 988static const struct sunxi_desc_pin sun5i_a13_pins[] = {
579 /* Hole */ 989 /* Hole */
580 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0, 990 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB0,
581 SUNXI_FUNCTION(0x0, "gpio_in"), 991 SUNXI_FUNCTION(0x0, "gpio_in"),
582 SUNXI_FUNCTION(0x1, "gpio_out")), 992 SUNXI_FUNCTION(0x1, "gpio_out"),
993 SUNXI_FUNCTION(0x2, "i2c0")), /* SCK */
583 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1, 994 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB1,
584 SUNXI_FUNCTION(0x0, "gpio_in"), 995 SUNXI_FUNCTION(0x0, "gpio_in"),
585 SUNXI_FUNCTION(0x1, "gpio_out")), 996 SUNXI_FUNCTION(0x1, "gpio_out"),
997 SUNXI_FUNCTION(0x2, "i2c0")), /* SDA */
586 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2, 998 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB2,
587 SUNXI_FUNCTION(0x0, "gpio_in"), 999 SUNXI_FUNCTION(0x0, "gpio_in"),
588 SUNXI_FUNCTION(0x1, "gpio_out")), 1000 SUNXI_FUNCTION(0x1, "gpio_out"),
1001 SUNXI_FUNCTION(0x2, "pwm")),
589 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3, 1002 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB3,
590 SUNXI_FUNCTION(0x0, "gpio_in"), 1003 SUNXI_FUNCTION(0x0, "gpio_in"),
591 SUNXI_FUNCTION(0x1, "gpio_out")), 1004 SUNXI_FUNCTION(0x1, "gpio_out"),
1005 SUNXI_FUNCTION(0x2, "ir0")), /* TX */
592 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4, 1006 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB4,
593 SUNXI_FUNCTION(0x0, "gpio_in"), 1007 SUNXI_FUNCTION(0x0, "gpio_in"),
594 SUNXI_FUNCTION(0x1, "gpio_out")), 1008 SUNXI_FUNCTION(0x1, "gpio_out"),
1009 SUNXI_FUNCTION(0x2, "ir0")), /* RX */
595 /* Hole */ 1010 /* Hole */
596 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10, 1011 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB10,
597 SUNXI_FUNCTION(0x0, "gpio_in"), 1012 SUNXI_FUNCTION(0x0, "gpio_in"),
598 SUNXI_FUNCTION(0x1, "gpio_out")), 1013 SUNXI_FUNCTION(0x1, "gpio_out"),
1014 SUNXI_FUNCTION(0x2, "spi2")), /* CS1 */
599 /* Hole */ 1015 /* Hole */
600 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15, 1016 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB15,
601 SUNXI_FUNCTION(0x0, "gpio_in"), 1017 SUNXI_FUNCTION(0x0, "gpio_in"),
602 SUNXI_FUNCTION(0x1, "gpio_out")), 1018 SUNXI_FUNCTION(0x1, "gpio_out"),
1019 SUNXI_FUNCTION(0x2, "i2c1")), /* SCK */
603 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16, 1020 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB16,
604 SUNXI_FUNCTION(0x0, "gpio_in"), 1021 SUNXI_FUNCTION(0x0, "gpio_in"),
605 SUNXI_FUNCTION(0x1, "gpio_out")), 1022 SUNXI_FUNCTION(0x1, "gpio_out"),
1023 SUNXI_FUNCTION(0x2, "i2c1")), /* SDA */
606 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17, 1024 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB17,
607 SUNXI_FUNCTION(0x0, "gpio_in"), 1025 SUNXI_FUNCTION(0x0, "gpio_in"),
608 SUNXI_FUNCTION(0x1, "gpio_out")), 1026 SUNXI_FUNCTION(0x1, "gpio_out"),
1027 SUNXI_FUNCTION(0x2, "i2c2")), /* SCK */
609 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18, 1028 SUNXI_PIN(SUNXI_PINCTRL_PIN_PB18,
610 SUNXI_FUNCTION(0x0, "gpio_in"), 1029 SUNXI_FUNCTION(0x0, "gpio_in"),
611 SUNXI_FUNCTION(0x1, "gpio_out")), 1030 SUNXI_FUNCTION(0x1, "gpio_out"),
1031 SUNXI_FUNCTION(0x2, "i2c2")), /* SDA */
612 /* Hole */ 1032 /* Hole */
613 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0, 1033 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC0,
614 SUNXI_FUNCTION(0x0, "gpio_in"), 1034 SUNXI_FUNCTION(0x0, "gpio_in"),
615 SUNXI_FUNCTION(0x1, "gpio_out")), 1035 SUNXI_FUNCTION(0x1, "gpio_out"),
1036 SUNXI_FUNCTION(0x2, "nand0"), /* NWE */
1037 SUNXI_FUNCTION(0x3, "spi0")), /* MOSI */
616 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1, 1038 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC1,
617 SUNXI_FUNCTION(0x0, "gpio_in"), 1039 SUNXI_FUNCTION(0x0, "gpio_in"),
618 SUNXI_FUNCTION(0x1, "gpio_out")), 1040 SUNXI_FUNCTION(0x1, "gpio_out"),
1041 SUNXI_FUNCTION(0x2, "nand0"), /* NALE */
1042 SUNXI_FUNCTION(0x3, "spi0")), /* MISO */
619 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2, 1043 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC2,
620 SUNXI_FUNCTION(0x0, "gpio_in"), 1044 SUNXI_FUNCTION(0x0, "gpio_in"),
621 SUNXI_FUNCTION(0x1, "gpio_out")), 1045 SUNXI_FUNCTION(0x1, "gpio_out"),
1046 SUNXI_FUNCTION(0x2, "nand0"), /* NCLE */
1047 SUNXI_FUNCTION(0x3, "spi0")), /* CLK */
622 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3, 1048 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC3,
623 SUNXI_FUNCTION(0x0, "gpio_in"), 1049 SUNXI_FUNCTION(0x0, "gpio_in"),
624 SUNXI_FUNCTION(0x1, "gpio_out")), 1050 SUNXI_FUNCTION(0x1, "gpio_out"),
1051 SUNXI_FUNCTION(0x2, "nand0"), /* NCE1 */
1052 SUNXI_FUNCTION(0x3, "spi0")), /* CS0 */
625 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4, 1053 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC4,
626 SUNXI_FUNCTION(0x0, "gpio_in"), 1054 SUNXI_FUNCTION(0x0, "gpio_in"),
627 SUNXI_FUNCTION(0x1, "gpio_out")), 1055 SUNXI_FUNCTION(0x1, "gpio_out"),
1056 SUNXI_FUNCTION(0x2, "nand0")), /* NCE0 */
628 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5, 1057 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC5,
629 SUNXI_FUNCTION(0x0, "gpio_in"), 1058 SUNXI_FUNCTION(0x0, "gpio_in"),
630 SUNXI_FUNCTION(0x1, "gpio_out")), 1059 SUNXI_FUNCTION(0x1, "gpio_out"),
1060 SUNXI_FUNCTION(0x2, "nand0")), /* NRE */
631 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6, 1061 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC6,
632 SUNXI_FUNCTION(0x0, "gpio_in"), 1062 SUNXI_FUNCTION(0x0, "gpio_in"),
633 SUNXI_FUNCTION(0x1, "gpio_out")), 1063 SUNXI_FUNCTION(0x1, "gpio_out"),
1064 SUNXI_FUNCTION(0x2, "nand0"), /* NRB0 */
1065 SUNXI_FUNCTION(0x3, "mmc2")), /* CMD */
634 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7, 1066 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC7,
635 SUNXI_FUNCTION(0x0, "gpio_in"), 1067 SUNXI_FUNCTION(0x0, "gpio_in"),
636 SUNXI_FUNCTION(0x1, "gpio_out")), 1068 SUNXI_FUNCTION(0x1, "gpio_out"),
1069 SUNXI_FUNCTION(0x2, "nand0"), /* NRB1 */
1070 SUNXI_FUNCTION(0x3, "mmc2")), /* CLK */
637 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8, 1071 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC8,
638 SUNXI_FUNCTION(0x0, "gpio_in"), 1072 SUNXI_FUNCTION(0x0, "gpio_in"),
639 SUNXI_FUNCTION(0x1, "gpio_out")), 1073 SUNXI_FUNCTION(0x1, "gpio_out"),
1074 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ0 */
1075 SUNXI_FUNCTION(0x3, "mmc2")), /* D0 */
640 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9, 1076 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC9,
641 SUNXI_FUNCTION(0x0, "gpio_in"), 1077 SUNXI_FUNCTION(0x0, "gpio_in"),
642 SUNXI_FUNCTION(0x1, "gpio_out")), 1078 SUNXI_FUNCTION(0x1, "gpio_out"),
1079 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ1 */
1080 SUNXI_FUNCTION(0x3, "mmc2")), /* D1 */
643 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10, 1081 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC10,
644 SUNXI_FUNCTION(0x0, "gpio_in"), 1082 SUNXI_FUNCTION(0x0, "gpio_in"),
645 SUNXI_FUNCTION(0x1, "gpio_out")), 1083 SUNXI_FUNCTION(0x1, "gpio_out"),
1084 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ2 */
1085 SUNXI_FUNCTION(0x3, "mmc2")), /* D2 */
646 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11, 1086 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC11,
647 SUNXI_FUNCTION(0x0, "gpio_in"), 1087 SUNXI_FUNCTION(0x0, "gpio_in"),
648 SUNXI_FUNCTION(0x1, "gpio_out")), 1088 SUNXI_FUNCTION(0x1, "gpio_out"),
1089 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ3 */
1090 SUNXI_FUNCTION(0x3, "mmc2")), /* D3 */
649 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12, 1091 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC12,
650 SUNXI_FUNCTION(0x0, "gpio_in"), 1092 SUNXI_FUNCTION(0x0, "gpio_in"),
651 SUNXI_FUNCTION(0x1, "gpio_out")), 1093 SUNXI_FUNCTION(0x1, "gpio_out"),
1094 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ4 */
1095 SUNXI_FUNCTION(0x3, "mmc2")), /* D4 */
652 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13, 1096 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC13,
653 SUNXI_FUNCTION(0x0, "gpio_in"), 1097 SUNXI_FUNCTION(0x0, "gpio_in"),
654 SUNXI_FUNCTION(0x1, "gpio_out")), 1098 SUNXI_FUNCTION(0x1, "gpio_out"),
1099 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ5 */
1100 SUNXI_FUNCTION(0x3, "mmc2")), /* D5 */
655 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14, 1101 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC14,
656 SUNXI_FUNCTION(0x0, "gpio_in"), 1102 SUNXI_FUNCTION(0x0, "gpio_in"),
657 SUNXI_FUNCTION(0x1, "gpio_out")), 1103 SUNXI_FUNCTION(0x1, "gpio_out"),
1104 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ6 */
1105 SUNXI_FUNCTION(0x3, "mmc2")), /* D6 */
658 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15, 1106 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC15,
659 SUNXI_FUNCTION(0x0, "gpio_in"), 1107 SUNXI_FUNCTION(0x0, "gpio_in"),
660 SUNXI_FUNCTION(0x1, "gpio_out")), 1108 SUNXI_FUNCTION(0x1, "gpio_out"),
1109 SUNXI_FUNCTION(0x2, "nand0"), /* NDQ7 */
1110 SUNXI_FUNCTION(0x3, "mmc2")), /* D7 */
661 /* Hole */ 1111 /* Hole */
662 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19, 1112 SUNXI_PIN(SUNXI_PINCTRL_PIN_PC19,
663 SUNXI_FUNCTION(0x0, "gpio_in"), 1113 SUNXI_FUNCTION(0x0, "gpio_in"),
664 SUNXI_FUNCTION(0x1, "gpio_out")), 1114 SUNXI_FUNCTION(0x1, "gpio_out"),
1115 SUNXI_FUNCTION(0x2, "nand0"), /* NDQS */
1116 SUNXI_FUNCTION(0x4, "uart3")), /* RTS */
665 /* Hole */ 1117 /* Hole */
666 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2, 1118 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD2,
667 SUNXI_FUNCTION(0x0, "gpio_in"), 1119 SUNXI_FUNCTION(0x0, "gpio_in"),
668 SUNXI_FUNCTION(0x1, "gpio_out")), 1120 SUNXI_FUNCTION(0x1, "gpio_out"),
1121 SUNXI_FUNCTION(0x2, "lcd0")), /* D2 */
669 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3, 1122 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD3,
670 SUNXI_FUNCTION(0x0, "gpio_in"), 1123 SUNXI_FUNCTION(0x0, "gpio_in"),
671 SUNXI_FUNCTION(0x1, "gpio_out")), 1124 SUNXI_FUNCTION(0x1, "gpio_out"),
1125 SUNXI_FUNCTION(0x2, "lcd0")), /* D3 */
672 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4, 1126 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD4,
673 SUNXI_FUNCTION(0x0, "gpio_in"), 1127 SUNXI_FUNCTION(0x0, "gpio_in"),
674 SUNXI_FUNCTION(0x1, "gpio_out")), 1128 SUNXI_FUNCTION(0x1, "gpio_out"),
1129 SUNXI_FUNCTION(0x2, "lcd0")), /* D4 */
675 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5, 1130 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD5,
676 SUNXI_FUNCTION(0x0, "gpio_in"), 1131 SUNXI_FUNCTION(0x0, "gpio_in"),
677 SUNXI_FUNCTION(0x1, "gpio_out")), 1132 SUNXI_FUNCTION(0x1, "gpio_out"),
1133 SUNXI_FUNCTION(0x2, "lcd0")), /* D5 */
678 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6, 1134 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD6,
679 SUNXI_FUNCTION(0x0, "gpio_in"), 1135 SUNXI_FUNCTION(0x0, "gpio_in"),
680 SUNXI_FUNCTION(0x1, "gpio_out")), 1136 SUNXI_FUNCTION(0x1, "gpio_out"),
1137 SUNXI_FUNCTION(0x2, "lcd0")), /* D6 */
681 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7, 1138 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD7,
682 SUNXI_FUNCTION(0x0, "gpio_in"), 1139 SUNXI_FUNCTION(0x0, "gpio_in"),
683 SUNXI_FUNCTION(0x1, "gpio_out")), 1140 SUNXI_FUNCTION(0x1, "gpio_out"),
1141 SUNXI_FUNCTION(0x2, "lcd0")), /* D7 */
684 /* Hole */ 1142 /* Hole */
685 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10, 1143 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD10,
686 SUNXI_FUNCTION(0x0, "gpio_in"), 1144 SUNXI_FUNCTION(0x0, "gpio_in"),
687 SUNXI_FUNCTION(0x1, "gpio_out")), 1145 SUNXI_FUNCTION(0x1, "gpio_out"),
1146 SUNXI_FUNCTION(0x2, "lcd0")), /* D10 */
688 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11, 1147 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD11,
689 SUNXI_FUNCTION(0x0, "gpio_in"), 1148 SUNXI_FUNCTION(0x0, "gpio_in"),
690 SUNXI_FUNCTION(0x1, "gpio_out")), 1149 SUNXI_FUNCTION(0x1, "gpio_out"),
1150 SUNXI_FUNCTION(0x2, "lcd0")), /* D11 */
691 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12, 1151 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD12,
692 SUNXI_FUNCTION(0x0, "gpio_in"), 1152 SUNXI_FUNCTION(0x0, "gpio_in"),
693 SUNXI_FUNCTION(0x1, "gpio_out")), 1153 SUNXI_FUNCTION(0x1, "gpio_out"),
1154 SUNXI_FUNCTION(0x2, "lcd0")), /* D12 */
694 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13, 1155 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD13,
695 SUNXI_FUNCTION(0x0, "gpio_in"), 1156 SUNXI_FUNCTION(0x0, "gpio_in"),
696 SUNXI_FUNCTION(0x1, "gpio_out")), 1157 SUNXI_FUNCTION(0x1, "gpio_out"),
1158 SUNXI_FUNCTION(0x2, "lcd0")), /* D13 */
697 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14, 1159 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD14,
698 SUNXI_FUNCTION(0x0, "gpio_in"), 1160 SUNXI_FUNCTION(0x0, "gpio_in"),
699 SUNXI_FUNCTION(0x1, "gpio_out")), 1161 SUNXI_FUNCTION(0x1, "gpio_out"),
1162 SUNXI_FUNCTION(0x2, "lcd0")), /* D14 */
700 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15, 1163 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD15,
701 SUNXI_FUNCTION(0x0, "gpio_in"), 1164 SUNXI_FUNCTION(0x0, "gpio_in"),
702 SUNXI_FUNCTION(0x1, "gpio_out")), 1165 SUNXI_FUNCTION(0x1, "gpio_out"),
1166 SUNXI_FUNCTION(0x2, "lcd0")), /* D15 */
703 /* Hole */ 1167 /* Hole */
704 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18, 1168 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD18,
705 SUNXI_FUNCTION(0x0, "gpio_in"), 1169 SUNXI_FUNCTION(0x0, "gpio_in"),
706 SUNXI_FUNCTION(0x1, "gpio_out")), 1170 SUNXI_FUNCTION(0x1, "gpio_out"),
1171 SUNXI_FUNCTION(0x2, "lcd0")), /* D18 */
707 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19, 1172 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD19,
708 SUNXI_FUNCTION(0x0, "gpio_in"), 1173 SUNXI_FUNCTION(0x0, "gpio_in"),
709 SUNXI_FUNCTION(0x1, "gpio_out")), 1174 SUNXI_FUNCTION(0x1, "gpio_out"),
1175 SUNXI_FUNCTION(0x2, "lcd0")), /* D19 */
710 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20, 1176 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD20,
711 SUNXI_FUNCTION(0x0, "gpio_in"), 1177 SUNXI_FUNCTION(0x0, "gpio_in"),
712 SUNXI_FUNCTION(0x1, "gpio_out")), 1178 SUNXI_FUNCTION(0x1, "gpio_out"),
1179 SUNXI_FUNCTION(0x2, "lcd0")), /* D20 */
713 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21, 1180 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD21,
714 SUNXI_FUNCTION(0x0, "gpio_in"), 1181 SUNXI_FUNCTION(0x0, "gpio_in"),
715 SUNXI_FUNCTION(0x1, "gpio_out")), 1182 SUNXI_FUNCTION(0x1, "gpio_out"),
1183 SUNXI_FUNCTION(0x2, "lcd0")), /* D21 */
716 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22, 1184 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD22,
717 SUNXI_FUNCTION(0x0, "gpio_in"), 1185 SUNXI_FUNCTION(0x0, "gpio_in"),
718 SUNXI_FUNCTION(0x1, "gpio_out")), 1186 SUNXI_FUNCTION(0x1, "gpio_out"),
1187 SUNXI_FUNCTION(0x2, "lcd0")), /* D22 */
719 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23, 1188 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD23,
720 SUNXI_FUNCTION(0x0, "gpio_in"), 1189 SUNXI_FUNCTION(0x0, "gpio_in"),
721 SUNXI_FUNCTION(0x1, "gpio_out")), 1190 SUNXI_FUNCTION(0x1, "gpio_out"),
1191 SUNXI_FUNCTION(0x2, "lcd0")), /* D23 */
722 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24, 1192 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD24,
723 SUNXI_FUNCTION(0x0, "gpio_in"), 1193 SUNXI_FUNCTION(0x0, "gpio_in"),
724 SUNXI_FUNCTION(0x1, "gpio_out")), 1194 SUNXI_FUNCTION(0x1, "gpio_out"),
1195 SUNXI_FUNCTION(0x2, "lcd0")), /* CLK */
725 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25, 1196 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD25,
726 SUNXI_FUNCTION(0x0, "gpio_in"), 1197 SUNXI_FUNCTION(0x0, "gpio_in"),
727 SUNXI_FUNCTION(0x1, "gpio_out")), 1198 SUNXI_FUNCTION(0x1, "gpio_out"),
1199 SUNXI_FUNCTION(0x2, "lcd0")), /* DE */
728 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26, 1200 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD26,
729 SUNXI_FUNCTION(0x0, "gpio_in"), 1201 SUNXI_FUNCTION(0x0, "gpio_in"),
730 SUNXI_FUNCTION(0x1, "gpio_out")), 1202 SUNXI_FUNCTION(0x1, "gpio_out"),
1203 SUNXI_FUNCTION(0x2, "lcd0")), /* HSYNC */
731 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27, 1204 SUNXI_PIN(SUNXI_PINCTRL_PIN_PD27,
732 SUNXI_FUNCTION(0x0, "gpio_in"), 1205 SUNXI_FUNCTION(0x0, "gpio_in"),
733 SUNXI_FUNCTION(0x1, "gpio_out")), 1206 SUNXI_FUNCTION(0x1, "gpio_out"),
1207 SUNXI_FUNCTION(0x2, "lcd0")), /* VSYNC */
734 /* Hole */ 1208 /* Hole */
735 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0, 1209 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE0,
736 SUNXI_FUNCTION(0x0, "gpio_in"), 1210 SUNXI_FUNCTION(0x0, "gpio_in"),
737 SUNXI_FUNCTION(0x1, "gpio_out")), 1211 SUNXI_FUNCTION(0x3, "csi0"), /* PCLK */
1212 SUNXI_FUNCTION(0x4, "spi2")), /* CS0 */
738 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1, 1213 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE1,
739 SUNXI_FUNCTION(0x0, "gpio_in"), 1214 SUNXI_FUNCTION(0x0, "gpio_in"),
740 SUNXI_FUNCTION(0x1, "gpio_out")), 1215 SUNXI_FUNCTION(0x3, "csi0"), /* MCLK */
1216 SUNXI_FUNCTION(0x4, "spi2")), /* CLK */
741 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2, 1217 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE2,
742 SUNXI_FUNCTION(0x0, "gpio_in"), 1218 SUNXI_FUNCTION(0x0, "gpio_in"),
743 SUNXI_FUNCTION(0x1, "gpio_out")), 1219 SUNXI_FUNCTION(0x3, "csi0"), /* HSYNC */
1220 SUNXI_FUNCTION(0x4, "spi2")), /* MOSI */
744 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3, 1221 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE3,
745 SUNXI_FUNCTION(0x0, "gpio_in"), 1222 SUNXI_FUNCTION(0x0, "gpio_in"),
746 SUNXI_FUNCTION(0x1, "gpio_out")), 1223 SUNXI_FUNCTION(0x1, "gpio_out"),
1224 SUNXI_FUNCTION(0x3, "csi0"), /* VSYNC */
1225 SUNXI_FUNCTION(0x4, "spi2")), /* MISO */
747 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4, 1226 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE4,
748 SUNXI_FUNCTION(0x0, "gpio_in"), 1227 SUNXI_FUNCTION(0x0, "gpio_in"),
749 SUNXI_FUNCTION(0x1, "gpio_out")), 1228 SUNXI_FUNCTION(0x1, "gpio_out"),
1229 SUNXI_FUNCTION(0x3, "csi0"), /* D0 */
1230 SUNXI_FUNCTION(0x4, "mmc2")), /* D0 */
750 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5, 1231 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE5,
751 SUNXI_FUNCTION(0x0, "gpio_in"), 1232 SUNXI_FUNCTION(0x0, "gpio_in"),
752 SUNXI_FUNCTION(0x1, "gpio_out")), 1233 SUNXI_FUNCTION(0x1, "gpio_out"),
1234 SUNXI_FUNCTION(0x3, "csi0"), /* D1 */
1235 SUNXI_FUNCTION(0x4, "mmc2")), /* D1 */
753 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6, 1236 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE6,
754 SUNXI_FUNCTION(0x0, "gpio_in"), 1237 SUNXI_FUNCTION(0x0, "gpio_in"),
755 SUNXI_FUNCTION(0x1, "gpio_out")), 1238 SUNXI_FUNCTION(0x1, "gpio_out"),
1239 SUNXI_FUNCTION(0x3, "csi0"), /* D2 */
1240 SUNXI_FUNCTION(0x4, "mmc2")), /* D2 */
756 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7, 1241 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE7,
757 SUNXI_FUNCTION(0x0, "gpio_in"), 1242 SUNXI_FUNCTION(0x0, "gpio_in"),
758 SUNXI_FUNCTION(0x1, "gpio_out")), 1243 SUNXI_FUNCTION(0x1, "gpio_out"),
1244 SUNXI_FUNCTION(0x3, "csi0"), /* D3 */
1245 SUNXI_FUNCTION(0x4, "mmc2")), /* D3 */
759 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8, 1246 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE8,
760 SUNXI_FUNCTION(0x0, "gpio_in"), 1247 SUNXI_FUNCTION(0x0, "gpio_in"),
761 SUNXI_FUNCTION(0x1, "gpio_out")), 1248 SUNXI_FUNCTION(0x1, "gpio_out"),
1249 SUNXI_FUNCTION(0x3, "csi0"), /* D4 */
1250 SUNXI_FUNCTION(0x4, "mmc2")), /* CMD */
762 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9, 1251 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE9,
763 SUNXI_FUNCTION(0x0, "gpio_in"), 1252 SUNXI_FUNCTION(0x0, "gpio_in"),
764 SUNXI_FUNCTION(0x1, "gpio_out")), 1253 SUNXI_FUNCTION(0x1, "gpio_out"),
1254 SUNXI_FUNCTION(0x3, "csi0"), /* D5 */
1255 SUNXI_FUNCTION(0x4, "mmc2")), /* CLK */
765 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10, 1256 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE10,
766 SUNXI_FUNCTION(0x0, "gpio_in"), 1257 SUNXI_FUNCTION(0x0, "gpio_in"),
767 SUNXI_FUNCTION(0x1, "gpio_out"), 1258 SUNXI_FUNCTION(0x1, "gpio_out"),
1259 SUNXI_FUNCTION(0x3, "csi0"), /* D6 */
768 SUNXI_FUNCTION(0x4, "uart1")), /* TX */ 1260 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
769 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11, 1261 SUNXI_PIN(SUNXI_PINCTRL_PIN_PE11,
770 SUNXI_FUNCTION(0x0, "gpio_in"), 1262 SUNXI_FUNCTION(0x0, "gpio_in"),
771 SUNXI_FUNCTION(0x1, "gpio_out"), 1263 SUNXI_FUNCTION(0x1, "gpio_out"),
1264 SUNXI_FUNCTION(0x3, "csi0"), /* D7 */
772 SUNXI_FUNCTION(0x4, "uart1")), /* RX */ 1265 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
773 /* Hole */ 1266 /* Hole */
774 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0, 1267 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF0,
775 SUNXI_FUNCTION(0x0, "gpio_in"), 1268 SUNXI_FUNCTION(0x0, "gpio_in"),
776 SUNXI_FUNCTION(0x1, "gpio_out")), 1269 SUNXI_FUNCTION(0x1, "gpio_out"),
1270 SUNXI_FUNCTION(0x4, "mmc0")), /* D1 */
777 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1, 1271 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF1,
778 SUNXI_FUNCTION(0x0, "gpio_in"), 1272 SUNXI_FUNCTION(0x0, "gpio_in"),
779 SUNXI_FUNCTION(0x1, "gpio_out")), 1273 SUNXI_FUNCTION(0x1, "gpio_out"),
1274 SUNXI_FUNCTION(0x4, "mmc0")), /* D0 */
780 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2, 1275 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF2,
781 SUNXI_FUNCTION(0x0, "gpio_in"), 1276 SUNXI_FUNCTION(0x0, "gpio_in"),
782 SUNXI_FUNCTION(0x1, "gpio_out")), 1277 SUNXI_FUNCTION(0x1, "gpio_out"),
1278 SUNXI_FUNCTION(0x4, "mmc0")), /* CLK */
783 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3, 1279 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF3,
784 SUNXI_FUNCTION(0x0, "gpio_in"), 1280 SUNXI_FUNCTION(0x0, "gpio_in"),
785 SUNXI_FUNCTION(0x1, "gpio_out")), 1281 SUNXI_FUNCTION(0x1, "gpio_out"),
1282 SUNXI_FUNCTION(0x4, "mmc0")), /* CMD */
786 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4, 1283 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF4,
787 SUNXI_FUNCTION(0x0, "gpio_in"), 1284 SUNXI_FUNCTION(0x0, "gpio_in"),
788 SUNXI_FUNCTION(0x1, "gpio_out")), 1285 SUNXI_FUNCTION(0x1, "gpio_out"),
1286 SUNXI_FUNCTION(0x4, "mmc0")), /* D3 */
789 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5, 1287 SUNXI_PIN(SUNXI_PINCTRL_PIN_PF5,
790 SUNXI_FUNCTION(0x0, "gpio_in"), 1288 SUNXI_FUNCTION(0x0, "gpio_in"),
791 SUNXI_FUNCTION(0x1, "gpio_out")), 1289 SUNXI_FUNCTION(0x1, "gpio_out"),
1290 SUNXI_FUNCTION(0x4, "mmc0")), /* D2 */
792 /* Hole */ 1291 /* Hole */
793 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0, 1292 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG0,
794 SUNXI_FUNCTION(0x0, "gpio_in"), 1293 SUNXI_FUNCTION(0x0, "gpio_in"),
@@ -802,24 +1301,34 @@ static const struct sunxi_desc_pin sun5i_a13_pins[] = {
802 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3, 1301 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG3,
803 SUNXI_FUNCTION(0x0, "gpio_in"), 1302 SUNXI_FUNCTION(0x0, "gpio_in"),
804 SUNXI_FUNCTION(0x1, "gpio_out"), 1303 SUNXI_FUNCTION(0x1, "gpio_out"),
1304 SUNXI_FUNCTION(0x2, "mmc1"), /* CMD */
805 SUNXI_FUNCTION(0x4, "uart1")), /* TX */ 1305 SUNXI_FUNCTION(0x4, "uart1")), /* TX */
806 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4, 1306 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG4,
807 SUNXI_FUNCTION(0x0, "gpio_in"), 1307 SUNXI_FUNCTION(0x0, "gpio_in"),
808 SUNXI_FUNCTION(0x1, "gpio_out"), 1308 SUNXI_FUNCTION(0x1, "gpio_out"),
1309 SUNXI_FUNCTION(0x2, "mmc1"), /* CLK */
809 SUNXI_FUNCTION(0x4, "uart1")), /* RX */ 1310 SUNXI_FUNCTION(0x4, "uart1")), /* RX */
810 /* Hole */ 1311/* Hole */
811 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9, 1312 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG9,
812 SUNXI_FUNCTION(0x0, "gpio_in"), 1313 SUNXI_FUNCTION(0x0, "gpio_in"),
813 SUNXI_FUNCTION(0x1, "gpio_out")), 1314 SUNXI_FUNCTION(0x1, "gpio_out"),
1315 SUNXI_FUNCTION(0x2, "spi1"), /* CS0 */
1316 SUNXI_FUNCTION(0x3, "uart3")), /* TX */
814 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10, 1317 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG10,
815 SUNXI_FUNCTION(0x0, "gpio_in"), 1318 SUNXI_FUNCTION(0x0, "gpio_in"),
816 SUNXI_FUNCTION(0x1, "gpio_out")), 1319 SUNXI_FUNCTION(0x1, "gpio_out"),
1320 SUNXI_FUNCTION(0x2, "spi1"), /* CLK */
1321 SUNXI_FUNCTION(0x3, "uart3")), /* RX */
817 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11, 1322 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG11,
818 SUNXI_FUNCTION(0x0, "gpio_in"), 1323 SUNXI_FUNCTION(0x0, "gpio_in"),
819 SUNXI_FUNCTION(0x1, "gpio_out")), 1324 SUNXI_FUNCTION(0x1, "gpio_out"),
1325 SUNXI_FUNCTION(0x2, "spi1"), /* MOSI */
1326 SUNXI_FUNCTION(0x3, "uart3")), /* CTS */
820 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG12, 1327 SUNXI_PIN(SUNXI_PINCTRL_PIN_PG12,
821 SUNXI_FUNCTION(0x0, "gpio_in"), 1328 SUNXI_FUNCTION(0x0, "gpio_in"),
822 SUNXI_FUNCTION(0x1, "gpio_out")), 1329 SUNXI_FUNCTION(0x1, "gpio_out"),
1330 SUNXI_FUNCTION(0x2, "spi1"), /* MISO */
1331 SUNXI_FUNCTION(0x3, "uart3")), /* RTS */
823}; 1332};
824 1333
825static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = { 1334static const struct sunxi_pinctrl_desc sun4i_a10_pinctrl_data = {
@@ -1029,7 +1538,7 @@ static void sunxi_pctrl_dt_free_map(struct pinctrl_dev *pctldev,
1029 kfree(map); 1538 kfree(map);
1030} 1539}
1031 1540
1032static struct pinctrl_ops sunxi_pctrl_ops = { 1541static const struct pinctrl_ops sunxi_pctrl_ops = {
1033 .dt_node_to_map = sunxi_pctrl_dt_node_to_map, 1542 .dt_node_to_map = sunxi_pctrl_dt_node_to_map,
1034 .dt_free_map = sunxi_pctrl_dt_free_map, 1543 .dt_free_map = sunxi_pctrl_dt_free_map,
1035 .get_groups_count = sunxi_pctrl_get_groups_count, 1544 .get_groups_count = sunxi_pctrl_get_groups_count,
@@ -1098,7 +1607,7 @@ static int sunxi_pconf_group_set(struct pinctrl_dev *pctldev,
1098 return 0; 1607 return 0;
1099} 1608}
1100 1609
1101static struct pinconf_ops sunxi_pconf_ops = { 1610static const struct pinconf_ops sunxi_pconf_ops = {
1102 .pin_config_group_get = sunxi_pconf_group_get, 1611 .pin_config_group_get = sunxi_pconf_group_get,
1103 .pin_config_group_set = sunxi_pconf_group_set, 1612 .pin_config_group_set = sunxi_pconf_group_set,
1104}; 1613};
@@ -1204,7 +1713,7 @@ error:
1204 return ret; 1713 return ret;
1205} 1714}
1206 1715
1207static struct pinmux_ops sunxi_pmx_ops = { 1716static const struct pinmux_ops sunxi_pmx_ops = {
1208 .get_functions_count = sunxi_pmx_get_funcs_cnt, 1717 .get_functions_count = sunxi_pmx_get_funcs_cnt,
1209 .get_function_name = sunxi_pmx_get_func_name, 1718 .get_function_name = sunxi_pmx_get_func_name,
1210 .get_function_groups = sunxi_pmx_get_func_groups, 1719 .get_function_groups = sunxi_pmx_get_func_groups,
@@ -1409,6 +1918,7 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
1409 struct pinctrl_pin_desc *pins; 1918 struct pinctrl_pin_desc *pins;
1410 struct sunxi_pinctrl *pctl; 1919 struct sunxi_pinctrl *pctl;
1411 int i, ret, last_pin; 1920 int i, ret, last_pin;
1921 struct clk *clk;
1412 1922
1413 pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); 1923 pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL);
1414 if (!pctl) 1924 if (!pctl)
@@ -1479,6 +1989,12 @@ static int sunxi_pinctrl_probe(struct platform_device *pdev)
1479 goto gpiochip_error; 1989 goto gpiochip_error;
1480 } 1990 }
1481 1991
1992 clk = devm_clk_get(&pdev->dev, NULL);
1993 if (IS_ERR(clk))
1994 goto gpiochip_error;
1995
1996 clk_prepare_enable(clk);
1997
1482 dev_info(&pdev->dev, "initialized sunXi PIO driver\n"); 1998 dev_info(&pdev->dev, "initialized sunXi PIO driver\n");
1483 1999
1484 return 0; 2000 return 0;
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
index f195d77a3572..2fa9bc6cd7ab 100644
--- a/drivers/pinctrl/pinctrl-tegra.c
+++ b/drivers/pinctrl/pinctrl-tegra.c
@@ -316,7 +316,7 @@ static int tegra_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
316 return 0; 316 return 0;
317} 317}
318 318
319static struct pinctrl_ops tegra_pinctrl_ops = { 319static const struct pinctrl_ops tegra_pinctrl_ops = {
320 .get_groups_count = tegra_pinctrl_get_groups_count, 320 .get_groups_count = tegra_pinctrl_get_groups_count,
321 .get_group_name = tegra_pinctrl_get_group_name, 321 .get_group_name = tegra_pinctrl_get_group_name,
322 .get_group_pins = tegra_pinctrl_get_group_pins, 322 .get_group_pins = tegra_pinctrl_get_group_pins,
@@ -401,7 +401,7 @@ static void tegra_pinctrl_disable(struct pinctrl_dev *pctldev,
401 pmx_writel(pmx, val, g->mux_bank, g->mux_reg); 401 pmx_writel(pmx, val, g->mux_bank, g->mux_reg);
402} 402}
403 403
404static struct pinmux_ops tegra_pinmux_ops = { 404static const struct pinmux_ops tegra_pinmux_ops = {
405 .get_functions_count = tegra_pinctrl_get_funcs_count, 405 .get_functions_count = tegra_pinctrl_get_funcs_count,
406 .get_function_name = tegra_pinctrl_get_func_name, 406 .get_function_name = tegra_pinctrl_get_func_name,
407 .get_function_groups = tegra_pinctrl_get_func_groups, 407 .get_function_groups = tegra_pinctrl_get_func_groups,
@@ -676,7 +676,7 @@ static void tegra_pinconf_config_dbg_show(struct pinctrl_dev *pctldev,
676} 676}
677#endif 677#endif
678 678
679static struct pinconf_ops tegra_pinconf_ops = { 679static const struct pinconf_ops tegra_pinconf_ops = {
680 .pin_config_get = tegra_pinconf_get, 680 .pin_config_get = tegra_pinconf_get,
681 .pin_config_set = tegra_pinconf_set, 681 .pin_config_set = tegra_pinconf_set,
682 .pin_config_group_get = tegra_pinconf_group_get, 682 .pin_config_group_get = tegra_pinconf_group_get,
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index 2b5772550836..6a3a7503e6a0 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -860,7 +860,7 @@ static void u300_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
860 seq_printf(s, " " DRIVER_NAME); 860 seq_printf(s, " " DRIVER_NAME);
861} 861}
862 862
863static struct pinctrl_ops u300_pctrl_ops = { 863static const struct pinctrl_ops u300_pctrl_ops = {
864 .get_groups_count = u300_get_groups_count, 864 .get_groups_count = u300_get_groups_count,
865 .get_group_name = u300_get_group_name, 865 .get_group_name = u300_get_group_name,
866 .get_group_pins = u300_get_group_pins, 866 .get_group_pins = u300_get_group_pins,
@@ -1003,7 +1003,7 @@ static int u300_pmx_get_groups(struct pinctrl_dev *pctldev, unsigned selector,
1003 return 0; 1003 return 0;
1004} 1004}
1005 1005
1006static struct pinmux_ops u300_pmx_ops = { 1006static const struct pinmux_ops u300_pmx_ops = {
1007 .get_functions_count = u300_pmx_get_funcs_count, 1007 .get_functions_count = u300_pmx_get_funcs_count,
1008 .get_function_name = u300_pmx_get_func_name, 1008 .get_function_name = u300_pmx_get_func_name,
1009 .get_function_groups = u300_pmx_get_groups, 1009 .get_function_groups = u300_pmx_get_groups,
@@ -1046,7 +1046,7 @@ static int u300_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
1046 return 0; 1046 return 0;
1047} 1047}
1048 1048
1049static struct pinconf_ops u300_pconf_ops = { 1049static const struct pinconf_ops u300_pconf_ops = {
1050 .is_generic = true, 1050 .is_generic = true,
1051 .pin_config_get = u300_pin_config_get, 1051 .pin_config_get = u300_pin_config_get,
1052 .pin_config_set = u300_pin_config_set, 1052 .pin_config_set = u300_pin_config_set,
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c
index 068224efa6fa..f2977cff8366 100644
--- a/drivers/pinctrl/pinctrl-xway.c
+++ b/drivers/pinctrl/pinctrl-xway.c
@@ -553,7 +553,7 @@ int xway_pinconf_group_set(struct pinctrl_dev *pctldev,
553 return ret; 553 return ret;
554} 554}
555 555
556static struct pinconf_ops xway_pinconf_ops = { 556static const struct pinconf_ops xway_pinconf_ops = {
557 .pin_config_get = xway_pinconf_get, 557 .pin_config_get = xway_pinconf_get,
558 .pin_config_set = xway_pinconf_set, 558 .pin_config_set = xway_pinconf_set,
559 .pin_config_group_set = xway_pinconf_group_set, 559 .pin_config_group_set = xway_pinconf_group_set,
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index bd83c8b01cd1..88cc5095d0c9 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -506,7 +506,7 @@ static int pinmux_functions_show(struct seq_file *s, void *what)
506 if (!pmxops) 506 if (!pmxops)
507 return 0; 507 return 0;
508 508
509 mutex_lock(&pinctrl_mutex); 509 mutex_lock(&pctldev->mutex);
510 nfuncs = pmxops->get_functions_count(pctldev); 510 nfuncs = pmxops->get_functions_count(pctldev);
511 while (func_selector < nfuncs) { 511 while (func_selector < nfuncs) {
512 const char *func = pmxops->get_function_name(pctldev, 512 const char *func = pmxops->get_function_name(pctldev,
@@ -530,7 +530,7 @@ static int pinmux_functions_show(struct seq_file *s, void *what)
530 func_selector++; 530 func_selector++;
531 } 531 }
532 532
533 mutex_unlock(&pinctrl_mutex); 533 mutex_unlock(&pctldev->mutex);
534 534
535 return 0; 535 return 0;
536} 536}
@@ -548,7 +548,7 @@ static int pinmux_pins_show(struct seq_file *s, void *what)
548 seq_puts(s, "Pinmux settings per pin\n"); 548 seq_puts(s, "Pinmux settings per pin\n");
549 seq_puts(s, "Format: pin (name): mux_owner gpio_owner hog?\n"); 549 seq_puts(s, "Format: pin (name): mux_owner gpio_owner hog?\n");
550 550
551 mutex_lock(&pinctrl_mutex); 551 mutex_lock(&pctldev->mutex);
552 552
553 /* The pin number can be retrived from the pin controller descriptor */ 553 /* The pin number can be retrived from the pin controller descriptor */
554 for (i = 0; i < pctldev->desc->npins; i++) { 554 for (i = 0; i < pctldev->desc->npins; i++) {
@@ -583,7 +583,7 @@ static int pinmux_pins_show(struct seq_file *s, void *what)
583 seq_printf(s, "\n"); 583 seq_printf(s, "\n");
584 } 584 }
585 585
586 mutex_unlock(&pinctrl_mutex); 586 mutex_unlock(&pctldev->mutex);
587 587
588 return 0; 588 return 0;
589} 589}
diff --git a/drivers/pinctrl/spear/pinctrl-spear.c b/drivers/pinctrl/spear/pinctrl-spear.c
index 6a7dae70db08..116da0412c4b 100644
--- a/drivers/pinctrl/spear/pinctrl-spear.c
+++ b/drivers/pinctrl/spear/pinctrl-spear.c
@@ -198,7 +198,7 @@ static void spear_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
198 kfree(map); 198 kfree(map);
199} 199}
200 200
201static struct pinctrl_ops spear_pinctrl_ops = { 201static const struct pinctrl_ops spear_pinctrl_ops = {
202 .get_groups_count = spear_pinctrl_get_groups_cnt, 202 .get_groups_count = spear_pinctrl_get_groups_cnt,
203 .get_group_name = spear_pinctrl_get_group_name, 203 .get_group_name = spear_pinctrl_get_group_name,
204 .get_group_pins = spear_pinctrl_get_group_pins, 204 .get_group_pins = spear_pinctrl_get_group_pins,
@@ -340,7 +340,7 @@ static void gpio_disable_free(struct pinctrl_dev *pctldev,
340 gpio_request_endisable(pctldev, range, offset, false); 340 gpio_request_endisable(pctldev, range, offset, false);
341} 341}
342 342
343static struct pinmux_ops spear_pinmux_ops = { 343static const struct pinmux_ops spear_pinmux_ops = {
344 .get_functions_count = spear_pinctrl_get_funcs_count, 344 .get_functions_count = spear_pinctrl_get_funcs_count,
345 .get_function_name = spear_pinctrl_get_func_name, 345 .get_function_name = spear_pinctrl_get_func_name,
346 .get_function_groups = spear_pinctrl_get_func_groups, 346 .get_function_groups = spear_pinctrl_get_func_groups,
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index e7a720104a47..1ad4f31ef6b8 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -14,6 +14,8 @@
14 14
15#ifdef CONFIG_PINCONF 15#ifdef CONFIG_PINCONF
16 16
17#include <linux/pinctrl/machine.h>
18
17struct pinctrl_dev; 19struct pinctrl_dev;
18struct seq_file; 20struct seq_file;
19 21
@@ -28,6 +30,7 @@ struct seq_file;
28 * @pin_config_set: configure an individual pin 30 * @pin_config_set: configure an individual pin
29 * @pin_config_group_get: get configurations for an entire pin group 31 * @pin_config_group_get: get configurations for an entire pin group
30 * @pin_config_group_set: configure all pins in a group 32 * @pin_config_group_set: configure all pins in a group
33 * @pin_config_group_dbg_set: optional debugfs to modify a pin configuration
31 * @pin_config_dbg_show: optional debugfs display hook that will provide 34 * @pin_config_dbg_show: optional debugfs display hook that will provide
32 * per-device info for a certain pin in debugfs 35 * per-device info for a certain pin in debugfs
33 * @pin_config_group_dbg_show: optional debugfs display hook that will provide 36 * @pin_config_group_dbg_show: optional debugfs display hook that will provide
@@ -51,6 +54,9 @@ struct pinconf_ops {
51 int (*pin_config_group_set) (struct pinctrl_dev *pctldev, 54 int (*pin_config_group_set) (struct pinctrl_dev *pctldev,
52 unsigned selector, 55 unsigned selector,
53 unsigned long config); 56 unsigned long config);
57 int (*pin_config_dbg_parse_modify) (struct pinctrl_dev *pctldev,
58 const char *arg,
59 unsigned long *config);
54 void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev, 60 void (*pin_config_dbg_show) (struct pinctrl_dev *pctldev,
55 struct seq_file *s, 61 struct seq_file *s,
56 unsigned offset); 62 unsigned offset);
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 778804df293f..2c2a9e8d8578 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -118,9 +118,9 @@ struct pinctrl_desc {
118 const char *name; 118 const char *name;
119 struct pinctrl_pin_desc const *pins; 119 struct pinctrl_pin_desc const *pins;
120 unsigned int npins; 120 unsigned int npins;
121 struct pinctrl_ops *pctlops; 121 const struct pinctrl_ops *pctlops;
122 struct pinmux_ops *pmxops; 122 const struct pinmux_ops *pmxops;
123 struct pinconf_ops *confops; 123 const struct pinconf_ops *confops;
124 struct module *owner; 124 struct module *owner;
125}; 125};
126 126