xref: /OK3568_Linux_fs/kernel/drivers/pinctrl/nomadik/pinctrl-nomadik-stn8815.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun #include <linux/kernel.h>
3*4882a593Smuzhiyun #include <linux/pinctrl/pinctrl.h>
4*4882a593Smuzhiyun #include "pinctrl-nomadik.h"
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun /* All the pins that can be used for GPIO and some other functions */
7*4882a593Smuzhiyun #define _GPIO(offset)		(offset)
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #define STN8815_PIN_B4		_GPIO(0)
10*4882a593Smuzhiyun #define STN8815_PIN_D5		_GPIO(1)
11*4882a593Smuzhiyun #define STN8815_PIN_C5		_GPIO(2)
12*4882a593Smuzhiyun #define STN8815_PIN_A4		_GPIO(3)
13*4882a593Smuzhiyun #define STN8815_PIN_B5		_GPIO(4)
14*4882a593Smuzhiyun #define STN8815_PIN_D6		_GPIO(5)
15*4882a593Smuzhiyun #define STN8815_PIN_C6		_GPIO(6)
16*4882a593Smuzhiyun #define STN8815_PIN_B6		_GPIO(7)
17*4882a593Smuzhiyun #define STN8815_PIN_B10		_GPIO(8)
18*4882a593Smuzhiyun #define STN8815_PIN_A10		_GPIO(9)
19*4882a593Smuzhiyun #define STN8815_PIN_C11		_GPIO(10)
20*4882a593Smuzhiyun #define STN8815_PIN_B11		_GPIO(11)
21*4882a593Smuzhiyun #define STN8815_PIN_A11		_GPIO(12)
22*4882a593Smuzhiyun #define STN8815_PIN_C12		_GPIO(13)
23*4882a593Smuzhiyun #define STN8815_PIN_B12		_GPIO(14)
24*4882a593Smuzhiyun #define STN8815_PIN_A12		_GPIO(15)
25*4882a593Smuzhiyun #define STN8815_PIN_C13		_GPIO(16)
26*4882a593Smuzhiyun #define STN8815_PIN_B13		_GPIO(17)
27*4882a593Smuzhiyun #define STN8815_PIN_A13		_GPIO(18)
28*4882a593Smuzhiyun #define STN8815_PIN_D13		_GPIO(19)
29*4882a593Smuzhiyun #define STN8815_PIN_C14		_GPIO(20)
30*4882a593Smuzhiyun #define STN8815_PIN_B14		_GPIO(21)
31*4882a593Smuzhiyun #define STN8815_PIN_A14		_GPIO(22)
32*4882a593Smuzhiyun #define STN8815_PIN_D15		_GPIO(23)
33*4882a593Smuzhiyun #define STN8815_PIN_C15		_GPIO(24)
34*4882a593Smuzhiyun #define STN8815_PIN_B15		_GPIO(25)
35*4882a593Smuzhiyun #define STN8815_PIN_A15		_GPIO(26)
36*4882a593Smuzhiyun #define STN8815_PIN_C16		_GPIO(27)
37*4882a593Smuzhiyun #define STN8815_PIN_B16		_GPIO(28)
38*4882a593Smuzhiyun #define STN8815_PIN_A16		_GPIO(29)
39*4882a593Smuzhiyun #define STN8815_PIN_D17		_GPIO(30)
40*4882a593Smuzhiyun #define STN8815_PIN_C17		_GPIO(31)
41*4882a593Smuzhiyun #define STN8815_PIN_AB6		_GPIO(32)
42*4882a593Smuzhiyun #define STN8815_PIN_AA6		_GPIO(33)
43*4882a593Smuzhiyun #define STN8815_PIN_Y6		_GPIO(34)
44*4882a593Smuzhiyun #define STN8815_PIN_Y5		_GPIO(35)
45*4882a593Smuzhiyun #define STN8815_PIN_AA5		_GPIO(36)
46*4882a593Smuzhiyun #define STN8815_PIN_AB5		_GPIO(37)
47*4882a593Smuzhiyun #define STN8815_PIN_AB4		_GPIO(38)
48*4882a593Smuzhiyun #define STN8815_PIN_Y4		_GPIO(39)
49*4882a593Smuzhiyun #define STN8815_PIN_R1		_GPIO(40)
50*4882a593Smuzhiyun #define STN8815_PIN_R2		_GPIO(41)
51*4882a593Smuzhiyun #define STN8815_PIN_R3		_GPIO(42)
52*4882a593Smuzhiyun #define STN8815_PIN_P1		_GPIO(43)
53*4882a593Smuzhiyun #define STN8815_PIN_P2		_GPIO(44)
54*4882a593Smuzhiyun #define STN8815_PIN_P3		_GPIO(45)
55*4882a593Smuzhiyun #define STN8815_PIN_N1		_GPIO(46)
56*4882a593Smuzhiyun #define STN8815_PIN_N2		_GPIO(47)
57*4882a593Smuzhiyun #define STN8815_PIN_N3		_GPIO(48)
58*4882a593Smuzhiyun #define STN8815_PIN_M1		_GPIO(49)
59*4882a593Smuzhiyun #define STN8815_PIN_M3		_GPIO(50)
60*4882a593Smuzhiyun #define STN8815_PIN_M2		_GPIO(51)
61*4882a593Smuzhiyun #define STN8815_PIN_L1		_GPIO(52)
62*4882a593Smuzhiyun #define STN8815_PIN_L4		_GPIO(53)
63*4882a593Smuzhiyun #define STN8815_PIN_L3		_GPIO(54)
64*4882a593Smuzhiyun #define STN8815_PIN_L2		_GPIO(55)
65*4882a593Smuzhiyun #define STN8815_PIN_F3		_GPIO(56)
66*4882a593Smuzhiyun #define STN8815_PIN_F2		_GPIO(57)
67*4882a593Smuzhiyun #define STN8815_PIN_E1		_GPIO(58)
68*4882a593Smuzhiyun #define STN8815_PIN_E3		_GPIO(59)
69*4882a593Smuzhiyun #define STN8815_PIN_E2		_GPIO(60)
70*4882a593Smuzhiyun #define STN8815_PIN_E4		_GPIO(61)
71*4882a593Smuzhiyun #define STN8815_PIN_D3		_GPIO(62)
72*4882a593Smuzhiyun #define STN8815_PIN_D2		_GPIO(63)
73*4882a593Smuzhiyun #define STN8815_PIN_F21		_GPIO(64)
74*4882a593Smuzhiyun #define STN8815_PIN_F20		_GPIO(65)
75*4882a593Smuzhiyun #define STN8815_PIN_E22		_GPIO(66)
76*4882a593Smuzhiyun #define STN8815_PIN_D22		_GPIO(67)
77*4882a593Smuzhiyun #define STN8815_PIN_E21		_GPIO(68)
78*4882a593Smuzhiyun #define STN8815_PIN_E20		_GPIO(69)
79*4882a593Smuzhiyun #define STN8815_PIN_C22		_GPIO(70)
80*4882a593Smuzhiyun #define STN8815_PIN_D21		_GPIO(71)
81*4882a593Smuzhiyun #define STN8815_PIN_D20		_GPIO(72)
82*4882a593Smuzhiyun #define STN8815_PIN_C21		_GPIO(73)
83*4882a593Smuzhiyun #define STN8815_PIN_C20		_GPIO(74)
84*4882a593Smuzhiyun #define STN8815_PIN_C19		_GPIO(75)
85*4882a593Smuzhiyun #define STN8815_PIN_B20		_GPIO(76)
86*4882a593Smuzhiyun #define STN8815_PIN_B8		_GPIO(77)
87*4882a593Smuzhiyun #define STN8815_PIN_A8		_GPIO(78)
88*4882a593Smuzhiyun #define STN8815_PIN_C9		_GPIO(79)
89*4882a593Smuzhiyun #define STN8815_PIN_B9		_GPIO(80)
90*4882a593Smuzhiyun #define STN8815_PIN_A9		_GPIO(81)
91*4882a593Smuzhiyun #define STN8815_PIN_C10		_GPIO(82)
92*4882a593Smuzhiyun #define STN8815_PIN_K1		_GPIO(83)
93*4882a593Smuzhiyun #define STN8815_PIN_K3		_GPIO(84)
94*4882a593Smuzhiyun #define STN8815_PIN_K2		_GPIO(85)
95*4882a593Smuzhiyun #define STN8815_PIN_J1		_GPIO(86)
96*4882a593Smuzhiyun #define STN8815_PIN_J3		_GPIO(87)
97*4882a593Smuzhiyun #define STN8815_PIN_J2		_GPIO(88)
98*4882a593Smuzhiyun #define STN8815_PIN_H1		_GPIO(89)
99*4882a593Smuzhiyun #define STN8815_PIN_H3		_GPIO(90)
100*4882a593Smuzhiyun #define STN8815_PIN_H2		_GPIO(91)
101*4882a593Smuzhiyun #define STN8815_PIN_G1		_GPIO(92)
102*4882a593Smuzhiyun #define STN8815_PIN_G3		_GPIO(93)
103*4882a593Smuzhiyun #define STN8815_PIN_G2		_GPIO(94)
104*4882a593Smuzhiyun #define STN8815_PIN_F1		_GPIO(95)
105*4882a593Smuzhiyun #define STN8815_PIN_T20		_GPIO(96)
106*4882a593Smuzhiyun #define STN8815_PIN_R21		_GPIO(97)
107*4882a593Smuzhiyun #define STN8815_PIN_R20		_GPIO(98)
108*4882a593Smuzhiyun #define STN8815_PIN_U22		_GPIO(99)
109*4882a593Smuzhiyun #define STN8815_PIN_N21		_GPIO(100)
110*4882a593Smuzhiyun #define STN8815_PIN_N20		_GPIO(101)
111*4882a593Smuzhiyun #define STN8815_PIN_P22		_GPIO(102)
112*4882a593Smuzhiyun #define STN8815_PIN_N22		_GPIO(103)
113*4882a593Smuzhiyun #define STN8815_PIN_V22		_GPIO(104)
114*4882a593Smuzhiyun #define STN8815_PIN_V21		_GPIO(105)
115*4882a593Smuzhiyun #define STN8815_PIN_K22		_GPIO(106)
116*4882a593Smuzhiyun #define STN8815_PIN_K21		_GPIO(107)
117*4882a593Smuzhiyun #define STN8815_PIN_H20		_GPIO(108)
118*4882a593Smuzhiyun #define STN8815_PIN_G20		_GPIO(109)
119*4882a593Smuzhiyun #define STN8815_PIN_L21		_GPIO(110)
120*4882a593Smuzhiyun #define STN8815_PIN_H21		_GPIO(111)
121*4882a593Smuzhiyun #define STN8815_PIN_J21		_GPIO(112)
122*4882a593Smuzhiyun #define STN8815_PIN_H22		_GPIO(113)
123*4882a593Smuzhiyun #define STN8815_PIN_K20		_GPIO(114)
124*4882a593Smuzhiyun #define STN8815_PIN_L22		_GPIO(115)
125*4882a593Smuzhiyun #define STN8815_PIN_G21		_GPIO(116)
126*4882a593Smuzhiyun #define STN8815_PIN_J20		_GPIO(117)
127*4882a593Smuzhiyun #define STN8815_PIN_G22		_GPIO(118)
128*4882a593Smuzhiyun #define STN8815_PIN_U19		_GPIO(119)
129*4882a593Smuzhiyun #define STN8815_PIN_G19		_GPIO(120)
130*4882a593Smuzhiyun #define STN8815_PIN_M22		_GPIO(121)
131*4882a593Smuzhiyun #define STN8815_PIN_M19		_GPIO(122)
132*4882a593Smuzhiyun #define STN8815_PIN_J22		_GPIO(123)
133*4882a593Smuzhiyun /* GPIOs 124-127 not routed to pins */
134*4882a593Smuzhiyun 
135*4882a593Smuzhiyun /*
136*4882a593Smuzhiyun  * The names of the pins are denoted by GPIO number and ball name, even
137*4882a593Smuzhiyun  * though they can be used for other things than GPIO, this is the first
138*4882a593Smuzhiyun  * column in the table of the data sheet and often used on schematics and
139*4882a593Smuzhiyun  * such.
140*4882a593Smuzhiyun  */
141*4882a593Smuzhiyun static const struct pinctrl_pin_desc nmk_stn8815_pins[] = {
142*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B4, "GPIO0_B4"),
143*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D5, "GPIO1_D5"),
144*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C5, "GPIO2_C5"),
145*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A4, "GPIO3_A4"),
146*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B5, "GPIO4_B5"),
147*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D6, "GPIO5_D6"),
148*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C6, "GPIO6_C6"),
149*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B6, "GPIO7_B6"),
150*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B10, "GPIO8_B10"),
151*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A10, "GPIO9_A10"),
152*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C11, "GPIO10_C11"),
153*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B11, "GPIO11_B11"),
154*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A11, "GPIO12_A11"),
155*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C12, "GPIO13_C12"),
156*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B12, "GPIO14_B12"),
157*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A12, "GPIO15_A12"),
158*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C13, "GPIO16_C13"),
159*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B13, "GPIO17_B13"),
160*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A13, "GPIO18_A13"),
161*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D13, "GPIO19_D13"),
162*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C14, "GPIO20_C14"),
163*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B14, "GPIO21_B14"),
164*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A14, "GPIO22_A14"),
165*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D15, "GPIO23_D15"),
166*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C15, "GPIO24_C15"),
167*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B15, "GPIO25_B15"),
168*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A15, "GPIO26_A15"),
169*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C16, "GPIO27_C16"),
170*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B16, "GPIO28_B16"),
171*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A16, "GPIO29_A16"),
172*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D17, "GPIO30_D17"),
173*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C17, "GPIO31_C17"),
174*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_AB6, "GPIO32_AB6"),
175*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_AA6, "GPIO33_AA6"),
176*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_Y6, "GPIO34_Y6"),
177*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_Y5, "GPIO35_Y5"),
178*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_AA5, "GPIO36_AA5"),
179*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_AB5, "GPIO37_AB5"),
180*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_AB4, "GPIO38_AB4"),
181*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_Y4, "GPIO39_Y4"),
182*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_R1, "GPIO40_R1"),
183*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_R2, "GPIO41_R2"),
184*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_R3, "GPIO42_R3"),
185*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_P1, "GPIO43_P1"),
186*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_P2, "GPIO44_P2"),
187*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_P3, "GPIO45_P3"),
188*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_N1, "GPIO46_N1"),
189*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_N2, "GPIO47_N2"),
190*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_N3, "GPIO48_N3"),
191*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_M1, "GPIO49_M1"),
192*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_M3, "GPIO50_M3"),
193*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_M2, "GPIO51_M2"),
194*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_L1, "GPIO52_L1"),
195*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_L4, "GPIO53_L4"),
196*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_L3, "GPIO54_L3"),
197*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_L2, "GPIO55_L2"),
198*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_F3, "GPIO56_F3"),
199*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_F2, "GPIO57_F2"),
200*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_E1, "GPIO58_E1"),
201*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_E3, "GPIO59_E3"),
202*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_E2, "GPIO60_E2"),
203*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_E4, "GPIO61_E4"),
204*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D3, "GPIO62_D3"),
205*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D2, "GPIO63_D2"),
206*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_F21, "GPIO64_F21"),
207*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_F20, "GPIO65_F20"),
208*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_E22, "GPIO66_E22"),
209*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D22, "GPIO67_D22"),
210*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_E21, "GPIO68_E21"),
211*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_E20, "GPIO69_E20"),
212*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C22, "GPIO70_C22"),
213*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D21, "GPIO71_D21"),
214*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_D20, "GPIO72_D20"),
215*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C21, "GPIO73_C21"),
216*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C20, "GPIO74_C20"),
217*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C19, "GPIO75_C19"),
218*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B20, "GPIO76_B20"),
219*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B8, "GPIO77_B8"),
220*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A8, "GPIO78_A8"),
221*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C9, "GPIO79_C9"),
222*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_B9, "GPIO80_B9"),
223*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_A9, "GPIO81_A9"),
224*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_C10, "GPIO82_C10"),
225*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_K1, "GPIO83_K1"),
226*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_K3, "GPIO84_K3"),
227*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_K2, "GPIO85_K2"),
228*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_J1, "GPIO86_J1"),
229*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_J3, "GPIO87_J3"),
230*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_J2, "GPIO88_J2"),
231*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_H1, "GPIO89_H1"),
232*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_H3, "GPIO90_H3"),
233*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_H2, "GPIO91_H2"),
234*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_G1, "GPIO92_G1"),
235*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_G3, "GPIO93_G3"),
236*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_G2, "GPIO94_G2"),
237*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_F1, "GPIO95_F1"),
238*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_T20, "GPIO96_T20"),
239*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_R21, "GPIO97_R21"),
240*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_R20, "GPIO98_R20"),
241*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_U22, "GPIO99_U22"),
242*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_N21, "GPIO100_N21"),
243*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_N20, "GPIO101_N20"),
244*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_P22, "GPIO102_P22"),
245*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_N22, "GPIO103_N22"),
246*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_V22, "GPIO104_V22"),
247*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_V21, "GPIO105_V21"),
248*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_K22, "GPIO106_K22"),
249*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_K21, "GPIO107_K21"),
250*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_H20, "GPIO108_H20"),
251*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_G20, "GPIO109_G20"),
252*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_L21, "GPIO110_L21"),
253*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_H21, "GPIO111_H21"),
254*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_J21, "GPIO112_J21"),
255*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_H22, "GPIO113_H22"),
256*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_K20, "GPIO114_K20"),
257*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_L22, "GPIO115_L22"),
258*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_G21, "GPIO116_G21"),
259*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_J20, "GPIO117_J20"),
260*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_G22, "GPIO118_G22"),
261*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_U19, "GPIO119_U19"),
262*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_G19, "GPIO120_G19"),
263*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_M22, "GPIO121_M22"),
264*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_M19, "GPIO122_M19"),
265*4882a593Smuzhiyun 	PINCTRL_PIN(STN8815_PIN_J22, "GPIO123_J22"),
266*4882a593Smuzhiyun };
267*4882a593Smuzhiyun 
268*4882a593Smuzhiyun /*
269*4882a593Smuzhiyun  * Read the pin group names like this:
270*4882a593Smuzhiyun  * u0_a_1    = first groups of pins for uart0 on alt function a
271*4882a593Smuzhiyun  * i2c2_b_2  = second group of pins for i2c2 on alt function b
272*4882a593Smuzhiyun  */
273*4882a593Smuzhiyun 
274*4882a593Smuzhiyun /* Altfunction A */
275*4882a593Smuzhiyun static const unsigned u0txrx_a_1_pins[] = { STN8815_PIN_B4, STN8815_PIN_D5 };
276*4882a593Smuzhiyun static const unsigned u0ctsrts_a_1_pins[] = { STN8815_PIN_C5, STN8815_PIN_B6 };
277*4882a593Smuzhiyun /* Modem pins: DCD, DSR, RI, DTR */
278*4882a593Smuzhiyun static const unsigned u0modem_a_1_pins[] = { STN8815_PIN_A4, STN8815_PIN_B5,
279*4882a593Smuzhiyun 	STN8815_PIN_D6, STN8815_PIN_C6 };
280*4882a593Smuzhiyun static const unsigned mmcsd_a_1_pins[] = { STN8815_PIN_B10, STN8815_PIN_A10,
281*4882a593Smuzhiyun 	STN8815_PIN_C11, STN8815_PIN_B11, STN8815_PIN_A11, STN8815_PIN_C12,
282*4882a593Smuzhiyun 	STN8815_PIN_B12, STN8815_PIN_A12, STN8815_PIN_C13, STN8815_PIN_C15 };
283*4882a593Smuzhiyun static const unsigned mmcsd_b_1_pins[] = { STN8815_PIN_D15 };
284*4882a593Smuzhiyun static const unsigned u1_a_1_pins[] = { STN8815_PIN_M2, STN8815_PIN_L1,
285*4882a593Smuzhiyun 					STN8815_PIN_F3, STN8815_PIN_F2 };
286*4882a593Smuzhiyun static const unsigned i2c1_a_1_pins[] = { STN8815_PIN_L4, STN8815_PIN_L3 };
287*4882a593Smuzhiyun static const unsigned i2c0_a_1_pins[] = { STN8815_PIN_D3, STN8815_PIN_D2 };
288*4882a593Smuzhiyun /* Altfunction B */
289*4882a593Smuzhiyun static const unsigned u1_b_1_pins[] = { STN8815_PIN_B16, STN8815_PIN_A16 };
290*4882a593Smuzhiyun static const unsigned i2cusb_b_1_pins[] = { STN8815_PIN_C21, STN8815_PIN_C20 };
291*4882a593Smuzhiyun static const unsigned clcd_16_23_b_1_pins[] = { STN8815_PIN_AB6,
292*4882a593Smuzhiyun 	STN8815_PIN_AA6, STN8815_PIN_Y6, STN8815_PIN_Y5, STN8815_PIN_AA5,
293*4882a593Smuzhiyun 	STN8815_PIN_AB5, STN8815_PIN_AB4, STN8815_PIN_Y4 };
294*4882a593Smuzhiyun /* Full-speed and high-speed USB pins */
295*4882a593Smuzhiyun static const unsigned usbfs_b_1_pins[] = { STN8815_PIN_E21, STN8815_PIN_E20,
296*4882a593Smuzhiyun 					   STN8815_PIN_C22, STN8815_PIN_D21,
297*4882a593Smuzhiyun 					   STN8815_PIN_D20, STN8815_PIN_C21,
298*4882a593Smuzhiyun 					   STN8815_PIN_C20 };
299*4882a593Smuzhiyun static const unsigned usbhs_c_1_pins[] = { STN8815_PIN_E21, STN8815_PIN_E20,
300*4882a593Smuzhiyun 					   STN8815_PIN_C20, STN8815_PIN_C19,
301*4882a593Smuzhiyun 					   STN8815_PIN_C22, STN8815_PIN_D21,
302*4882a593Smuzhiyun 					   STN8815_PIN_D20, STN8815_PIN_C21,
303*4882a593Smuzhiyun 					   STN8815_PIN_C16, STN8815_PIN_A15,
304*4882a593Smuzhiyun 					   STN8815_PIN_D17, STN8815_PIN_C17 };
305*4882a593Smuzhiyun 
306*4882a593Smuzhiyun #define STN8815_PIN_GROUP(a, b) { .name = #a, .pins = a##_pins,		\
307*4882a593Smuzhiyun 			.npins = ARRAY_SIZE(a##_pins), .altsetting = b }
308*4882a593Smuzhiyun 
309*4882a593Smuzhiyun static const struct nmk_pingroup nmk_stn8815_groups[] = {
310*4882a593Smuzhiyun 	STN8815_PIN_GROUP(u0txrx_a_1, NMK_GPIO_ALT_A),
311*4882a593Smuzhiyun 	STN8815_PIN_GROUP(u0ctsrts_a_1, NMK_GPIO_ALT_A),
312*4882a593Smuzhiyun 	STN8815_PIN_GROUP(u0modem_a_1, NMK_GPIO_ALT_A),
313*4882a593Smuzhiyun 	STN8815_PIN_GROUP(mmcsd_a_1, NMK_GPIO_ALT_A),
314*4882a593Smuzhiyun 	STN8815_PIN_GROUP(mmcsd_b_1, NMK_GPIO_ALT_B),
315*4882a593Smuzhiyun 	STN8815_PIN_GROUP(u1_a_1, NMK_GPIO_ALT_A),
316*4882a593Smuzhiyun 	STN8815_PIN_GROUP(i2c1_a_1, NMK_GPIO_ALT_A),
317*4882a593Smuzhiyun 	STN8815_PIN_GROUP(i2c0_a_1, NMK_GPIO_ALT_A),
318*4882a593Smuzhiyun 	STN8815_PIN_GROUP(u1_b_1, NMK_GPIO_ALT_B),
319*4882a593Smuzhiyun 	STN8815_PIN_GROUP(i2cusb_b_1, NMK_GPIO_ALT_B),
320*4882a593Smuzhiyun 	STN8815_PIN_GROUP(clcd_16_23_b_1, NMK_GPIO_ALT_B),
321*4882a593Smuzhiyun 	STN8815_PIN_GROUP(usbfs_b_1, NMK_GPIO_ALT_B),
322*4882a593Smuzhiyun 	STN8815_PIN_GROUP(usbhs_c_1, NMK_GPIO_ALT_C),
323*4882a593Smuzhiyun };
324*4882a593Smuzhiyun 
325*4882a593Smuzhiyun /* We use this macro to define the groups applicable to a function */
326*4882a593Smuzhiyun #define STN8815_FUNC_GROUPS(a, b...)	   \
327*4882a593Smuzhiyun static const char * const a##_groups[] = { b };
328*4882a593Smuzhiyun 
329*4882a593Smuzhiyun STN8815_FUNC_GROUPS(u0, "u0txrx_a_1", "u0ctsrts_a_1", "u0modem_a_1");
330*4882a593Smuzhiyun STN8815_FUNC_GROUPS(mmcsd, "mmcsd_a_1", "mmcsd_b_1");
331*4882a593Smuzhiyun STN8815_FUNC_GROUPS(u1, "u1_a_1", "u1_b_1");
332*4882a593Smuzhiyun STN8815_FUNC_GROUPS(i2c1, "i2c1_a_1");
333*4882a593Smuzhiyun STN8815_FUNC_GROUPS(i2c0, "i2c0_a_1");
334*4882a593Smuzhiyun STN8815_FUNC_GROUPS(i2cusb, "i2cusb_b_1");
335*4882a593Smuzhiyun STN8815_FUNC_GROUPS(clcd, "clcd_16_23_b_1");
336*4882a593Smuzhiyun STN8815_FUNC_GROUPS(usb, "usbfs_b_1", "usbhs_c_1");
337*4882a593Smuzhiyun 
338*4882a593Smuzhiyun #define FUNCTION(fname)					\
339*4882a593Smuzhiyun 	{						\
340*4882a593Smuzhiyun 		.name = #fname,				\
341*4882a593Smuzhiyun 		.groups = fname##_groups,		\
342*4882a593Smuzhiyun 		.ngroups = ARRAY_SIZE(fname##_groups),	\
343*4882a593Smuzhiyun 	}
344*4882a593Smuzhiyun 
345*4882a593Smuzhiyun static const struct nmk_function nmk_stn8815_functions[] = {
346*4882a593Smuzhiyun 	FUNCTION(u0),
347*4882a593Smuzhiyun 	FUNCTION(mmcsd),
348*4882a593Smuzhiyun 	FUNCTION(u1),
349*4882a593Smuzhiyun 	FUNCTION(i2c1),
350*4882a593Smuzhiyun 	FUNCTION(i2c0),
351*4882a593Smuzhiyun 	FUNCTION(i2cusb),
352*4882a593Smuzhiyun 	FUNCTION(clcd),
353*4882a593Smuzhiyun 	FUNCTION(usb),
354*4882a593Smuzhiyun };
355*4882a593Smuzhiyun 
356*4882a593Smuzhiyun static const struct nmk_pinctrl_soc_data nmk_stn8815_soc = {
357*4882a593Smuzhiyun 	.pins = nmk_stn8815_pins,
358*4882a593Smuzhiyun 	.npins = ARRAY_SIZE(nmk_stn8815_pins),
359*4882a593Smuzhiyun 	.functions = nmk_stn8815_functions,
360*4882a593Smuzhiyun 	.nfunctions = ARRAY_SIZE(nmk_stn8815_functions),
361*4882a593Smuzhiyun 	.groups = nmk_stn8815_groups,
362*4882a593Smuzhiyun 	.ngroups = ARRAY_SIZE(nmk_stn8815_groups),
363*4882a593Smuzhiyun };
364*4882a593Smuzhiyun 
nmk_pinctrl_stn8815_init(const struct nmk_pinctrl_soc_data ** soc)365*4882a593Smuzhiyun void nmk_pinctrl_stn8815_init(const struct nmk_pinctrl_soc_data **soc)
366*4882a593Smuzhiyun {
367*4882a593Smuzhiyun 	*soc = &nmk_stn8815_soc;
368*4882a593Smuzhiyun }
369