• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <linux/kernel.h>
2 #include <linux/pinctrl/pinctrl.h>
3 #include "pinctrl-nomadik.h"
4 
5 /* All the pins that can be used for GPIO and some other functions */
6 #define _GPIO(offset)		(offset)
7 
8 #define DB8540_PIN_AH6		_GPIO(0)
9 #define DB8540_PIN_AG7		_GPIO(1)
10 #define DB8540_PIN_AF2		_GPIO(2)
11 #define DB8540_PIN_AD3		_GPIO(3)
12 #define DB8540_PIN_AF6		_GPIO(4)
13 #define DB8540_PIN_AG6		_GPIO(5)
14 #define DB8540_PIN_AD5		_GPIO(6)
15 #define DB8540_PIN_AF7		_GPIO(7)
16 #define DB8540_PIN_AG5		_GPIO(8)
17 #define DB8540_PIN_AH5		_GPIO(9)
18 #define DB8540_PIN_AE4		_GPIO(10)
19 #define DB8540_PIN_AD1		_GPIO(11)
20 #define DB8540_PIN_AD2		_GPIO(12)
21 #define DB8540_PIN_AC2		_GPIO(13)
22 #define DB8540_PIN_AC4		_GPIO(14)
23 #define DB8540_PIN_AC3		_GPIO(15)
24 #define DB8540_PIN_AH7		_GPIO(16)
25 #define DB8540_PIN_AE7		_GPIO(17)
26 /* Hole */
27 #define DB8540_PIN_AF8		_GPIO(22)
28 #define DB8540_PIN_AH11		_GPIO(23)
29 #define DB8540_PIN_AG11		_GPIO(24)
30 #define DB8540_PIN_AF11		_GPIO(25)
31 #define DB8540_PIN_AH10		_GPIO(26)
32 #define DB8540_PIN_AG10		_GPIO(27)
33 #define DB8540_PIN_AF10		_GPIO(28)
34 /* Hole */
35 #define DB8540_PIN_AD4		_GPIO(33)
36 #define DB8540_PIN_AF3		_GPIO(34)
37 #define DB8540_PIN_AF5		_GPIO(35)
38 #define DB8540_PIN_AG4		_GPIO(36)
39 #define DB8540_PIN_AF9		_GPIO(37)
40 #define DB8540_PIN_AE8		_GPIO(38)
41 /* Hole */
42 #define DB8540_PIN_M26		_GPIO(64)
43 #define DB8540_PIN_M25		_GPIO(65)
44 #define DB8540_PIN_M27		_GPIO(66)
45 #define DB8540_PIN_N25		_GPIO(67)
46 /* Hole */
47 #define DB8540_PIN_M28		_GPIO(70)
48 #define DB8540_PIN_N26		_GPIO(71)
49 #define DB8540_PIN_M22		_GPIO(72)
50 #define DB8540_PIN_N22		_GPIO(73)
51 #define DB8540_PIN_N27		_GPIO(74)
52 #define DB8540_PIN_N28		_GPIO(75)
53 #define DB8540_PIN_P22		_GPIO(76)
54 #define DB8540_PIN_P28		_GPIO(77)
55 #define DB8540_PIN_P26		_GPIO(78)
56 #define DB8540_PIN_T22		_GPIO(79)
57 #define DB8540_PIN_R27		_GPIO(80)
58 #define DB8540_PIN_P27		_GPIO(81)
59 #define DB8540_PIN_R26		_GPIO(82)
60 #define DB8540_PIN_R25		_GPIO(83)
61 #define DB8540_PIN_U22		_GPIO(84)
62 #define DB8540_PIN_T27		_GPIO(85)
63 #define DB8540_PIN_T25		_GPIO(86)
64 #define DB8540_PIN_T26		_GPIO(87)
65 /* Hole */
66 #define DB8540_PIN_AF20		_GPIO(116)
67 #define DB8540_PIN_AG21		_GPIO(117)
68 #define DB8540_PIN_AH19		_GPIO(118)
69 #define DB8540_PIN_AE19		_GPIO(119)
70 #define DB8540_PIN_AG18		_GPIO(120)
71 #define DB8540_PIN_AH17		_GPIO(121)
72 #define DB8540_PIN_AF19		_GPIO(122)
73 #define DB8540_PIN_AF18		_GPIO(123)
74 #define DB8540_PIN_AE18		_GPIO(124)
75 #define DB8540_PIN_AG17		_GPIO(125)
76 #define DB8540_PIN_AF17		_GPIO(126)
77 #define DB8540_PIN_AE17		_GPIO(127)
78 #define DB8540_PIN_AC27		_GPIO(128)
79 #define DB8540_PIN_AD27		_GPIO(129)
80 #define DB8540_PIN_AE28		_GPIO(130)
81 #define DB8540_PIN_AG26		_GPIO(131)
82 #define DB8540_PIN_AF25		_GPIO(132)
83 #define DB8540_PIN_AE27		_GPIO(133)
84 #define DB8540_PIN_AF27		_GPIO(134)
85 #define DB8540_PIN_AG28		_GPIO(135)
86 #define DB8540_PIN_AF28		_GPIO(136)
87 #define DB8540_PIN_AG25		_GPIO(137)
88 #define DB8540_PIN_AG24		_GPIO(138)
89 #define DB8540_PIN_AD25		_GPIO(139)
90 #define DB8540_PIN_AH25		_GPIO(140)
91 #define DB8540_PIN_AF26		_GPIO(141)
92 #define DB8540_PIN_AF23		_GPIO(142)
93 #define DB8540_PIN_AG23		_GPIO(143)
94 #define DB8540_PIN_AE25		_GPIO(144)
95 #define DB8540_PIN_AH24		_GPIO(145)
96 #define DB8540_PIN_AJ25		_GPIO(146)
97 #define DB8540_PIN_AG27		_GPIO(147)
98 #define DB8540_PIN_AH23		_GPIO(148)
99 #define DB8540_PIN_AE26		_GPIO(149)
100 #define DB8540_PIN_AE24		_GPIO(150)
101 #define DB8540_PIN_AJ24		_GPIO(151)
102 #define DB8540_PIN_AE21		_GPIO(152)
103 #define DB8540_PIN_AG22		_GPIO(153)
104 #define DB8540_PIN_AF21		_GPIO(154)
105 #define DB8540_PIN_AF24		_GPIO(155)
106 #define DB8540_PIN_AH22		_GPIO(156)
107 #define DB8540_PIN_AJ23		_GPIO(157)
108 #define DB8540_PIN_AH21		_GPIO(158)
109 #define DB8540_PIN_AG20		_GPIO(159)
110 #define DB8540_PIN_AE23		_GPIO(160)
111 #define DB8540_PIN_AH20		_GPIO(161)
112 #define DB8540_PIN_AG19		_GPIO(162)
113 #define DB8540_PIN_AF22		_GPIO(163)
114 #define DB8540_PIN_AJ21		_GPIO(164)
115 #define DB8540_PIN_AD26		_GPIO(165)
116 #define DB8540_PIN_AD28		_GPIO(166)
117 #define DB8540_PIN_AC28		_GPIO(167)
118 #define DB8540_PIN_AC26		_GPIO(168)
119 /* Hole */
120 #define DB8540_PIN_J3		_GPIO(192)
121 #define DB8540_PIN_H1		_GPIO(193)
122 #define DB8540_PIN_J2		_GPIO(194)
123 #define DB8540_PIN_H2		_GPIO(195)
124 #define DB8540_PIN_H3		_GPIO(196)
125 #define DB8540_PIN_H4		_GPIO(197)
126 #define DB8540_PIN_G2		_GPIO(198)
127 #define DB8540_PIN_G3		_GPIO(199)
128 #define DB8540_PIN_G4		_GPIO(200)
129 #define DB8540_PIN_F2		_GPIO(201)
130 #define DB8540_PIN_C6		_GPIO(202)
131 #define DB8540_PIN_B6		_GPIO(203)
132 #define DB8540_PIN_B7		_GPIO(204)
133 #define DB8540_PIN_A7		_GPIO(205)
134 #define DB8540_PIN_D7		_GPIO(206)
135 #define DB8540_PIN_D8		_GPIO(207)
136 #define DB8540_PIN_F3		_GPIO(208)
137 #define DB8540_PIN_E2		_GPIO(209)
138 #define DB8540_PIN_C7		_GPIO(210)
139 #define DB8540_PIN_B8		_GPIO(211)
140 #define DB8540_PIN_C10		_GPIO(212)
141 #define DB8540_PIN_C8		_GPIO(213)
142 #define DB8540_PIN_C9		_GPIO(214)
143 /* Hole */
144 #define DB8540_PIN_B9		_GPIO(219)
145 #define DB8540_PIN_A10		_GPIO(220)
146 #define DB8540_PIN_D9		_GPIO(221)
147 #define DB8540_PIN_B11		_GPIO(222)
148 #define DB8540_PIN_B10		_GPIO(223)
149 #define DB8540_PIN_E10		_GPIO(224)
150 #define DB8540_PIN_B12		_GPIO(225)
151 #define DB8540_PIN_D10		_GPIO(226)
152 #define DB8540_PIN_D11		_GPIO(227)
153 #define DB8540_PIN_AJ6		_GPIO(228)
154 #define DB8540_PIN_B13		_GPIO(229)
155 #define DB8540_PIN_C12		_GPIO(230)
156 #define DB8540_PIN_B14		_GPIO(231)
157 #define DB8540_PIN_E11		_GPIO(232)
158 /* Hole */
159 #define DB8540_PIN_D12		_GPIO(256)
160 #define DB8540_PIN_D15		_GPIO(257)
161 #define DB8540_PIN_C13		_GPIO(258)
162 #define DB8540_PIN_C14		_GPIO(259)
163 #define DB8540_PIN_C18		_GPIO(260)
164 #define DB8540_PIN_C16		_GPIO(261)
165 #define DB8540_PIN_B16		_GPIO(262)
166 #define DB8540_PIN_D18		_GPIO(263)
167 #define DB8540_PIN_C15		_GPIO(264)
168 #define DB8540_PIN_C17		_GPIO(265)
169 #define DB8540_PIN_B17		_GPIO(266)
170 #define DB8540_PIN_D17		_GPIO(267)
171 
172 /*
173  * The names of the pins are denoted by GPIO number and ball name, even
174  * though they can be used for other things than GPIO, this is the first
175  * column in the table of the data sheet and often used on schematics and
176  * such.
177  */
178 static const struct pinctrl_pin_desc nmk_db8540_pins[] = {
179 	PINCTRL_PIN(DB8540_PIN_AH6, "GPIO0_AH6"),
180 	PINCTRL_PIN(DB8540_PIN_AG7, "GPIO1_AG7"),
181 	PINCTRL_PIN(DB8540_PIN_AF2, "GPIO2_AF2"),
182 	PINCTRL_PIN(DB8540_PIN_AD3, "GPIO3_AD3"),
183 	PINCTRL_PIN(DB8540_PIN_AF6, "GPIO4_AF6"),
184 	PINCTRL_PIN(DB8540_PIN_AG6, "GPIO5_AG6"),
185 	PINCTRL_PIN(DB8540_PIN_AD5, "GPIO6_AD5"),
186 	PINCTRL_PIN(DB8540_PIN_AF7, "GPIO7_AF7"),
187 	PINCTRL_PIN(DB8540_PIN_AG5, "GPIO8_AG5"),
188 	PINCTRL_PIN(DB8540_PIN_AH5, "GPIO9_AH5"),
189 	PINCTRL_PIN(DB8540_PIN_AE4, "GPIO10_AE4"),
190 	PINCTRL_PIN(DB8540_PIN_AD1, "GPIO11_AD1"),
191 	PINCTRL_PIN(DB8540_PIN_AD2, "GPIO12_AD2"),
192 	PINCTRL_PIN(DB8540_PIN_AC2, "GPIO13_AC2"),
193 	PINCTRL_PIN(DB8540_PIN_AC4, "GPIO14_AC4"),
194 	PINCTRL_PIN(DB8540_PIN_AC3, "GPIO15_AC3"),
195 	PINCTRL_PIN(DB8540_PIN_AH7, "GPIO16_AH7"),
196 	PINCTRL_PIN(DB8540_PIN_AE7, "GPIO17_AE7"),
197 	/* Hole */
198 	PINCTRL_PIN(DB8540_PIN_AF8, "GPIO22_AF8"),
199 	PINCTRL_PIN(DB8540_PIN_AH11, "GPIO23_AH11"),
200 	PINCTRL_PIN(DB8540_PIN_AG11, "GPIO24_AG11"),
201 	PINCTRL_PIN(DB8540_PIN_AF11, "GPIO25_AF11"),
202 	PINCTRL_PIN(DB8540_PIN_AH10, "GPIO26_AH10"),
203 	PINCTRL_PIN(DB8540_PIN_AG10, "GPIO27_AG10"),
204 	PINCTRL_PIN(DB8540_PIN_AF10, "GPIO28_AF10"),
205 	/* Hole */
206 	PINCTRL_PIN(DB8540_PIN_AD4, "GPIO33_AD4"),
207 	PINCTRL_PIN(DB8540_PIN_AF3, "GPIO34_AF3"),
208 	PINCTRL_PIN(DB8540_PIN_AF5, "GPIO35_AF5"),
209 	PINCTRL_PIN(DB8540_PIN_AG4, "GPIO36_AG4"),
210 	PINCTRL_PIN(DB8540_PIN_AF9, "GPIO37_AF9"),
211 	PINCTRL_PIN(DB8540_PIN_AE8, "GPIO38_AE8"),
212 	/* Hole */
213 	PINCTRL_PIN(DB8540_PIN_M26, "GPIO64_M26"),
214 	PINCTRL_PIN(DB8540_PIN_M25, "GPIO65_M25"),
215 	PINCTRL_PIN(DB8540_PIN_M27, "GPIO66_M27"),
216 	PINCTRL_PIN(DB8540_PIN_N25, "GPIO67_N25"),
217 	/* Hole */
218 	PINCTRL_PIN(DB8540_PIN_M28, "GPIO70_M28"),
219 	PINCTRL_PIN(DB8540_PIN_N26, "GPIO71_N26"),
220 	PINCTRL_PIN(DB8540_PIN_M22, "GPIO72_M22"),
221 	PINCTRL_PIN(DB8540_PIN_N22, "GPIO73_N22"),
222 	PINCTRL_PIN(DB8540_PIN_N27, "GPIO74_N27"),
223 	PINCTRL_PIN(DB8540_PIN_N28, "GPIO75_N28"),
224 	PINCTRL_PIN(DB8540_PIN_P22, "GPIO76_P22"),
225 	PINCTRL_PIN(DB8540_PIN_P28, "GPIO77_P28"),
226 	PINCTRL_PIN(DB8540_PIN_P26, "GPIO78_P26"),
227 	PINCTRL_PIN(DB8540_PIN_T22, "GPIO79_T22"),
228 	PINCTRL_PIN(DB8540_PIN_R27, "GPIO80_R27"),
229 	PINCTRL_PIN(DB8540_PIN_P27, "GPIO81_P27"),
230 	PINCTRL_PIN(DB8540_PIN_R26, "GPIO82_R26"),
231 	PINCTRL_PIN(DB8540_PIN_R25, "GPIO83_R25"),
232 	PINCTRL_PIN(DB8540_PIN_U22, "GPIO84_U22"),
233 	PINCTRL_PIN(DB8540_PIN_T27, "GPIO85_T27"),
234 	PINCTRL_PIN(DB8540_PIN_T25, "GPIO86_T25"),
235 	PINCTRL_PIN(DB8540_PIN_T26, "GPIO87_T26"),
236 	/* Hole */
237 	PINCTRL_PIN(DB8540_PIN_AF20, "GPIO116_AF20"),
238 	PINCTRL_PIN(DB8540_PIN_AG21, "GPIO117_AG21"),
239 	PINCTRL_PIN(DB8540_PIN_AH19, "GPIO118_AH19"),
240 	PINCTRL_PIN(DB8540_PIN_AE19, "GPIO119_AE19"),
241 	PINCTRL_PIN(DB8540_PIN_AG18, "GPIO120_AG18"),
242 	PINCTRL_PIN(DB8540_PIN_AH17, "GPIO121_AH17"),
243 	PINCTRL_PIN(DB8540_PIN_AF19, "GPIO122_AF19"),
244 	PINCTRL_PIN(DB8540_PIN_AF18, "GPIO123_AF18"),
245 	PINCTRL_PIN(DB8540_PIN_AE18, "GPIO124_AE18"),
246 	PINCTRL_PIN(DB8540_PIN_AG17, "GPIO125_AG17"),
247 	PINCTRL_PIN(DB8540_PIN_AF17, "GPIO126_AF17"),
248 	PINCTRL_PIN(DB8540_PIN_AE17, "GPIO127_AE17"),
249 	PINCTRL_PIN(DB8540_PIN_AC27, "GPIO128_AC27"),
250 	PINCTRL_PIN(DB8540_PIN_AD27, "GPIO129_AD27"),
251 	PINCTRL_PIN(DB8540_PIN_AE28, "GPIO130_AE28"),
252 	PINCTRL_PIN(DB8540_PIN_AG26, "GPIO131_AG26"),
253 	PINCTRL_PIN(DB8540_PIN_AF25, "GPIO132_AF25"),
254 	PINCTRL_PIN(DB8540_PIN_AE27, "GPIO133_AE27"),
255 	PINCTRL_PIN(DB8540_PIN_AF27, "GPIO134_AF27"),
256 	PINCTRL_PIN(DB8540_PIN_AG28, "GPIO135_AG28"),
257 	PINCTRL_PIN(DB8540_PIN_AF28, "GPIO136_AF28"),
258 	PINCTRL_PIN(DB8540_PIN_AG25, "GPIO137_AG25"),
259 	PINCTRL_PIN(DB8540_PIN_AG24, "GPIO138_AG24"),
260 	PINCTRL_PIN(DB8540_PIN_AD25, "GPIO139_AD25"),
261 	PINCTRL_PIN(DB8540_PIN_AH25, "GPIO140_AH25"),
262 	PINCTRL_PIN(DB8540_PIN_AF26, "GPIO141_AF26"),
263 	PINCTRL_PIN(DB8540_PIN_AF23, "GPIO142_AF23"),
264 	PINCTRL_PIN(DB8540_PIN_AG23, "GPIO143_AG23"),
265 	PINCTRL_PIN(DB8540_PIN_AE25, "GPIO144_AE25"),
266 	PINCTRL_PIN(DB8540_PIN_AH24, "GPIO145_AH24"),
267 	PINCTRL_PIN(DB8540_PIN_AJ25, "GPIO146_AJ25"),
268 	PINCTRL_PIN(DB8540_PIN_AG27, "GPIO147_AG27"),
269 	PINCTRL_PIN(DB8540_PIN_AH23, "GPIO148_AH23"),
270 	PINCTRL_PIN(DB8540_PIN_AE26, "GPIO149_AE26"),
271 	PINCTRL_PIN(DB8540_PIN_AE24, "GPIO150_AE24"),
272 	PINCTRL_PIN(DB8540_PIN_AJ24, "GPIO151_AJ24"),
273 	PINCTRL_PIN(DB8540_PIN_AE21, "GPIO152_AE21"),
274 	PINCTRL_PIN(DB8540_PIN_AG22, "GPIO153_AG22"),
275 	PINCTRL_PIN(DB8540_PIN_AF21, "GPIO154_AF21"),
276 	PINCTRL_PIN(DB8540_PIN_AF24, "GPIO155_AF24"),
277 	PINCTRL_PIN(DB8540_PIN_AH22, "GPIO156_AH22"),
278 	PINCTRL_PIN(DB8540_PIN_AJ23, "GPIO157_AJ23"),
279 	PINCTRL_PIN(DB8540_PIN_AH21, "GPIO158_AH21"),
280 	PINCTRL_PIN(DB8540_PIN_AG20, "GPIO159_AG20"),
281 	PINCTRL_PIN(DB8540_PIN_AE23, "GPIO160_AE23"),
282 	PINCTRL_PIN(DB8540_PIN_AH20, "GPIO161_AH20"),
283 	PINCTRL_PIN(DB8540_PIN_AG19, "GPIO162_AG19"),
284 	PINCTRL_PIN(DB8540_PIN_AF22, "GPIO163_AF22"),
285 	PINCTRL_PIN(DB8540_PIN_AJ21, "GPIO164_AJ21"),
286 	PINCTRL_PIN(DB8540_PIN_AD26, "GPIO165_AD26"),
287 	PINCTRL_PIN(DB8540_PIN_AD28, "GPIO166_AD28"),
288 	PINCTRL_PIN(DB8540_PIN_AC28, "GPIO167_AC28"),
289 	PINCTRL_PIN(DB8540_PIN_AC26, "GPIO168_AC26"),
290 	/* Hole */
291 	PINCTRL_PIN(DB8540_PIN_J3, "GPIO192_J3"),
292 	PINCTRL_PIN(DB8540_PIN_H1, "GPIO193_H1"),
293 	PINCTRL_PIN(DB8540_PIN_J2, "GPIO194_J2"),
294 	PINCTRL_PIN(DB8540_PIN_H2, "GPIO195_H2"),
295 	PINCTRL_PIN(DB8540_PIN_H3, "GPIO196_H3"),
296 	PINCTRL_PIN(DB8540_PIN_H4, "GPIO197_H4"),
297 	PINCTRL_PIN(DB8540_PIN_G2, "GPIO198_G2"),
298 	PINCTRL_PIN(DB8540_PIN_G3, "GPIO199_G3"),
299 	PINCTRL_PIN(DB8540_PIN_G4, "GPIO200_G4"),
300 	PINCTRL_PIN(DB8540_PIN_F2, "GPIO201_F2"),
301 	PINCTRL_PIN(DB8540_PIN_C6, "GPIO202_C6"),
302 	PINCTRL_PIN(DB8540_PIN_B6, "GPIO203_B6"),
303 	PINCTRL_PIN(DB8540_PIN_B7, "GPIO204_B7"),
304 	PINCTRL_PIN(DB8540_PIN_A7, "GPIO205_A7"),
305 	PINCTRL_PIN(DB8540_PIN_D7, "GPIO206_D7"),
306 	PINCTRL_PIN(DB8540_PIN_D8, "GPIO207_D8"),
307 	PINCTRL_PIN(DB8540_PIN_F3, "GPIO208_F3"),
308 	PINCTRL_PIN(DB8540_PIN_E2, "GPIO209_E2"),
309 	PINCTRL_PIN(DB8540_PIN_C7, "GPIO210_C7"),
310 	PINCTRL_PIN(DB8540_PIN_B8, "GPIO211_B8"),
311 	PINCTRL_PIN(DB8540_PIN_C10, "GPIO212_C10"),
312 	PINCTRL_PIN(DB8540_PIN_C8, "GPIO213_C8"),
313 	PINCTRL_PIN(DB8540_PIN_C9, "GPIO214_C9"),
314 	/* Hole */
315 	PINCTRL_PIN(DB8540_PIN_B9, "GPIO219_B9"),
316 	PINCTRL_PIN(DB8540_PIN_A10, "GPIO220_A10"),
317 	PINCTRL_PIN(DB8540_PIN_D9, "GPIO221_D9"),
318 	PINCTRL_PIN(DB8540_PIN_B11, "GPIO222_B11"),
319 	PINCTRL_PIN(DB8540_PIN_B10, "GPIO223_B10"),
320 	PINCTRL_PIN(DB8540_PIN_E10, "GPIO224_E10"),
321 	PINCTRL_PIN(DB8540_PIN_B12, "GPIO225_B12"),
322 	PINCTRL_PIN(DB8540_PIN_D10, "GPIO226_D10"),
323 	PINCTRL_PIN(DB8540_PIN_D11, "GPIO227_D11"),
324 	PINCTRL_PIN(DB8540_PIN_AJ6, "GPIO228_AJ6"),
325 	PINCTRL_PIN(DB8540_PIN_B13, "GPIO229_B13"),
326 	PINCTRL_PIN(DB8540_PIN_C12, "GPIO230_C12"),
327 	PINCTRL_PIN(DB8540_PIN_B14, "GPIO231_B14"),
328 	PINCTRL_PIN(DB8540_PIN_E11, "GPIO232_E11"),
329 	/* Hole */
330 	PINCTRL_PIN(DB8540_PIN_D12, "GPIO256_D12"),
331 	PINCTRL_PIN(DB8540_PIN_D15, "GPIO257_D15"),
332 	PINCTRL_PIN(DB8540_PIN_C13, "GPIO258_C13"),
333 	PINCTRL_PIN(DB8540_PIN_C14, "GPIO259_C14"),
334 	PINCTRL_PIN(DB8540_PIN_C18, "GPIO260_C18"),
335 	PINCTRL_PIN(DB8540_PIN_C16, "GPIO261_C16"),
336 	PINCTRL_PIN(DB8540_PIN_B16, "GPIO262_B16"),
337 	PINCTRL_PIN(DB8540_PIN_D18, "GPIO263_D18"),
338 	PINCTRL_PIN(DB8540_PIN_C15, "GPIO264_C15"),
339 	PINCTRL_PIN(DB8540_PIN_C17, "GPIO265_C17"),
340 	PINCTRL_PIN(DB8540_PIN_B17, "GPIO266_B17"),
341 	PINCTRL_PIN(DB8540_PIN_D17, "GPIO267_D17"),
342 };
343 
344 #define DB8540_GPIO_RANGE(a, b, c) { .name = "db8540", .id = a, .base = b, \
345 			.pin_base = b, .npins = c }
346 
347 /*
348  * This matches the 32-pin gpio chips registered by the GPIO portion. This
349  * cannot be const since we assign the struct gpio_chip * pointer at runtime.
350  */
351 static struct pinctrl_gpio_range nmk_db8540_ranges[] = {
352 	DB8540_GPIO_RANGE(0, 0, 18),
353 	DB8540_GPIO_RANGE(0, 22, 7),
354 	DB8540_GPIO_RANGE(1, 33, 6),
355 	DB8540_GPIO_RANGE(2, 64, 4),
356 	DB8540_GPIO_RANGE(2, 70, 18),
357 	DB8540_GPIO_RANGE(3, 116, 12),
358 	DB8540_GPIO_RANGE(4, 128, 32),
359 	DB8540_GPIO_RANGE(5, 160, 9),
360 	DB8540_GPIO_RANGE(6, 192, 23),
361 	DB8540_GPIO_RANGE(6, 219, 5),
362 	DB8540_GPIO_RANGE(7, 224, 9),
363 	DB8540_GPIO_RANGE(8, 256, 12),
364 };
365 
366 /*
367  * Read the pin group names like this:
368  * u0_a_1    = first groups of pins for uart0 on alt function a
369  * i2c2_b_2  = second group of pins for i2c2 on alt function b
370  *
371  * The groups are arranged as sets per altfunction column, so we can
372  * mux in one group at a time by selecting the same altfunction for them
373  * all. When functions require pins on different altfunctions, you need
374  * to combine several groups.
375  */
376 
377 /* Altfunction A column */
378 static const unsigned u0_a_1_pins[] = { DB8540_PIN_AH6, DB8540_PIN_AG7,
379 					DB8540_PIN_AF2, DB8540_PIN_AD3 };
380 static const unsigned u1rxtx_a_1_pins[] = { DB8540_PIN_AF6, DB8540_PIN_AG6 };
381 static const unsigned u1ctsrts_a_1_pins[] = { DB8540_PIN_AD5, DB8540_PIN_AF7 };
382 /* Image processor I2C line, this is driven by image processor firmware */
383 static const unsigned ipi2c_a_1_pins[] = { DB8540_PIN_AG5, DB8540_PIN_AH5 };
384 static const unsigned ipi2c_a_2_pins[] = { DB8540_PIN_AE4, DB8540_PIN_AD1 };
385 /* MSP0 can only be on these pins, but TXD and RXD can be flipped */
386 static const unsigned msp0txrx_a_1_pins[] = { DB8540_PIN_AD2, DB8540_PIN_AC3 };
387 static const unsigned msp0tfstck_a_1_pins[] = { DB8540_PIN_AC2,
388 	DB8540_PIN_AC4 };
389 static const unsigned msp0rfsrck_a_1_pins[] = { DB8540_PIN_AH7,
390 	DB8540_PIN_AE7 };
391 /* Basic pins of the MMC/SD card 0 interface */
392 static const unsigned mc0_a_1_pins[] = { DB8540_PIN_AH11, DB8540_PIN_AG11,
393 	DB8540_PIN_AF11, DB8540_PIN_AH10, DB8540_PIN_AG10, DB8540_PIN_AF10};
394 /* MSP1 can only be on these pins, but TXD and RXD can be flipped */
395 static const unsigned msp1txrx_a_1_pins[] = { DB8540_PIN_AD4, DB8540_PIN_AG4 };
396 static const unsigned msp1_a_1_pins[] = { DB8540_PIN_AF3, DB8540_PIN_AF5 };
397 
398 static const unsigned modobsclk_a_1_pins[] = { DB8540_PIN_AF9 };
399 static const unsigned clkoutreq_a_1_pins[] = { DB8540_PIN_AE8 };
400 /* LCD interface */
401 static const unsigned lcdb_a_1_pins[] = { DB8540_PIN_M26, DB8540_PIN_M25,
402 	DB8540_PIN_M27, DB8540_PIN_N25 };
403 static const unsigned lcdvsi0_a_1_pins[] = { DB8540_PIN_AJ24 };
404 static const unsigned lcdvsi1_a_1_pins[] = { DB8540_PIN_AE21 };
405 static const unsigned lcd_d0_d7_a_1_pins[] = { DB8540_PIN_M28, DB8540_PIN_N26,
406 	DB8540_PIN_M22, DB8540_PIN_N22, DB8540_PIN_N27, DB8540_PIN_N28,
407 	DB8540_PIN_P22, DB8540_PIN_P28 };
408 /* D8 thru D11 often used as TVOUT lines */
409 static const unsigned lcd_d8_d11_a_1_pins[] = { DB8540_PIN_P26, DB8540_PIN_T22,
410 	DB8540_PIN_R27, DB8540_PIN_P27 };
411 static const unsigned lcd_d12_d23_a_1_pins[] = { DB8540_PIN_R26, DB8540_PIN_R25,
412 	DB8540_PIN_U22, DB8540_PIN_T27, DB8540_PIN_AG22, DB8540_PIN_AF21,
413 	DB8540_PIN_AF24, DB8540_PIN_AH22, DB8540_PIN_AJ23, DB8540_PIN_AH21,
414 	DB8540_PIN_AG20, DB8540_PIN_AE23 };
415 static const unsigned kp_a_1_pins[] = { DB8540_PIN_AH20, DB8540_PIN_AG19,
416 	DB8540_PIN_AF22, DB8540_PIN_AJ21, DB8540_PIN_T25, DB8540_PIN_T26 };
417 /* MC2 has 8 data lines and no direction control, so only for (e)MMC */
418 static const unsigned mc2_a_1_pins[] = { DB8540_PIN_AC27, DB8540_PIN_AD27,
419 	DB8540_PIN_AE28, DB8540_PIN_AG26, DB8540_PIN_AF25, DB8540_PIN_AE27,
420 	DB8540_PIN_AF27, DB8540_PIN_AG28, DB8540_PIN_AF28, DB8540_PIN_AG25,
421 	DB8540_PIN_AG24 };
422 static const unsigned ssp1_a_1_pins[] = {  DB8540_PIN_AD25, DB8540_PIN_AH25,
423 	DB8540_PIN_AF26, DB8540_PIN_AF23 };
424 static const unsigned ssp0_a_1_pins[] = { DB8540_PIN_AG23, DB8540_PIN_AE25,
425 	DB8540_PIN_AH24, DB8540_PIN_AJ25 };
426 static const unsigned i2c0_a_1_pins[] = { DB8540_PIN_AG27, DB8540_PIN_AH23 };
427 /*
428  * Image processor GPIO pins are named "ipgpio" and have their own
429  * numberspace
430  */
431 static const unsigned ipgpio0_a_1_pins[] = { DB8540_PIN_AE26 };
432 static const unsigned ipgpio1_a_1_pins[] = { DB8540_PIN_AE24 };
433 /* modem i2s interface */
434 static const unsigned modi2s_a_1_pins[] = { DB8540_PIN_AD26, DB8540_PIN_AD28,
435 	DB8540_PIN_AC28, DB8540_PIN_AC26 };
436 static const unsigned spi2_a_1_pins[] = { DB8540_PIN_AF20, DB8540_PIN_AG21,
437 	DB8540_PIN_AH19, DB8540_PIN_AE19 };
438 static const unsigned u2txrx_a_1_pins[] = { DB8540_PIN_AG18, DB8540_PIN_AH17 };
439 static const unsigned u2ctsrts_a_1_pins[] = { DB8540_PIN_AF19,
440 	DB8540_PIN_AF18 };
441 static const unsigned modsmb_a_1_pins[] = { DB8540_PIN_AF17, DB8540_PIN_AE17 };
442 static const unsigned msp2sck_a_1_pins[] = { DB8540_PIN_J3 };
443 static const unsigned msp2txdtcktfs_a_1_pins[] = { DB8540_PIN_H1, DB8540_PIN_J2,
444 	DB8540_PIN_H2 };
445 static const unsigned msp2rxd_a_1_pins[] = { DB8540_PIN_H3 };
446 static const unsigned mc4_a_1_pins[] = { DB8540_PIN_H4, DB8540_PIN_G2,
447 	DB8540_PIN_G3, DB8540_PIN_G4, DB8540_PIN_F2, DB8540_PIN_C6,
448 	DB8540_PIN_B6, DB8540_PIN_B7, DB8540_PIN_A7, DB8540_PIN_D7,
449 	DB8540_PIN_D8 };
450 static const unsigned mc1_a_1_pins[] = { DB8540_PIN_F3, DB8540_PIN_E2,
451 	DB8540_PIN_C7, DB8540_PIN_B8, DB8540_PIN_C10, DB8540_PIN_C8,
452 	DB8540_PIN_C9 };
453 /* mc1_a_2_pins exclude MC1_FBCLK */
454 static const unsigned mc1_a_2_pins[] = { DB8540_PIN_F3,	DB8540_PIN_C7,
455 	DB8540_PIN_B8, DB8540_PIN_C10, DB8540_PIN_C8,
456 	DB8540_PIN_C9 };
457 static const unsigned hsir_a_1_pins[] = { DB8540_PIN_B9, DB8540_PIN_A10,
458 	DB8540_PIN_D9 };
459 static const unsigned hsit_a_1_pins[] = { DB8540_PIN_B11, DB8540_PIN_B10,
460 	DB8540_PIN_E10, DB8540_PIN_B12, DB8540_PIN_D10 };
461 static const unsigned hsit_a_2_pins[] = { DB8540_PIN_B11, DB8540_PIN_B10,
462 	DB8540_PIN_E10, DB8540_PIN_B12 };
463 static const unsigned clkout1_a_1_pins[] = { DB8540_PIN_D11 };
464 static const unsigned clkout1_a_2_pins[] = { DB8540_PIN_B13 };
465 static const unsigned clkout2_a_1_pins[] = { DB8540_PIN_AJ6 };
466 static const unsigned clkout2_a_2_pins[] = { DB8540_PIN_C12 };
467 static const unsigned msp4_a_1_pins[] = { DB8540_PIN_B14, DB8540_PIN_E11 };
468 static const unsigned usb_a_1_pins[] = { DB8540_PIN_D12, DB8540_PIN_D15,
469 	DB8540_PIN_C13, DB8540_PIN_C14, DB8540_PIN_C18, DB8540_PIN_C16,
470 	DB8540_PIN_B16, DB8540_PIN_D18, DB8540_PIN_C15, DB8540_PIN_C17,
471 	DB8540_PIN_B17, DB8540_PIN_D17 };
472 /* Altfunction B colum */
473 static const unsigned apetrig_b_1_pins[] = { DB8540_PIN_AH6, DB8540_PIN_AG7 };
474 static const unsigned modtrig_b_1_pins[] = { DB8540_PIN_AF2, DB8540_PIN_AD3 };
475 static const unsigned i2c4_b_1_pins[] = { DB8540_PIN_AF6, DB8540_PIN_AG6 };
476 static const unsigned i2c1_b_1_pins[] = { DB8540_PIN_AD5, DB8540_PIN_AF7 };
477 static const unsigned i2c2_b_1_pins[] = { DB8540_PIN_AG5, DB8540_PIN_AH5 };
478 static const unsigned i2c2_b_2_pins[] = { DB8540_PIN_AE4, DB8540_PIN_AD1 };
479 static const unsigned msp0txrx_b_1_pins[] = { DB8540_PIN_AD2, DB8540_PIN_AC3 };
480 static const unsigned i2c1_b_2_pins[] = { DB8540_PIN_AH7, DB8540_PIN_AE7 };
481 static const unsigned stmmod_b_1_pins[] = { DB8540_PIN_AH11, DB8540_PIN_AF11,
482 	DB8540_PIN_AH10, DB8540_PIN_AG10, DB8540_PIN_AF10 };
483 static const unsigned moduartstmmux_b_1_pins[] = { DB8540_PIN_AG11 };
484 static const unsigned msp1txrx_b_1_pins[] = { DB8540_PIN_AD4, DB8540_PIN_AG4 };
485 static const unsigned kp_b_1_pins[] = { DB8540_PIN_AJ24, DB8540_PIN_AE21,
486 	DB8540_PIN_M26, DB8540_PIN_M25, DB8540_PIN_M27, DB8540_PIN_N25,
487 	DB8540_PIN_M28, DB8540_PIN_N26, DB8540_PIN_M22, DB8540_PIN_N22,
488 	DB8540_PIN_N27, DB8540_PIN_N28, DB8540_PIN_P22, DB8540_PIN_P28,
489 	DB8540_PIN_P26, DB8540_PIN_T22, DB8540_PIN_R27, DB8540_PIN_P27,
490 	DB8540_PIN_R26, DB8540_PIN_R25 };
491 static const unsigned u2txrx_b_1_pins[] = { DB8540_PIN_U22, DB8540_PIN_T27 };
492 static const unsigned sm_b_1_pins[] = { DB8540_PIN_AG22, DB8540_PIN_AF21,
493 	DB8540_PIN_AF24, DB8540_PIN_AH22, DB8540_PIN_AJ23, DB8540_PIN_AH21,
494 	DB8540_PIN_AG20, DB8540_PIN_AE23, DB8540_PIN_AH20, DB8540_PIN_AF22,
495 	DB8540_PIN_AJ21, DB8540_PIN_AC27, DB8540_PIN_AD27, DB8540_PIN_AE28,
496 	DB8540_PIN_AG26, DB8540_PIN_AF25, DB8540_PIN_AE27, DB8540_PIN_AF27,
497 	DB8540_PIN_AG28, DB8540_PIN_AF28, DB8540_PIN_AG25, DB8540_PIN_AG24,
498 	DB8540_PIN_AD25 };
499 static const unsigned smcs0_b_1_pins[] = { DB8540_PIN_AG19 };
500 static const unsigned smcs1_b_1_pins[] = { DB8540_PIN_AE26 };
501 static const unsigned ipgpio7_b_1_pins[] = { DB8540_PIN_AH25 };
502 static const unsigned ipgpio2_b_1_pins[] = { DB8540_PIN_AF26 };
503 static const unsigned ipgpio3_b_1_pins[] = { DB8540_PIN_AF23 };
504 static const unsigned i2c6_b_1_pins[] = { DB8540_PIN_AG23, DB8540_PIN_AE25 };
505 static const unsigned i2c5_b_1_pins[] = { DB8540_PIN_AH24, DB8540_PIN_AJ25 };
506 static const unsigned u3txrx_b_1_pins[] = { DB8540_PIN_AF20, DB8540_PIN_AG21 };
507 static const unsigned u3ctsrts_b_1_pins[] = { DB8540_PIN_AH19,
508 	DB8540_PIN_AE19 };
509 static const unsigned i2c5_b_2_pins[] = { DB8540_PIN_AG18, DB8540_PIN_AH17 };
510 static const unsigned i2c4_b_2_pins[] = { DB8540_PIN_AF19, DB8540_PIN_AF18 };
511 static const unsigned u4txrx_b_1_pins[] = { DB8540_PIN_AE18, DB8540_PIN_AG17 };
512 static const unsigned u4ctsrts_b_1_pins[] = { DB8540_PIN_AF17,
513 	DB8540_PIN_AE17 };
514 static const unsigned ddrtrig_b_1_pins[] = { DB8540_PIN_J3 };
515 static const unsigned msp4_b_1_pins[] = { DB8540_PIN_H3 };
516 static const unsigned pwl_b_1_pins[] = { DB8540_PIN_C6 };
517 static const unsigned spi1_b_1_pins[] = { DB8540_PIN_E2, DB8540_PIN_C10,
518 	DB8540_PIN_C8, DB8540_PIN_C9 };
519 static const unsigned mc3_b_1_pins[] = { DB8540_PIN_B9, DB8540_PIN_A10,
520 	DB8540_PIN_D9, DB8540_PIN_B11, DB8540_PIN_B10, DB8540_PIN_E10,
521 	DB8540_PIN_B12 };
522 static const unsigned pwl_b_2_pins[] = { DB8540_PIN_D10 };
523 static const unsigned pwl_b_3_pins[] = { DB8540_PIN_B13 };
524 static const unsigned pwl_b_4_pins[] = { DB8540_PIN_C12 };
525 static const unsigned u2txrx_b_2_pins[] = { DB8540_PIN_B17, DB8540_PIN_D17 };
526 
527 /* Altfunction C column */
528 static const unsigned ipgpio6_c_1_pins[] = { DB8540_PIN_AG6 };
529 static const unsigned ipgpio0_c_1_pins[] = { DB8540_PIN_AD5 };
530 static const unsigned ipgpio1_c_1_pins[] = { DB8540_PIN_AF7 };
531 static const unsigned ipgpio3_c_1_pins[] = { DB8540_PIN_AE4 };
532 static const unsigned ipgpio2_c_1_pins[] = { DB8540_PIN_AD1 };
533 static const unsigned u0_c_1_pins[] = { DB8540_PIN_AD4, DB8540_PIN_AF3,
534 	DB8540_PIN_AF5, DB8540_PIN_AG4 };
535 static const unsigned smcleale_c_1_pins[] = { DB8540_PIN_AJ24,
536 	DB8540_PIN_AE21 };
537 static const unsigned ipgpio4_c_1_pins[] = { DB8540_PIN_M26 };
538 static const unsigned ipgpio5_c_1_pins[] = { DB8540_PIN_M25 };
539 static const unsigned ipgpio6_c_2_pins[] = { DB8540_PIN_M27 };
540 static const unsigned ipgpio7_c_1_pins[] = { DB8540_PIN_N25 };
541 static const unsigned stmape_c_1_pins[] = { DB8540_PIN_M28, DB8540_PIN_N26,
542 	DB8540_PIN_M22, DB8540_PIN_N22, DB8540_PIN_N27 };
543 static const unsigned u2rxtx_c_1_pins[] = { DB8540_PIN_N28, DB8540_PIN_P22 };
544 static const unsigned modobsresout_c_1_pins[] = { DB8540_PIN_P28 };
545 static const unsigned ipgpio2_c_2_pins[] = { DB8540_PIN_P26 };
546 static const unsigned ipgpio3_c_2_pins[] = { DB8540_PIN_T22 };
547 static const unsigned ipgpio4_c_2_pins[] = { DB8540_PIN_R27 };
548 static const unsigned ipgpio5_c_2_pins[] = { DB8540_PIN_P27 };
549 static const unsigned modaccgpo_c_1_pins[] = { DB8540_PIN_R26, DB8540_PIN_R25,
550 	DB8540_PIN_U22 };
551 static const unsigned modobspwrrst_c_1_pins[] = { DB8540_PIN_T27 };
552 static const unsigned mc5_c_1_pins[] = { DB8540_PIN_AG22, DB8540_PIN_AF21,
553 	DB8540_PIN_AF24, DB8540_PIN_AH22, DB8540_PIN_AJ23, DB8540_PIN_AH21,
554 	DB8540_PIN_AG20, DB8540_PIN_AE23, DB8540_PIN_AH20, DB8540_PIN_AF22,
555 	DB8540_PIN_AJ21};
556 static const unsigned smps0_c_1_pins[] = { DB8540_PIN_AG19 };
557 static const unsigned moduart1_c_1_pins[] = { DB8540_PIN_T25, DB8540_PIN_T26 };
558 static const unsigned mc2rstn_c_1_pins[] = { DB8540_PIN_AE28 };
559 static const unsigned i2c5_c_1_pins[] = { DB8540_PIN_AG28, DB8540_PIN_AF28 };
560 static const unsigned ipgpio0_c_2_pins[] = { DB8540_PIN_AG25 };
561 static const unsigned ipgpio1_c_2_pins[] = { DB8540_PIN_AG24 };
562 static const unsigned kp_c_1_pins[] = { DB8540_PIN_AD25, DB8540_PIN_AH25,
563 	DB8540_PIN_AF26, DB8540_PIN_AF23 };
564 static const unsigned modrf_c_1_pins[] = { DB8540_PIN_AG23, DB8540_PIN_AE25,
565 	DB8540_PIN_AH24 };
566 static const unsigned smps1_c_1_pins[] = { DB8540_PIN_AE26 };
567 static const unsigned i2c5_c_2_pins[] = { DB8540_PIN_AH19, DB8540_PIN_AE19 };
568 static const unsigned u4ctsrts_c_1_pins[] = { DB8540_PIN_AG18,
569 	DB8540_PIN_AH17 };
570 static const unsigned u3rxtx_c_1_pins[] = { DB8540_PIN_AF19, DB8540_PIN_AF18 };
571 static const unsigned msp4_c_1_pins[] = { DB8540_PIN_J3 };
572 static const unsigned mc4rstn_c_1_pins[] = { DB8540_PIN_C6 };
573 static const unsigned spi0_c_1_pins[] = { DB8540_PIN_A10, DB8540_PIN_B10,
574 	DB8540_PIN_E10, DB8540_PIN_B12 };
575 static const unsigned i2c3_c_1_pins[] = { DB8540_PIN_B13, DB8540_PIN_C12 };
576 
577 /* Other alt C1 column */
578 static const unsigned spi3_oc1_1_pins[] = { DB8540_PIN_AG5, DB8540_PIN_AH5,
579 	DB8540_PIN_AE4, DB8540_PIN_AD1 };
580 static const unsigned stmape_oc1_1_pins[] = { DB8540_PIN_AH11, DB8540_PIN_AF11,
581 	DB8540_PIN_AH10, DB8540_PIN_AG10, DB8540_PIN_AF10 };
582 static const unsigned u2_oc1_1_pins[] = { DB8540_PIN_AG11 };
583 static const unsigned remap0_oc1_1_pins[] = { DB8540_PIN_AJ24 };
584 static const unsigned remap1_oc1_1_pins[] = { DB8540_PIN_AE21 };
585 static const unsigned modobsrefclk_oc1_1_pins[] = { DB8540_PIN_M26 };
586 static const unsigned modobspwrctrl_oc1_1_pins[] = { DB8540_PIN_M25 };
587 static const unsigned modobsclkout_oc1_1_pins[] = { DB8540_PIN_M27 };
588 static const unsigned moduart1_oc1_1_pins[] = { DB8540_PIN_N25 };
589 static const unsigned modprcmudbg_oc1_1_pins[] = { DB8540_PIN_M28,
590 	DB8540_PIN_N26, DB8540_PIN_M22, DB8540_PIN_N22, DB8540_PIN_N27,
591 	DB8540_PIN_P22, DB8540_PIN_P28, DB8540_PIN_P26, DB8540_PIN_T22,
592 	DB8540_PIN_R26, DB8540_PIN_R25, DB8540_PIN_U22, DB8540_PIN_T27,
593 	DB8540_PIN_AH20, DB8540_PIN_AG19, DB8540_PIN_AF22, DB8540_PIN_AJ21,
594 	DB8540_PIN_T25};
595 static const unsigned modobsresout_oc1_1_pins[] = { DB8540_PIN_N28 };
596 static const unsigned modaccgpo_oc1_1_pins[] = { DB8540_PIN_R27, DB8540_PIN_P27,
597 	DB8540_PIN_T26 };
598 static const unsigned kp_oc1_1_pins[] = { DB8540_PIN_AG22, DB8540_PIN_AF21,
599 	DB8540_PIN_AF24, DB8540_PIN_AH22, DB8540_PIN_AJ23, DB8540_PIN_AH21,
600 	DB8540_PIN_AG20, DB8540_PIN_AE23 };
601 static const unsigned modxmip_oc1_1_pins[] = { DB8540_PIN_AD25, DB8540_PIN_AH25,
602 	DB8540_PIN_AG23, DB8540_PIN_AE25 };
603 static const unsigned i2c6_oc1_1_pins[] = { DB8540_PIN_AE26, DB8540_PIN_AE24 };
604 static const unsigned u2txrx_oc1_1_pins[] = { DB8540_PIN_B7, DB8540_PIN_A7 };
605 static const unsigned u2ctsrts_oc1_1_pins[] = { DB8540_PIN_D7, DB8540_PIN_D8 };
606 
607 /* Other alt C2 column */
608 static const unsigned sbag_oc2_1_pins[] = { DB8540_PIN_AH11, DB8540_PIN_AG11,
609 	DB8540_PIN_AF11, DB8540_PIN_AH10, DB8540_PIN_AG10, DB8540_PIN_AF10 };
610 static const unsigned hxclk_oc2_1_pins[] = { DB8540_PIN_M25 };
611 static const unsigned modaccuart_oc2_1_pins[] = { DB8540_PIN_N25 };
612 static const unsigned stmmod_oc2_1_pins[] = { DB8540_PIN_M28, DB8540_PIN_N26,
613 	DB8540_PIN_M22, DB8540_PIN_N22, DB8540_PIN_N27 };
614 static const unsigned moduartstmmux_oc2_1_pins[] = { DB8540_PIN_N28 };
615 static const unsigned hxgpio_oc2_1_pins[] = { DB8540_PIN_P22, DB8540_PIN_P28,
616 	DB8540_PIN_P26, DB8540_PIN_T22, DB8540_PIN_R27, DB8540_PIN_P27,
617 	DB8540_PIN_R26, DB8540_PIN_R25 };
618 static const unsigned sbag_oc2_2_pins[] = { DB8540_PIN_U22, DB8540_PIN_T27,
619 	DB8540_PIN_AG22, DB8540_PIN_AF21, DB8540_PIN_AF24, DB8540_PIN_AH22 };
620 static const unsigned modobsservice_oc2_1_pins[] = { DB8540_PIN_AJ23 };
621 static const unsigned moduart0_oc2_1_pins[] = { DB8540_PIN_AG20,
622 	DB8540_PIN_AE23 };
623 static const unsigned stmape_oc2_1_pins[] = { DB8540_PIN_AH20, DB8540_PIN_AG19,
624 	DB8540_PIN_AF22, DB8540_PIN_AJ21, DB8540_PIN_T25 };
625 static const unsigned u2_oc2_1_pins[] = { DB8540_PIN_T26, DB8540_PIN_AH21 };
626 static const unsigned modxmip_oc2_1_pins[] = { DB8540_PIN_AE26,
627 	DB8540_PIN_AE24 };
628 
629 /* Other alt C3 column */
630 static const unsigned modaccgpo_oc3_1_pins[] = { DB8540_PIN_AG11 };
631 static const unsigned tpui_oc3_1_pins[] = { DB8540_PIN_M26, DB8540_PIN_M25,
632 	DB8540_PIN_M27, DB8540_PIN_N25, DB8540_PIN_M28, DB8540_PIN_N26,
633 	DB8540_PIN_M22, DB8540_PIN_N22, DB8540_PIN_N27, DB8540_PIN_N28,
634 	DB8540_PIN_P22, DB8540_PIN_P28, DB8540_PIN_P26, DB8540_PIN_T22,
635 	DB8540_PIN_R27, DB8540_PIN_P27, DB8540_PIN_R26, DB8540_PIN_R25,
636 	DB8540_PIN_U22, DB8540_PIN_T27, DB8540_PIN_AG22, DB8540_PIN_AF21,
637 	DB8540_PIN_AF24, DB8540_PIN_AH22, DB8540_PIN_AJ23, DB8540_PIN_AH21,
638 	DB8540_PIN_AG20, DB8540_PIN_AE23, DB8540_PIN_AH20, DB8540_PIN_AG19,
639 	DB8540_PIN_AF22, DB8540_PIN_AJ21, DB8540_PIN_T25, DB8540_PIN_T26 };
640 
641 /* Other alt C4 column */
642 static const unsigned hwobs_oc4_1_pins[] = { DB8540_PIN_M26, DB8540_PIN_M25,
643 	DB8540_PIN_M27, DB8540_PIN_N25, DB8540_PIN_M28, DB8540_PIN_N26,
644 	DB8540_PIN_M22, DB8540_PIN_N22, DB8540_PIN_N27, DB8540_PIN_N28,
645 	DB8540_PIN_P22, DB8540_PIN_P28, DB8540_PIN_P26, DB8540_PIN_T22,
646 	DB8540_PIN_R27, DB8540_PIN_P27, DB8540_PIN_R26, DB8540_PIN_R25 };
647 static const unsigned moduart1txrx_oc4_1_pins[] = { DB8540_PIN_U22,
648 	DB8540_PIN_T27 };
649 static const unsigned moduart1rtscts_oc4_1_pins[] = { DB8540_PIN_AG22,
650 	DB8540_PIN_AF21 };
651 static const unsigned modaccuarttxrx_oc4_1_pins[] = { DB8540_PIN_AF24,
652 	DB8540_PIN_AH22 };
653 static const unsigned modaccuartrtscts_oc4_1_pins[] = { DB8540_PIN_AJ23,
654 	DB8540_PIN_AH21 };
655 static const unsigned stmmod_oc4_1_pins[] = { DB8540_PIN_AH20, DB8540_PIN_AG19,
656 	DB8540_PIN_AF22, DB8540_PIN_AJ21, DB8540_PIN_T25 };
657 static const unsigned moduartstmmux_oc4_1_pins[] = { DB8540_PIN_T26 };
658 
659 #define DB8540_PIN_GROUP(a, b) { .name = #a, .pins = a##_pins,		\
660 			.npins = ARRAY_SIZE(a##_pins), .altsetting = b }
661 
662 static const struct nmk_pingroup nmk_db8540_groups[] = {
663 	/* Altfunction A column */
664 	DB8540_PIN_GROUP(u0_a_1, NMK_GPIO_ALT_A),
665 	DB8540_PIN_GROUP(u1rxtx_a_1, NMK_GPIO_ALT_A),
666 	DB8540_PIN_GROUP(u1ctsrts_a_1, NMK_GPIO_ALT_A),
667 	DB8540_PIN_GROUP(ipi2c_a_1, NMK_GPIO_ALT_A),
668 	DB8540_PIN_GROUP(ipi2c_a_2, NMK_GPIO_ALT_A),
669 	DB8540_PIN_GROUP(msp0txrx_a_1, NMK_GPIO_ALT_A),
670 	DB8540_PIN_GROUP(msp0tfstck_a_1, NMK_GPIO_ALT_A),
671 	DB8540_PIN_GROUP(msp0rfsrck_a_1, NMK_GPIO_ALT_A),
672 	DB8540_PIN_GROUP(mc0_a_1, NMK_GPIO_ALT_A),
673 	DB8540_PIN_GROUP(msp1txrx_a_1, NMK_GPIO_ALT_A),
674 	DB8540_PIN_GROUP(msp1_a_1, NMK_GPIO_ALT_A),
675 	DB8540_PIN_GROUP(modobsclk_a_1, NMK_GPIO_ALT_A),
676 	DB8540_PIN_GROUP(clkoutreq_a_1, NMK_GPIO_ALT_A),
677 	DB8540_PIN_GROUP(lcdb_a_1, NMK_GPIO_ALT_A),
678 	DB8540_PIN_GROUP(lcdvsi0_a_1, NMK_GPIO_ALT_A),
679 	DB8540_PIN_GROUP(lcdvsi1_a_1, NMK_GPIO_ALT_A),
680 	DB8540_PIN_GROUP(lcd_d0_d7_a_1, NMK_GPIO_ALT_A),
681 	DB8540_PIN_GROUP(lcd_d8_d11_a_1, NMK_GPIO_ALT_A),
682 	DB8540_PIN_GROUP(lcd_d12_d23_a_1, NMK_GPIO_ALT_A),
683 	DB8540_PIN_GROUP(kp_a_1, NMK_GPIO_ALT_A),
684 	DB8540_PIN_GROUP(mc2_a_1, NMK_GPIO_ALT_A),
685 	DB8540_PIN_GROUP(ssp1_a_1, NMK_GPIO_ALT_A),
686 	DB8540_PIN_GROUP(ssp0_a_1, NMK_GPIO_ALT_A),
687 	DB8540_PIN_GROUP(i2c0_a_1, NMK_GPIO_ALT_A),
688 	DB8540_PIN_GROUP(ipgpio0_a_1, NMK_GPIO_ALT_A),
689 	DB8540_PIN_GROUP(ipgpio1_a_1, NMK_GPIO_ALT_A),
690 	DB8540_PIN_GROUP(modi2s_a_1, NMK_GPIO_ALT_A),
691 	DB8540_PIN_GROUP(spi2_a_1, NMK_GPIO_ALT_A),
692 	DB8540_PIN_GROUP(u2txrx_a_1, NMK_GPIO_ALT_A),
693 	DB8540_PIN_GROUP(u2ctsrts_a_1, NMK_GPIO_ALT_A),
694 	DB8540_PIN_GROUP(modsmb_a_1, NMK_GPIO_ALT_A),
695 	DB8540_PIN_GROUP(msp2sck_a_1, NMK_GPIO_ALT_A),
696 	DB8540_PIN_GROUP(msp2txdtcktfs_a_1, NMK_GPIO_ALT_A),
697 	DB8540_PIN_GROUP(msp2rxd_a_1, NMK_GPIO_ALT_A),
698 	DB8540_PIN_GROUP(mc4_a_1, NMK_GPIO_ALT_A),
699 	DB8540_PIN_GROUP(mc1_a_1, NMK_GPIO_ALT_A),
700 	DB8540_PIN_GROUP(hsir_a_1, NMK_GPIO_ALT_A),
701 	DB8540_PIN_GROUP(hsit_a_1, NMK_GPIO_ALT_A),
702 	DB8540_PIN_GROUP(hsit_a_2, NMK_GPIO_ALT_A),
703 	DB8540_PIN_GROUP(clkout1_a_1, NMK_GPIO_ALT_A),
704 	DB8540_PIN_GROUP(clkout1_a_2, NMK_GPIO_ALT_A),
705 	DB8540_PIN_GROUP(clkout2_a_1, NMK_GPIO_ALT_A),
706 	DB8540_PIN_GROUP(clkout2_a_2, NMK_GPIO_ALT_A),
707 	DB8540_PIN_GROUP(msp4_a_1, NMK_GPIO_ALT_A),
708 	DB8540_PIN_GROUP(usb_a_1, NMK_GPIO_ALT_A),
709 	/* Altfunction B column */
710 	DB8540_PIN_GROUP(apetrig_b_1, NMK_GPIO_ALT_B),
711 	DB8540_PIN_GROUP(modtrig_b_1, NMK_GPIO_ALT_B),
712 	DB8540_PIN_GROUP(i2c4_b_1, NMK_GPIO_ALT_B),
713 	DB8540_PIN_GROUP(i2c1_b_1, NMK_GPIO_ALT_B),
714 	DB8540_PIN_GROUP(i2c2_b_1, NMK_GPIO_ALT_B),
715 	DB8540_PIN_GROUP(i2c2_b_2, NMK_GPIO_ALT_B),
716 	DB8540_PIN_GROUP(msp0txrx_b_1, NMK_GPIO_ALT_B),
717 	DB8540_PIN_GROUP(i2c1_b_2, NMK_GPIO_ALT_B),
718 	DB8540_PIN_GROUP(stmmod_b_1, NMK_GPIO_ALT_B),
719 	DB8540_PIN_GROUP(moduartstmmux_b_1, NMK_GPIO_ALT_B),
720 	DB8540_PIN_GROUP(msp1txrx_b_1, NMK_GPIO_ALT_B),
721 	DB8540_PIN_GROUP(kp_b_1, NMK_GPIO_ALT_B),
722 	DB8540_PIN_GROUP(u2txrx_b_1, NMK_GPIO_ALT_B),
723 	DB8540_PIN_GROUP(sm_b_1, NMK_GPIO_ALT_B),
724 	DB8540_PIN_GROUP(smcs0_b_1, NMK_GPIO_ALT_B),
725 	DB8540_PIN_GROUP(smcs1_b_1, NMK_GPIO_ALT_B),
726 	DB8540_PIN_GROUP(ipgpio7_b_1, NMK_GPIO_ALT_B),
727 	DB8540_PIN_GROUP(ipgpio2_b_1, NMK_GPIO_ALT_B),
728 	DB8540_PIN_GROUP(ipgpio3_b_1, NMK_GPIO_ALT_B),
729 	DB8540_PIN_GROUP(i2c6_b_1, NMK_GPIO_ALT_B),
730 	DB8540_PIN_GROUP(i2c5_b_1, NMK_GPIO_ALT_B),
731 	DB8540_PIN_GROUP(u3txrx_b_1, NMK_GPIO_ALT_B),
732 	DB8540_PIN_GROUP(u3ctsrts_b_1, NMK_GPIO_ALT_B),
733 	DB8540_PIN_GROUP(i2c5_b_2, NMK_GPIO_ALT_B),
734 	DB8540_PIN_GROUP(i2c4_b_2, NMK_GPIO_ALT_B),
735 	DB8540_PIN_GROUP(u4txrx_b_1, NMK_GPIO_ALT_B),
736 	DB8540_PIN_GROUP(u4ctsrts_b_1, NMK_GPIO_ALT_B),
737 	DB8540_PIN_GROUP(ddrtrig_b_1, NMK_GPIO_ALT_B),
738 	DB8540_PIN_GROUP(msp4_b_1, NMK_GPIO_ALT_B),
739 	DB8540_PIN_GROUP(pwl_b_1, NMK_GPIO_ALT_B),
740 	DB8540_PIN_GROUP(spi1_b_1, NMK_GPIO_ALT_B),
741 	DB8540_PIN_GROUP(mc3_b_1, NMK_GPIO_ALT_B),
742 	DB8540_PIN_GROUP(pwl_b_2, NMK_GPIO_ALT_B),
743 	DB8540_PIN_GROUP(pwl_b_3, NMK_GPIO_ALT_B),
744 	DB8540_PIN_GROUP(pwl_b_4, NMK_GPIO_ALT_B),
745 	DB8540_PIN_GROUP(u2txrx_b_2, NMK_GPIO_ALT_B),
746 	/* Altfunction C column */
747 	DB8540_PIN_GROUP(ipgpio6_c_1, NMK_GPIO_ALT_C),
748 	DB8540_PIN_GROUP(ipgpio0_c_1, NMK_GPIO_ALT_C),
749 	DB8540_PIN_GROUP(ipgpio1_c_1, NMK_GPIO_ALT_C),
750 	DB8540_PIN_GROUP(ipgpio3_c_1, NMK_GPIO_ALT_C),
751 	DB8540_PIN_GROUP(ipgpio2_c_1, NMK_GPIO_ALT_C),
752 	DB8540_PIN_GROUP(u0_c_1, NMK_GPIO_ALT_C),
753 	DB8540_PIN_GROUP(smcleale_c_1, NMK_GPIO_ALT_C),
754 	DB8540_PIN_GROUP(ipgpio4_c_1, NMK_GPIO_ALT_C),
755 	DB8540_PIN_GROUP(ipgpio5_c_1, NMK_GPIO_ALT_C),
756 	DB8540_PIN_GROUP(ipgpio6_c_2, NMK_GPIO_ALT_C),
757 	DB8540_PIN_GROUP(ipgpio7_c_1, NMK_GPIO_ALT_C),
758 	DB8540_PIN_GROUP(stmape_c_1, NMK_GPIO_ALT_C),
759 	DB8540_PIN_GROUP(u2rxtx_c_1, NMK_GPIO_ALT_C),
760 	DB8540_PIN_GROUP(modobsresout_c_1, NMK_GPIO_ALT_C),
761 	DB8540_PIN_GROUP(ipgpio2_c_2, NMK_GPIO_ALT_C),
762 	DB8540_PIN_GROUP(ipgpio3_c_2, NMK_GPIO_ALT_C),
763 	DB8540_PIN_GROUP(ipgpio4_c_2, NMK_GPIO_ALT_C),
764 	DB8540_PIN_GROUP(ipgpio5_c_2, NMK_GPIO_ALT_C),
765 	DB8540_PIN_GROUP(modaccgpo_c_1, NMK_GPIO_ALT_C),
766 	DB8540_PIN_GROUP(modobspwrrst_c_1, NMK_GPIO_ALT_C),
767 	DB8540_PIN_GROUP(mc5_c_1, NMK_GPIO_ALT_C),
768 	DB8540_PIN_GROUP(smps0_c_1, NMK_GPIO_ALT_C),
769 	DB8540_PIN_GROUP(moduart1_c_1, NMK_GPIO_ALT_C),
770 	DB8540_PIN_GROUP(mc2rstn_c_1, NMK_GPIO_ALT_C),
771 	DB8540_PIN_GROUP(i2c5_c_1, NMK_GPIO_ALT_C),
772 	DB8540_PIN_GROUP(ipgpio0_c_2, NMK_GPIO_ALT_C),
773 	DB8540_PIN_GROUP(ipgpio1_c_2, NMK_GPIO_ALT_C),
774 	DB8540_PIN_GROUP(kp_c_1, NMK_GPIO_ALT_C),
775 	DB8540_PIN_GROUP(modrf_c_1, NMK_GPIO_ALT_C),
776 	DB8540_PIN_GROUP(smps1_c_1, NMK_GPIO_ALT_C),
777 	DB8540_PIN_GROUP(i2c5_c_2, NMK_GPIO_ALT_C),
778 	DB8540_PIN_GROUP(u4ctsrts_c_1, NMK_GPIO_ALT_C),
779 	DB8540_PIN_GROUP(u3rxtx_c_1, NMK_GPIO_ALT_C),
780 	DB8540_PIN_GROUP(msp4_c_1, NMK_GPIO_ALT_C),
781 	DB8540_PIN_GROUP(mc4rstn_c_1, NMK_GPIO_ALT_C),
782 	DB8540_PIN_GROUP(spi0_c_1, NMK_GPIO_ALT_C),
783 	DB8540_PIN_GROUP(i2c3_c_1, NMK_GPIO_ALT_C),
784 
785 	/* Other alt C1 column */
786 	DB8540_PIN_GROUP(spi3_oc1_1, NMK_GPIO_ALT_C1),
787 	DB8540_PIN_GROUP(stmape_oc1_1, NMK_GPIO_ALT_C1),
788 	DB8540_PIN_GROUP(u2_oc1_1, NMK_GPIO_ALT_C1),
789 	DB8540_PIN_GROUP(remap0_oc1_1, NMK_GPIO_ALT_C1),
790 	DB8540_PIN_GROUP(remap1_oc1_1, NMK_GPIO_ALT_C1),
791 	DB8540_PIN_GROUP(modobsrefclk_oc1_1, NMK_GPIO_ALT_C1),
792 	DB8540_PIN_GROUP(modobspwrctrl_oc1_1, NMK_GPIO_ALT_C1),
793 	DB8540_PIN_GROUP(modobsclkout_oc1_1, NMK_GPIO_ALT_C1),
794 	DB8540_PIN_GROUP(moduart1_oc1_1, NMK_GPIO_ALT_C1),
795 	DB8540_PIN_GROUP(modprcmudbg_oc1_1, NMK_GPIO_ALT_C1),
796 	DB8540_PIN_GROUP(modobsresout_oc1_1, NMK_GPIO_ALT_C1),
797 	DB8540_PIN_GROUP(modaccgpo_oc1_1, NMK_GPIO_ALT_C1),
798 	DB8540_PIN_GROUP(kp_oc1_1, NMK_GPIO_ALT_C1),
799 	DB8540_PIN_GROUP(modxmip_oc1_1, NMK_GPIO_ALT_C1),
800 	DB8540_PIN_GROUP(i2c6_oc1_1, NMK_GPIO_ALT_C1),
801 	DB8540_PIN_GROUP(u2txrx_oc1_1, NMK_GPIO_ALT_C1),
802 	DB8540_PIN_GROUP(u2ctsrts_oc1_1, NMK_GPIO_ALT_C1),
803 
804 	/* Other alt C2 column */
805 	DB8540_PIN_GROUP(sbag_oc2_1, NMK_GPIO_ALT_C2),
806 	DB8540_PIN_GROUP(hxclk_oc2_1, NMK_GPIO_ALT_C2),
807 	DB8540_PIN_GROUP(modaccuart_oc2_1, NMK_GPIO_ALT_C2),
808 	DB8540_PIN_GROUP(stmmod_oc2_1, NMK_GPIO_ALT_C2),
809 	DB8540_PIN_GROUP(moduartstmmux_oc2_1, NMK_GPIO_ALT_C2),
810 	DB8540_PIN_GROUP(hxgpio_oc2_1, NMK_GPIO_ALT_C2),
811 	DB8540_PIN_GROUP(sbag_oc2_2, NMK_GPIO_ALT_C2),
812 	DB8540_PIN_GROUP(modobsservice_oc2_1, NMK_GPIO_ALT_C2),
813 	DB8540_PIN_GROUP(moduart0_oc2_1, NMK_GPIO_ALT_C2),
814 	DB8540_PIN_GROUP(stmape_oc2_1, NMK_GPIO_ALT_C2),
815 	DB8540_PIN_GROUP(u2_oc2_1, NMK_GPIO_ALT_C2),
816 	DB8540_PIN_GROUP(modxmip_oc2_1, NMK_GPIO_ALT_C2),
817 
818 	/* Other alt C3 column */
819 	DB8540_PIN_GROUP(modaccgpo_oc3_1, NMK_GPIO_ALT_C3),
820 	DB8540_PIN_GROUP(tpui_oc3_1, NMK_GPIO_ALT_C3),
821 
822 	/* Other alt C4 column */
823 	DB8540_PIN_GROUP(hwobs_oc4_1, NMK_GPIO_ALT_C4),
824 	DB8540_PIN_GROUP(moduart1txrx_oc4_1, NMK_GPIO_ALT_C4),
825 	DB8540_PIN_GROUP(moduart1rtscts_oc4_1, NMK_GPIO_ALT_C4),
826 	DB8540_PIN_GROUP(modaccuarttxrx_oc4_1, NMK_GPIO_ALT_C4),
827 	DB8540_PIN_GROUP(modaccuartrtscts_oc4_1, NMK_GPIO_ALT_C4),
828 	DB8540_PIN_GROUP(stmmod_oc4_1, NMK_GPIO_ALT_C4),
829 	DB8540_PIN_GROUP(moduartstmmux_oc4_1, NMK_GPIO_ALT_C4),
830 
831 };
832 
833 /* We use this macro to define the groups applicable to a function */
834 #define DB8540_FUNC_GROUPS(a, b...)	   \
835 static const char * const a##_groups[] = { b };
836 
837 DB8540_FUNC_GROUPS(apetrig, "apetrig_b_1");
838 DB8540_FUNC_GROUPS(clkout, "clkoutreq_a_1", "clkout1_a_1", "clkout1_a_2",
839 		"clkout2_a_1", "clkout2_a_2");
840 DB8540_FUNC_GROUPS(ddrtrig, "ddrtrig_b_1");
841 DB8540_FUNC_GROUPS(hsi, "hsir_a_1", "hsit_a_1", "hsit_a_2");
842 DB8540_FUNC_GROUPS(hwobs, "hwobs_oc4_1");
843 DB8540_FUNC_GROUPS(hx, "hxclk_oc2_1", "hxgpio_oc2_1");
844 DB8540_FUNC_GROUPS(i2c0, "i2c0_a_1");
845 DB8540_FUNC_GROUPS(i2c1, "i2c1_b_1", "i2c1_b_2");
846 DB8540_FUNC_GROUPS(i2c2, "i2c2_b_1", "i2c2_b_2");
847 DB8540_FUNC_GROUPS(i2c3, "i2c3_c_1", "i2c4_b_1");
848 DB8540_FUNC_GROUPS(i2c4, "i2c4_b_2");
849 DB8540_FUNC_GROUPS(i2c5, "i2c5_b_1", "i2c5_b_2", "i2c5_c_1", "i2c5_c_2");
850 DB8540_FUNC_GROUPS(i2c6, "i2c6_b_1", "i2c6_oc1_1");
851 /* The image processor has 8 GPIO pins that can be muxed out */
852 DB8540_FUNC_GROUPS(ipgpio, "ipgpio0_a_1", "ipgpio0_c_1", "ipgpio0_c_2",
853 		"ipgpio1_a_1", "ipgpio1_c_1", "ipgpio1_c_2",
854 		"ipgpio2_b_1", "ipgpio2_c_1", "ipgpio2_c_2",
855 		"ipgpio3_b_1", "ipgpio3_c_1", "ipgpio3_c_2",
856 		"ipgpio4_c_1", "ipgpio4_c_2",
857 		"ipgpio5_c_1", "ipgpio5_c_2",
858 		"ipgpio6_c_1", "ipgpio6_c_2",
859 		"ipgpio7_b_1", "ipgpio7_c_1");
860 DB8540_FUNC_GROUPS(ipi2c, "ipi2c_a_1", "ipi2c_a_2");
861 DB8540_FUNC_GROUPS(kp, "kp_a_1", "kp_b_1", "kp_c_1", "kp_oc1_1");
862 DB8540_FUNC_GROUPS(lcd, "lcd_d0_d7_a_1", "lcd_d12_d23_a_1", "lcd_d8_d11_a_1",
863 		"lcdvsi0_a_1", "lcdvsi1_a_1");
864 DB8540_FUNC_GROUPS(lcdb, "lcdb_a_1");
865 DB8540_FUNC_GROUPS(mc0, "mc0_a_1");
866 DB8540_FUNC_GROUPS(mc1, "mc1_a_1", "mc1_a_2");
867 DB8540_FUNC_GROUPS(mc2, "mc2_a_1", "mc2rstn_c_1");
868 DB8540_FUNC_GROUPS(mc3, "mc3_b_1");
869 DB8540_FUNC_GROUPS(mc4, "mc4_a_1", "mc4rstn_c_1");
870 DB8540_FUNC_GROUPS(mc5, "mc5_c_1");
871 DB8540_FUNC_GROUPS(modaccgpo, "modaccgpo_c_1", "modaccgpo_oc1_1",
872 		"modaccgpo_oc3_1");
873 DB8540_FUNC_GROUPS(modaccuart, "modaccuart_oc2_1", "modaccuarttxrx_oc4_1",
874 		"modaccuartrtccts_oc4_1");
875 DB8540_FUNC_GROUPS(modi2s, "modi2s_a_1");
876 DB8540_FUNC_GROUPS(modobs, "modobsclk_a_1", "modobsclkout_oc1_1",
877 		"modobspwrctrl_oc1_1", "modobspwrrst_c_1",
878 		"modobsrefclk_oc1_1", "modobsresout_c_1",
879 		"modobsresout_oc1_1", "modobsservice_oc2_1");
880 DB8540_FUNC_GROUPS(modprcmudbg, "modprcmudbg_oc1_1");
881 DB8540_FUNC_GROUPS(modrf, "modrf_c_1");
882 DB8540_FUNC_GROUPS(modsmb, "modsmb_a_1");
883 DB8540_FUNC_GROUPS(modtrig, "modtrig_b_1");
884 DB8540_FUNC_GROUPS(moduart, "moduart1_c_1", "moduart1_oc1_1",
885 		"moduart1txrx_oc4_1", "moduart1rtscts_oc4_1", "moduart0_oc2_1");
886 DB8540_FUNC_GROUPS(moduartstmmux, "moduartstmmux_b_1", "moduartstmmux_oc2_1",
887 		"moduartstmmux_oc4_1");
888 DB8540_FUNC_GROUPS(modxmip, "modxmip_oc1_1", "modxmip_oc2_1");
889 /*
890  * MSP0 can only be on a certain set of pins, but the TX/RX pins can be
891  * switched around by selecting the altfunction A or B.
892  */
893 DB8540_FUNC_GROUPS(msp0, "msp0rfsrck_a_1", "msp0tfstck_a_1", "msp0txrx_a_1",
894 		"msp0txrx_b_1");
895 DB8540_FUNC_GROUPS(msp1, "msp1_a_1", "msp1txrx_a_1", "msp1txrx_b_1");
896 DB8540_FUNC_GROUPS(msp2, "msp2sck_a_1", "msp2txdtcktfs_a_1", "msp2rxd_a_1");
897 DB8540_FUNC_GROUPS(msp4, "msp4_a_1", "msp4_b_1", "msp4_c_1");
898 DB8540_FUNC_GROUPS(pwl, "pwl_b_1", "pwl_b_2", "pwl_b_3", "pwl_b_4");
899 DB8540_FUNC_GROUPS(remap, "remap0_oc1_1", "remap1_oc1_1");
900 DB8540_FUNC_GROUPS(sbag, "sbag_oc2_1", "sbag_oc2_2");
901 /* Select between CS0 on alt B or PS1 on alt C */
902 DB8540_FUNC_GROUPS(sm, "sm_b_1", "smcleale_c_1", "smcs0_b_1", "smcs1_b_1",
903 		"smps0_c_1", "smps1_c_1");
904 DB8540_FUNC_GROUPS(spi0, "spi0_c_1");
905 DB8540_FUNC_GROUPS(spi1, "spi1_b_1");
906 DB8540_FUNC_GROUPS(spi2, "spi2_a_1");
907 DB8540_FUNC_GROUPS(spi3, "spi3_oc1_1");
908 DB8540_FUNC_GROUPS(ssp0, "ssp0_a_1");
909 DB8540_FUNC_GROUPS(ssp1, "ssp1_a_1");
910 DB8540_FUNC_GROUPS(stmape, "stmape_c_1", "stmape_oc1_1", "stmape_oc2_1");
911 DB8540_FUNC_GROUPS(stmmod, "stmmod_b_1", "stmmod_oc2_1", "stmmod_oc4_1");
912 DB8540_FUNC_GROUPS(tpui, "tpui_oc3_1");
913 DB8540_FUNC_GROUPS(u0, "u0_a_1", "u0_c_1");
914 DB8540_FUNC_GROUPS(u1, "u1ctsrts_a_1", "u1rxtx_a_1");
915 DB8540_FUNC_GROUPS(u2, "u2_oc1_1", "u2_oc2_1", "u2ctsrts_a_1", "u2ctsrts_oc1_1",
916 		"u2rxtx_c_1", "u2txrx_a_1", "u2txrx_b_1", "u2txrx_b_2",
917 		"u2txrx_oc1_1");
918 DB8540_FUNC_GROUPS(u3, "u3ctsrts_b_1", "u3rxtx_c_1", "u3txrxa_b_1");
919 DB8540_FUNC_GROUPS(u4, "u4ctsrts_b_1", "u4ctsrts_c_1", "u4txrx_b_1");
920 DB8540_FUNC_GROUPS(usb, "usb_a_1");
921 
922 
923 #define FUNCTION(fname)					\
924 	{						\
925 		.name = #fname,				\
926 		.groups = fname##_groups,		\
927 		.ngroups = ARRAY_SIZE(fname##_groups),	\
928 	}
929 
930 static const struct nmk_function nmk_db8540_functions[] = {
931 	FUNCTION(apetrig),
932 	FUNCTION(clkout),
933 	FUNCTION(ddrtrig),
934 	FUNCTION(hsi),
935 	FUNCTION(hwobs),
936 	FUNCTION(hx),
937 	FUNCTION(i2c0),
938 	FUNCTION(i2c1),
939 	FUNCTION(i2c2),
940 	FUNCTION(i2c3),
941 	FUNCTION(i2c4),
942 	FUNCTION(i2c5),
943 	FUNCTION(i2c6),
944 	FUNCTION(ipgpio),
945 	FUNCTION(ipi2c),
946 	FUNCTION(kp),
947 	FUNCTION(lcd),
948 	FUNCTION(lcdb),
949 	FUNCTION(mc0),
950 	FUNCTION(mc1),
951 	FUNCTION(mc2),
952 	FUNCTION(mc3),
953 	FUNCTION(mc4),
954 	FUNCTION(mc5),
955 	FUNCTION(modaccgpo),
956 	FUNCTION(modaccuart),
957 	FUNCTION(modi2s),
958 	FUNCTION(modobs),
959 	FUNCTION(modprcmudbg),
960 	FUNCTION(modrf),
961 	FUNCTION(modsmb),
962 	FUNCTION(modtrig),
963 	FUNCTION(moduart),
964 	FUNCTION(modxmip),
965 	FUNCTION(msp0),
966 	FUNCTION(msp1),
967 	FUNCTION(msp2),
968 	FUNCTION(msp4),
969 	FUNCTION(pwl),
970 	FUNCTION(remap),
971 	FUNCTION(sbag),
972 	FUNCTION(sm),
973 	FUNCTION(spi0),
974 	FUNCTION(spi1),
975 	FUNCTION(spi2),
976 	FUNCTION(spi3),
977 	FUNCTION(ssp0),
978 	FUNCTION(ssp1),
979 	FUNCTION(stmape),
980 	FUNCTION(stmmod),
981 	FUNCTION(tpui),
982 	FUNCTION(u0),
983 	FUNCTION(u1),
984 	FUNCTION(u2),
985 	FUNCTION(u3),
986 	FUNCTION(u4),
987 	FUNCTION(usb)
988 };
989 
990 static const struct prcm_gpiocr_altcx_pin_desc db8540_altcx_pins[] = {
991 	PRCM_GPIOCR_ALTCX(8,	true, PRCM_IDX_GPIOCR1, 20,	/* SPI3_CLK */
992 				false, 0, 0,
993 				false, 0, 0,
994 				false, 0, 0
995 	),
996 	PRCM_GPIOCR_ALTCX(9,	true, PRCM_IDX_GPIOCR1, 20,	/* SPI3_RXD */
997 				false, 0, 0,
998 				false, 0, 0,
999 				false, 0, 0
1000 	),
1001 	PRCM_GPIOCR_ALTCX(10,	true, PRCM_IDX_GPIOCR1, 20,	/* SPI3_FRM */
1002 				false, 0, 0,
1003 				false, 0, 0,
1004 				false, 0, 0
1005 	),
1006 	PRCM_GPIOCR_ALTCX(11,	true, PRCM_IDX_GPIOCR1, 20,	/* SPI3_TXD */
1007 				false, 0, 0,
1008 				false, 0, 0,
1009 				false, 0, 0
1010 	),
1011 	PRCM_GPIOCR_ALTCX(23,	true, PRCM_IDX_GPIOCR1, 9,	/* STMAPE_CLK_a */
1012 				true, PRCM_IDX_GPIOCR2, 10,	/* SBAG_CLK_a */
1013 				false, 0, 0,
1014 				false, 0, 0
1015 	),
1016 	PRCM_GPIOCR_ALTCX(24,	true, PRCM_IDX_GPIOCR3, 30,	/* U2_RXD_g */
1017 				true, PRCM_IDX_GPIOCR2, 10,	/* SBAG_VAL_a */
1018 				false, 0, 0,
1019 				false, 0, 0
1020 	),
1021 	PRCM_GPIOCR_ALTCX(25,	true, PRCM_IDX_GPIOCR1, 9,	/* STMAPE_DAT_a[0] */
1022 				true, PRCM_IDX_GPIOCR2, 10,	/* SBAG_D_a[0] */
1023 				false, 0, 0,
1024 				false, 0, 0
1025 	),
1026 	PRCM_GPIOCR_ALTCX(26,	true, PRCM_IDX_GPIOCR1, 9,	/* STMAPE_DAT_a[1] */
1027 				true, PRCM_IDX_GPIOCR2, 10,	/* SBAG_D_a[1] */
1028 				false, 0, 0,
1029 				false, 0, 0
1030 	),
1031 	PRCM_GPIOCR_ALTCX(27,	true, PRCM_IDX_GPIOCR1, 9,	/* STMAPE_DAT_a[2] */
1032 				true, PRCM_IDX_GPIOCR2, 10,	/* SBAG_D_a[2] */
1033 				false, 0, 0,
1034 				false, 0, 0
1035 	),
1036 	PRCM_GPIOCR_ALTCX(28,	true, PRCM_IDX_GPIOCR1, 9,	/* STMAPE_DAT_a[3] */
1037 				true, PRCM_IDX_GPIOCR2, 10,	/* SBAG_D_a[3] */
1038 				false, 0, 0,
1039 				false, 0, 0
1040 	),
1041 	PRCM_GPIOCR_ALTCX(64,	true, PRCM_IDX_GPIOCR1, 15,	/* MODOBS_REFCLK_REQ */
1042 				false, 0, 0,
1043 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_CTL */
1044 				true, PRCM_IDX_GPIOCR2, 23	/* HW_OBS_APE_PRCMU[17] */
1045 	),
1046 	PRCM_GPIOCR_ALTCX(65,	true, PRCM_IDX_GPIOCR1, 19,	/* MODOBS_PWRCTRL0 */
1047 				true, PRCM_IDX_GPIOCR1, 24,	/* Hx_CLK */
1048 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_CLK */
1049 				true, PRCM_IDX_GPIOCR2, 24	/* HW_OBS_APE_PRCMU[16] */
1050 	),
1051 	PRCM_GPIOCR_ALTCX(66,	true, PRCM_IDX_GPIOCR1, 15,	/* MODOBS_CLKOUT1 */
1052 				false, 0, 0,
1053 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[15] */
1054 				true, PRCM_IDX_GPIOCR2, 25	/* HW_OBS_APE_PRCMU[15] */
1055 	),
1056 	PRCM_GPIOCR_ALTCX(67,	true, PRCM_IDX_GPIOCR1, 1,	/* MODUART1_TXD_a */
1057 				true, PRCM_IDX_GPIOCR1, 6,	/* MODACCUART_TXD_a */
1058 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[14] */
1059 				true, PRCM_IDX_GPIOCR2, 26	/* HW_OBS_APE_PRCMU[14] */
1060 	),
1061 	PRCM_GPIOCR_ALTCX(70,	true, PRCM_IDX_GPIOCR3, 6,	/* MOD_PRCMU_DEBUG[17] */
1062 				true, PRCM_IDX_GPIOCR1, 10,	/* STMMOD_CLK_b */
1063 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[13] */
1064 				true, PRCM_IDX_GPIOCR2, 27	/* HW_OBS_APE_PRCMU[13] */
1065 	),
1066 	PRCM_GPIOCR_ALTCX(71,	true, PRCM_IDX_GPIOCR3, 6,	/* MOD_PRCMU_DEBUG[16] */
1067 				true, PRCM_IDX_GPIOCR1, 10,	/* STMMOD_DAT_b[3] */
1068 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[12] */
1069 				true, PRCM_IDX_GPIOCR2, 27	/* HW_OBS_APE_PRCMU[12] */
1070 	),
1071 	PRCM_GPIOCR_ALTCX(72,	true, PRCM_IDX_GPIOCR3, 6,	/* MOD_PRCMU_DEBUG[15] */
1072 				true, PRCM_IDX_GPIOCR1, 10,	/* STMMOD_DAT_b[2] */
1073 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[11] */
1074 				true, PRCM_IDX_GPIOCR2, 27	/* HW_OBS_APE_PRCMU[11] */
1075 	),
1076 	PRCM_GPIOCR_ALTCX(73,	true, PRCM_IDX_GPIOCR3, 6,	/* MOD_PRCMU_DEBUG[14] */
1077 				true, PRCM_IDX_GPIOCR1, 10,	/* STMMOD_DAT_b[1] */
1078 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[10] */
1079 				true, PRCM_IDX_GPIOCR2, 27	/* HW_OBS_APE_PRCMU[10] */
1080 	),
1081 	PRCM_GPIOCR_ALTCX(74,	true, PRCM_IDX_GPIOCR3, 6,	/* MOD_PRCMU_DEBUG[13] */
1082 				true, PRCM_IDX_GPIOCR1, 10,	/* STMMOD_DAT_b[0] */
1083 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[9] */
1084 				true, PRCM_IDX_GPIOCR2, 27	/* HW_OBS_APE_PRCMU[9] */
1085 	),
1086 	PRCM_GPIOCR_ALTCX(75,	true, PRCM_IDX_GPIOCR1, 12,	/* MODOBS_RESOUT0_N */
1087 				true, PRCM_IDX_GPIOCR2, 1,	/* MODUART_STMMUX_RXD_b */
1088 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[8] */
1089 				true, PRCM_IDX_GPIOCR2, 28	/* HW_OBS_APE_PRCMU[8] */
1090 	),
1091 	PRCM_GPIOCR_ALTCX(76,	true, PRCM_IDX_GPIOCR3, 7,	/* MOD_PRCMU_DEBUG[12] */
1092 				true, PRCM_IDX_GPIOCR1, 25,	/* Hx_GPIO[7] */
1093 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[7] */
1094 				true, PRCM_IDX_GPIOCR2, 29	/* HW_OBS_APE_PRCMU[7] */
1095 	),
1096 	PRCM_GPIOCR_ALTCX(77,	true, PRCM_IDX_GPIOCR3, 7,	/* MOD_PRCMU_DEBUG[11] */
1097 				true, PRCM_IDX_GPIOCR1, 25,	/* Hx_GPIO[6] */
1098 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[6] */
1099 				true, PRCM_IDX_GPIOCR2, 29	/* HW_OBS_APE_PRCMU[6] */
1100 	),
1101 	PRCM_GPIOCR_ALTCX(78,	true, PRCM_IDX_GPIOCR3, 7,	/* MOD_PRCMU_DEBUG[10] */
1102 				true, PRCM_IDX_GPIOCR1, 25,	/* Hx_GPIO[5] */
1103 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[5] */
1104 				true, PRCM_IDX_GPIOCR2, 29	/* HW_OBS_APE_PRCMU[5] */
1105 	),
1106 	PRCM_GPIOCR_ALTCX(79,	true, PRCM_IDX_GPIOCR3, 7,	/* MOD_PRCMU_DEBUG[9] */
1107 				true, PRCM_IDX_GPIOCR1, 25,	/* Hx_GPIO[4] */
1108 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[4] */
1109 				true, PRCM_IDX_GPIOCR2, 29	/* HW_OBS_APE_PRCMU[4] */
1110 	),
1111 	PRCM_GPIOCR_ALTCX(80,	true, PRCM_IDX_GPIOCR1, 26,	/* MODACC_GPO[0] */
1112 				true, PRCM_IDX_GPIOCR1, 25,	/* Hx_GPIO[3] */
1113 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[3] */
1114 				true, PRCM_IDX_GPIOCR2, 30	/* HW_OBS_APE_PRCMU[3] */
1115 	),
1116 	PRCM_GPIOCR_ALTCX(81,	true, PRCM_IDX_GPIOCR2, 17,	/* MODACC_GPO[1] */
1117 				true, PRCM_IDX_GPIOCR1, 25,	/* Hx_GPIO[2] */
1118 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[2] */
1119 				true, PRCM_IDX_GPIOCR2, 30	/* HW_OBS_APE_PRCMU[2] */
1120 	),
1121 	PRCM_GPIOCR_ALTCX(82,	true, PRCM_IDX_GPIOCR3, 8,	/* MOD_PRCMU_DEBUG[8] */
1122 				true, PRCM_IDX_GPIOCR1, 25,	/* Hx_GPIO[1] */
1123 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[1] */
1124 				true, PRCM_IDX_GPIOCR2, 31	/* HW_OBS_APE_PRCMU[1] */
1125 	),
1126 	PRCM_GPIOCR_ALTCX(83,	true, PRCM_IDX_GPIOCR3, 8,	/* MOD_PRCMU_DEBUG[7] */
1127 				true, PRCM_IDX_GPIOCR1, 25,	/* Hx_GPIO[0] */
1128 				true, PRCM_IDX_GPIOCR1, 2,	/* TPIU_D[0] */
1129 				true, PRCM_IDX_GPIOCR2, 31	/* HW_OBS_APE_PRCMU[0] */
1130 	),
1131 	PRCM_GPIOCR_ALTCX(84,	true, PRCM_IDX_GPIOCR3, 9,	/* MOD_PRCMU_DEBUG[6] */
1132 				true, PRCM_IDX_GPIOCR1, 8,	/* SBAG_CLK_b */
1133 				true, PRCM_IDX_GPIOCR1, 3,	/* TPIU_D[23] */
1134 				true, PRCM_IDX_GPIOCR1, 16	/* MODUART1_RXD_b */
1135 	),
1136 	PRCM_GPIOCR_ALTCX(85,	true, PRCM_IDX_GPIOCR3, 9,	/* MOD_PRCMU_DEBUG[5] */
1137 				true, PRCM_IDX_GPIOCR1, 8,	/* SBAG_D_b[3] */
1138 				true, PRCM_IDX_GPIOCR1, 3,	/* TPIU_D[22] */
1139 				true, PRCM_IDX_GPIOCR1, 16	/* MODUART1_TXD_b */
1140 	),
1141 	PRCM_GPIOCR_ALTCX(86,	true, PRCM_IDX_GPIOCR3, 9,	/* MOD_PRCMU_DEBUG[0] */
1142 				true, PRCM_IDX_GPIOCR2, 18,	/* STMAPE_DAT_b[0] */
1143 				true, PRCM_IDX_GPIOCR1, 14,	/* TPIU_D[25] */
1144 				true, PRCM_IDX_GPIOCR1, 11	/* STMMOD_DAT_c[0] */
1145 	),
1146 	PRCM_GPIOCR_ALTCX(87,	true, PRCM_IDX_GPIOCR3, 0,	/* MODACC_GPO_a[5] */
1147 				true, PRCM_IDX_GPIOCR2, 3,	/* U2_RXD_c */
1148 				true, PRCM_IDX_GPIOCR1, 4,	/* TPIU_D[24] */
1149 				true, PRCM_IDX_GPIOCR1, 21	/* MODUART_STMMUX_RXD_c */
1150 	),
1151 	PRCM_GPIOCR_ALTCX(151,	true, PRCM_IDX_GPIOCR1, 18,	/* REMAP0 */
1152 				false, 0, 0,
1153 				false, 0, 0,
1154 				false, 0, 0
1155 	),
1156 	PRCM_GPIOCR_ALTCX(152,	true, PRCM_IDX_GPIOCR1, 18,	/* REMAP1 */
1157 				false, 0, 0,
1158 				false, 0, 0,
1159 				false, 0, 0
1160 	),
1161 	PRCM_GPIOCR_ALTCX(153,	true, PRCM_IDX_GPIOCR3, 2,	/* KP_O_b[6] */
1162 				true, PRCM_IDX_GPIOCR1, 8,	/* SBAG_D_b[2] */
1163 				true, PRCM_IDX_GPIOCR1, 3,	/* TPIU_D[21] */
1164 				true, PRCM_IDX_GPIOCR1, 0	/* MODUART1_RTS */
1165 	),
1166 	PRCM_GPIOCR_ALTCX(154,	true, PRCM_IDX_GPIOCR3, 2,	/* KP_I_b[6] */
1167 				true, PRCM_IDX_GPIOCR1, 8,	/* SBAG_D_b[1] */
1168 				true, PRCM_IDX_GPIOCR1, 3,	/* TPIU_D[20] */
1169 				true, PRCM_IDX_GPIOCR1, 0	/* MODUART1_CTS */
1170 	),
1171 	PRCM_GPIOCR_ALTCX(155,	true, PRCM_IDX_GPIOCR3, 3,	/* KP_O_b[5] */
1172 				true, PRCM_IDX_GPIOCR1, 8,	/* SBAG_D_b[0] */
1173 				true, PRCM_IDX_GPIOCR1, 3,	/* TPIU_D[19] */
1174 				true, PRCM_IDX_GPIOCR1, 5	/* MODACCUART_RXD_c */
1175 	),
1176 	PRCM_GPIOCR_ALTCX(156,	true, PRCM_IDX_GPIOCR3, 3,	/* KP_O_b[4] */
1177 				true, PRCM_IDX_GPIOCR1, 8,	/* SBAG_VAL_b */
1178 				true, PRCM_IDX_GPIOCR1, 3,	/* TPIU_D[18] */
1179 				true, PRCM_IDX_GPIOCR1, 5	/* MODACCUART_TXD_b */
1180 	),
1181 	PRCM_GPIOCR_ALTCX(157,	true, PRCM_IDX_GPIOCR3, 4,	/* KP_I_b[5] */
1182 				true, PRCM_IDX_GPIOCR1, 23,	/* MODOBS_SERVICE_N */
1183 				true, PRCM_IDX_GPIOCR1, 3,	/* TPIU_D[17] */
1184 				true, PRCM_IDX_GPIOCR1, 14	/* MODACCUART_RTS */
1185 	),
1186 	PRCM_GPIOCR_ALTCX(158,	true, PRCM_IDX_GPIOCR3, 4,	/* KP_I_b[4] */
1187 				true, PRCM_IDX_GPIOCR2, 0,	/* U2_TXD_c */
1188 				true, PRCM_IDX_GPIOCR1, 3,	/* TPIU_D[16] */
1189 				true, PRCM_IDX_GPIOCR1, 14	/* MODACCUART_CTS */
1190 	),
1191 	PRCM_GPIOCR_ALTCX(159,	true, PRCM_IDX_GPIOCR3, 5,	/* KP_O_b[3] */
1192 				true, PRCM_IDX_GPIOCR3, 10,	/* MODUART0_RXD */
1193 				true, PRCM_IDX_GPIOCR1, 4,	/* TPIU_D[31] */
1194 				false, 0, 0
1195 	),
1196 	PRCM_GPIOCR_ALTCX(160,	true, PRCM_IDX_GPIOCR3, 5,	/* KP_I_b[3] */
1197 				true, PRCM_IDX_GPIOCR3, 10,	/* MODUART0_TXD */
1198 				true, PRCM_IDX_GPIOCR1, 4,	/* TPIU_D[30] */
1199 				false, 0, 0
1200 	),
1201 	PRCM_GPIOCR_ALTCX(161,	true, PRCM_IDX_GPIOCR3, 9,	/* MOD_PRCMU_DEBUG[4] */
1202 				true, PRCM_IDX_GPIOCR2, 18,	/* STMAPE_CLK_b */
1203 				true, PRCM_IDX_GPIOCR1, 4,	/* TPIU_D[29] */
1204 				true, PRCM_IDX_GPIOCR1, 11	/* STMMOD_CLK_c */
1205 	),
1206 	PRCM_GPIOCR_ALTCX(162,	true, PRCM_IDX_GPIOCR3, 9,	/* MOD_PRCMU_DEBUG[3] */
1207 				true, PRCM_IDX_GPIOCR2, 18,	/* STMAPE_DAT_b[3] */
1208 				true, PRCM_IDX_GPIOCR1, 4,	/* TPIU_D[28] */
1209 				true, PRCM_IDX_GPIOCR1, 11	/* STMMOD_DAT_c[3] */
1210 	),
1211 	PRCM_GPIOCR_ALTCX(163,	true, PRCM_IDX_GPIOCR3, 9,	/* MOD_PRCMU_DEBUG[2] */
1212 				true, PRCM_IDX_GPIOCR2, 18,	/* STMAPE_DAT_b[2] */
1213 				true, PRCM_IDX_GPIOCR1, 4,	/* TPIU_D[27] */
1214 				true, PRCM_IDX_GPIOCR1, 11	/* STMMOD_DAT_c[2] */
1215 	),
1216 	PRCM_GPIOCR_ALTCX(164,	true, PRCM_IDX_GPIOCR3, 9,	/* MOD_PRCMU_DEBUG[1] */
1217 				true, PRCM_IDX_GPIOCR2, 18,	/* STMAPE_DAT_b[1] */
1218 				true, PRCM_IDX_GPIOCR1, 4,	/* TPIU_D[26] */
1219 				true, PRCM_IDX_GPIOCR1, 11	/* STMMOD_DAT_c[1] */
1220 	),
1221 	PRCM_GPIOCR_ALTCX(204,	true, PRCM_IDX_GPIOCR2, 2,	/* U2_RXD_f */
1222 				false, 0, 0,
1223 				false, 0, 0,
1224 				false, 0, 0
1225 	),
1226 	PRCM_GPIOCR_ALTCX(205,	true, PRCM_IDX_GPIOCR2, 2,	/* U2_TXD_f */
1227 				false, 0, 0,
1228 				false, 0, 0,
1229 				false, 0, 0
1230 	),
1231 	PRCM_GPIOCR_ALTCX(206,	true, PRCM_IDX_GPIOCR2, 2,	/* U2_CTSn_b */
1232 				false, 0, 0,
1233 				false, 0, 0,
1234 				false, 0, 0
1235 	),
1236 	PRCM_GPIOCR_ALTCX(207,	true, PRCM_IDX_GPIOCR2, 2,	/* U2_RTSn_b */
1237 				false, 0, 0,
1238 				false, 0, 0,
1239 				false, 0, 0
1240 	),
1241 };
1242 
1243 static const u16 db8540_prcm_gpiocr_regs[] = {
1244 	[PRCM_IDX_GPIOCR1] = 0x138,
1245 	[PRCM_IDX_GPIOCR2] = 0x574,
1246 	[PRCM_IDX_GPIOCR3] = 0x2bc,
1247 };
1248 
1249 static const struct nmk_pinctrl_soc_data nmk_db8540_soc = {
1250 	.gpio_ranges = nmk_db8540_ranges,
1251 	.gpio_num_ranges = ARRAY_SIZE(nmk_db8540_ranges),
1252 	.pins = nmk_db8540_pins,
1253 	.npins = ARRAY_SIZE(nmk_db8540_pins),
1254 	.functions = nmk_db8540_functions,
1255 	.nfunctions = ARRAY_SIZE(nmk_db8540_functions),
1256 	.groups = nmk_db8540_groups,
1257 	.ngroups = ARRAY_SIZE(nmk_db8540_groups),
1258 	.altcx_pins = db8540_altcx_pins,
1259 	.npins_altcx = ARRAY_SIZE(db8540_altcx_pins),
1260 	.prcm_gpiocr_registers = db8540_prcm_gpiocr_regs,
1261 };
1262 
nmk_pinctrl_db8540_init(const struct nmk_pinctrl_soc_data ** soc)1263 void nmk_pinctrl_db8540_init(const struct nmk_pinctrl_soc_data **soc)
1264 {
1265 	*soc = &nmk_db8540_soc;
1266 }
1267