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