xref: /linux/drivers/pinctrl/spear/pinctrl-spear1310.c (revision d2c9a99135da931377240942d44f3dea104cedb8)
1 /*
2  * Driver for the ST Microelectronics SPEAr1310 pinmux
3  *
4  * Copyright (C) 2012 ST Microelectronics
5  * Viresh Kumar <vireshk@kernel.org>
6  *
7  * This file is licensed under the terms of the GNU General Public
8  * License version 2. This program is licensed "as is" without any
9  * warranty of any kind, whether express or implied.
10  */
11 
12 #include <linux/err.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include "pinctrl-spear.h"
16 
17 #define DRIVER_NAME "spear1310-pinmux"
18 
19 /* pins */
20 static const struct pinctrl_pin_desc spear1310_pins[] = {
21 	SPEAR_PIN_0_TO_101,
22 	SPEAR_PIN_102_TO_245,
23 };
24 
25 /* registers */
26 #define PERIP_CFG					0x3B0
27 	#define MCIF_SEL_SHIFT				5
28 	#define MCIF_SEL_SD				(0x1 << MCIF_SEL_SHIFT)
29 	#define MCIF_SEL_CF				(0x2 << MCIF_SEL_SHIFT)
30 	#define MCIF_SEL_XD				(0x3 << MCIF_SEL_SHIFT)
31 	#define MCIF_SEL_MASK				(0x3 << MCIF_SEL_SHIFT)
32 
33 #define PCIE_SATA_CFG					0x3A4
34 	#define PCIE_SATA2_SEL_PCIE			(0 << 31)
35 	#define PCIE_SATA1_SEL_PCIE			(0 << 30)
36 	#define PCIE_SATA0_SEL_PCIE			(0 << 29)
37 	#define PCIE_SATA2_SEL_SATA			(1 << 31)
38 	#define PCIE_SATA1_SEL_SATA			(1 << 30)
39 	#define PCIE_SATA0_SEL_SATA			(1 << 29)
40 	#define SATA2_CFG_TX_CLK_EN			(1 << 27)
41 	#define SATA2_CFG_RX_CLK_EN			(1 << 26)
42 	#define SATA2_CFG_POWERUP_RESET			(1 << 25)
43 	#define SATA2_CFG_PM_CLK_EN			(1 << 24)
44 	#define SATA1_CFG_TX_CLK_EN			(1 << 23)
45 	#define SATA1_CFG_RX_CLK_EN			(1 << 22)
46 	#define SATA1_CFG_POWERUP_RESET			(1 << 21)
47 	#define SATA1_CFG_PM_CLK_EN			(1 << 20)
48 	#define SATA0_CFG_TX_CLK_EN			(1 << 19)
49 	#define SATA0_CFG_RX_CLK_EN			(1 << 18)
50 	#define SATA0_CFG_POWERUP_RESET			(1 << 17)
51 	#define SATA0_CFG_PM_CLK_EN			(1 << 16)
52 	#define PCIE2_CFG_DEVICE_PRESENT		(1 << 11)
53 	#define PCIE2_CFG_POWERUP_RESET			(1 << 10)
54 	#define PCIE2_CFG_CORE_CLK_EN			(1 << 9)
55 	#define PCIE2_CFG_AUX_CLK_EN			(1 << 8)
56 	#define PCIE1_CFG_DEVICE_PRESENT		(1 << 7)
57 	#define PCIE1_CFG_POWERUP_RESET			(1 << 6)
58 	#define PCIE1_CFG_CORE_CLK_EN			(1 << 5)
59 	#define PCIE1_CFG_AUX_CLK_EN			(1 << 4)
60 	#define PCIE0_CFG_DEVICE_PRESENT		(1 << 3)
61 	#define PCIE0_CFG_POWERUP_RESET			(1 << 2)
62 	#define PCIE0_CFG_CORE_CLK_EN			(1 << 1)
63 	#define PCIE0_CFG_AUX_CLK_EN			(1 << 0)
64 
65 #define PAD_FUNCTION_EN_0				0x650
66 	#define PMX_UART0_MASK				(1 << 1)
67 	#define PMX_I2C0_MASK				(1 << 2)
68 	#define PMX_I2S0_MASK				(1 << 3)
69 	#define PMX_SSP0_MASK				(1 << 4)
70 	#define PMX_CLCD1_MASK				(1 << 5)
71 	#define PMX_EGPIO00_MASK			(1 << 6)
72 	#define PMX_EGPIO01_MASK			(1 << 7)
73 	#define PMX_EGPIO02_MASK			(1 << 8)
74 	#define PMX_EGPIO03_MASK			(1 << 9)
75 	#define PMX_EGPIO04_MASK			(1 << 10)
76 	#define PMX_EGPIO05_MASK			(1 << 11)
77 	#define PMX_EGPIO06_MASK			(1 << 12)
78 	#define PMX_EGPIO07_MASK			(1 << 13)
79 	#define PMX_EGPIO08_MASK			(1 << 14)
80 	#define PMX_EGPIO09_MASK			(1 << 15)
81 	#define PMX_SMI_MASK				(1 << 16)
82 	#define PMX_NAND8_MASK				(1 << 17)
83 	#define PMX_GMIICLK_MASK			(1 << 18)
84 	#define PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK	(1 << 19)
85 	#define PMX_RXCLK_RDV_TXEN_D03_MASK		(1 << 20)
86 	#define PMX_GMIID47_MASK			(1 << 21)
87 	#define PMX_MDC_MDIO_MASK			(1 << 22)
88 	#define PMX_MCI_DATA8_15_MASK			(1 << 23)
89 	#define PMX_NFAD23_MASK				(1 << 24)
90 	#define PMX_NFAD24_MASK				(1 << 25)
91 	#define PMX_NFAD25_MASK				(1 << 26)
92 	#define PMX_NFCE3_MASK				(1 << 27)
93 	#define PMX_NFWPRT3_MASK			(1 << 28)
94 	#define PMX_NFRSTPWDWN0_MASK			(1 << 29)
95 	#define PMX_NFRSTPWDWN1_MASK			(1 << 30)
96 	#define PMX_NFRSTPWDWN2_MASK			(1 << 31)
97 
98 #define PAD_FUNCTION_EN_1				0x654
99 	#define PMX_NFRSTPWDWN3_MASK			(1 << 0)
100 	#define PMX_SMINCS2_MASK			(1 << 1)
101 	#define PMX_SMINCS3_MASK			(1 << 2)
102 	#define PMX_CLCD2_MASK				(1 << 3)
103 	#define PMX_KBD_ROWCOL68_MASK			(1 << 4)
104 	#define PMX_EGPIO10_MASK			(1 << 5)
105 	#define PMX_EGPIO11_MASK			(1 << 6)
106 	#define PMX_EGPIO12_MASK			(1 << 7)
107 	#define PMX_EGPIO13_MASK			(1 << 8)
108 	#define PMX_EGPIO14_MASK			(1 << 9)
109 	#define PMX_EGPIO15_MASK			(1 << 10)
110 	#define PMX_UART0_MODEM_MASK			(1 << 11)
111 	#define PMX_GPT0_TMR0_MASK			(1 << 12)
112 	#define PMX_GPT0_TMR1_MASK			(1 << 13)
113 	#define PMX_GPT1_TMR0_MASK			(1 << 14)
114 	#define PMX_GPT1_TMR1_MASK			(1 << 15)
115 	#define PMX_I2S1_MASK				(1 << 16)
116 	#define PMX_KBD_ROWCOL25_MASK			(1 << 17)
117 	#define PMX_NFIO8_15_MASK			(1 << 18)
118 	#define PMX_KBD_COL1_MASK			(1 << 19)
119 	#define PMX_NFCE1_MASK				(1 << 20)
120 	#define PMX_KBD_COL0_MASK			(1 << 21)
121 	#define PMX_NFCE2_MASK				(1 << 22)
122 	#define PMX_KBD_ROW1_MASK			(1 << 23)
123 	#define PMX_NFWPRT1_MASK			(1 << 24)
124 	#define PMX_KBD_ROW0_MASK			(1 << 25)
125 	#define PMX_NFWPRT2_MASK			(1 << 26)
126 	#define PMX_MCIDATA0_MASK			(1 << 27)
127 	#define PMX_MCIDATA1_MASK			(1 << 28)
128 	#define PMX_MCIDATA2_MASK			(1 << 29)
129 	#define PMX_MCIDATA3_MASK			(1 << 30)
130 	#define PMX_MCIDATA4_MASK			(1 << 31)
131 
132 #define PAD_FUNCTION_EN_2				0x658
133 	#define PMX_MCIDATA5_MASK			(1 << 0)
134 	#define PMX_MCIDATA6_MASK			(1 << 1)
135 	#define PMX_MCIDATA7_MASK			(1 << 2)
136 	#define PMX_MCIDATA1SD_MASK			(1 << 3)
137 	#define PMX_MCIDATA2SD_MASK			(1 << 4)
138 	#define PMX_MCIDATA3SD_MASK			(1 << 5)
139 	#define PMX_MCIADDR0ALE_MASK			(1 << 6)
140 	#define PMX_MCIADDR1CLECLK_MASK			(1 << 7)
141 	#define PMX_MCIADDR2_MASK			(1 << 8)
142 	#define PMX_MCICECF_MASK			(1 << 9)
143 	#define PMX_MCICEXD_MASK			(1 << 10)
144 	#define PMX_MCICESDMMC_MASK			(1 << 11)
145 	#define PMX_MCICDCF1_MASK			(1 << 12)
146 	#define PMX_MCICDCF2_MASK			(1 << 13)
147 	#define PMX_MCICDXD_MASK			(1 << 14)
148 	#define PMX_MCICDSDMMC_MASK			(1 << 15)
149 	#define PMX_MCIDATADIR_MASK			(1 << 16)
150 	#define PMX_MCIDMARQWP_MASK			(1 << 17)
151 	#define PMX_MCIIORDRE_MASK			(1 << 18)
152 	#define PMX_MCIIOWRWE_MASK			(1 << 19)
153 	#define PMX_MCIRESETCF_MASK			(1 << 20)
154 	#define PMX_MCICS0CE_MASK			(1 << 21)
155 	#define PMX_MCICFINTR_MASK			(1 << 22)
156 	#define PMX_MCIIORDY_MASK			(1 << 23)
157 	#define PMX_MCICS1_MASK				(1 << 24)
158 	#define PMX_MCIDMAACK_MASK			(1 << 25)
159 	#define PMX_MCISDCMD_MASK			(1 << 26)
160 	#define PMX_MCILEDS_MASK			(1 << 27)
161 	#define PMX_TOUCH_XY_MASK			(1 << 28)
162 	#define PMX_SSP0_CS0_MASK			(1 << 29)
163 	#define PMX_SSP0_CS1_2_MASK			(1 << 30)
164 
165 #define PAD_DIRECTION_SEL_0				0x65C
166 #define PAD_DIRECTION_SEL_1				0x660
167 #define PAD_DIRECTION_SEL_2				0x664
168 
169 /* combined macros */
170 #define PMX_GMII_MASK		(PMX_GMIICLK_MASK |			\
171 				PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK |	\
172 				PMX_RXCLK_RDV_TXEN_D03_MASK |		\
173 				PMX_GMIID47_MASK | PMX_MDC_MDIO_MASK)
174 
175 #define PMX_EGPIO_0_GRP_MASK	(PMX_EGPIO00_MASK | PMX_EGPIO01_MASK |	\
176 				PMX_EGPIO02_MASK |			\
177 				PMX_EGPIO03_MASK | PMX_EGPIO04_MASK |	\
178 				PMX_EGPIO05_MASK | PMX_EGPIO06_MASK |	\
179 				PMX_EGPIO07_MASK | PMX_EGPIO08_MASK |	\
180 				PMX_EGPIO09_MASK)
181 #define PMX_EGPIO_1_GRP_MASK	(PMX_EGPIO10_MASK | PMX_EGPIO11_MASK |	\
182 				PMX_EGPIO12_MASK | PMX_EGPIO13_MASK |	\
183 				PMX_EGPIO14_MASK | PMX_EGPIO15_MASK)
184 
185 #define PMX_KEYBOARD_6X6_MASK	(PMX_KBD_ROW0_MASK | PMX_KBD_ROW1_MASK | \
186 				PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL0_MASK | \
187 				PMX_KBD_COL1_MASK)
188 
189 #define PMX_NAND8BIT_0_MASK	(PMX_NAND8_MASK | PMX_NFAD23_MASK |	\
190 				PMX_NFAD24_MASK | PMX_NFAD25_MASK |	\
191 				PMX_NFWPRT3_MASK | PMX_NFRSTPWDWN0_MASK | \
192 				PMX_NFRSTPWDWN1_MASK | PMX_NFRSTPWDWN2_MASK | \
193 				PMX_NFCE3_MASK)
194 #define PMX_NAND8BIT_1_MASK	PMX_NFRSTPWDWN3_MASK
195 
196 #define PMX_NAND16BIT_1_MASK	(PMX_KBD_ROWCOL25_MASK | PMX_NFIO8_15_MASK)
197 #define PMX_NAND_4CHIPS_MASK	(PMX_NFCE1_MASK | PMX_NFCE2_MASK |	\
198 				PMX_NFWPRT1_MASK | PMX_NFWPRT2_MASK |	\
199 				PMX_KBD_ROW0_MASK | PMX_KBD_ROW1_MASK |	\
200 				PMX_KBD_COL0_MASK | PMX_KBD_COL1_MASK)
201 
202 #define PMX_MCIFALL_1_MASK	0xF8000000
203 #define PMX_MCIFALL_2_MASK	0x0FFFFFFF
204 
205 #define PMX_PCI_REG1_MASK	(PMX_SMINCS2_MASK | PMX_SMINCS3_MASK |	\
206 				PMX_CLCD2_MASK | PMX_KBD_ROWCOL68_MASK | \
207 				PMX_EGPIO_1_GRP_MASK | PMX_GPT0_TMR0_MASK | \
208 				PMX_GPT0_TMR1_MASK | PMX_GPT1_TMR0_MASK | \
209 				PMX_GPT1_TMR1_MASK | PMX_I2S1_MASK |	\
210 				PMX_NFCE2_MASK)
211 #define PMX_PCI_REG2_MASK	(PMX_TOUCH_XY_MASK | PMX_SSP0_CS0_MASK | \
212 				PMX_SSP0_CS1_2_MASK)
213 
214 #define PMX_SMII_0_1_2_MASK	(PMX_CLCD2_MASK | PMX_KBD_ROWCOL68_MASK)
215 #define PMX_RGMII_REG0_MASK	(PMX_MCI_DATA8_15_MASK |		\
216 				PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK |	\
217 				PMX_GMIID47_MASK)
218 #define PMX_RGMII_REG1_MASK	(PMX_KBD_ROWCOL68_MASK | PMX_EGPIO_1_GRP_MASK |\
219 				PMX_KBD_ROW1_MASK | PMX_NFWPRT1_MASK |	\
220 				PMX_KBD_ROW0_MASK | PMX_NFWPRT2_MASK)
221 #define PMX_RGMII_REG2_MASK	(PMX_TOUCH_XY_MASK | PMX_SSP0_CS0_MASK | \
222 				PMX_SSP0_CS1_2_MASK)
223 
224 #define PCIE_CFG_VAL(x)		(PCIE_SATA##x##_SEL_PCIE |	\
225 				PCIE##x##_CFG_AUX_CLK_EN |	\
226 				PCIE##x##_CFG_CORE_CLK_EN |	\
227 				PCIE##x##_CFG_POWERUP_RESET |	\
228 				PCIE##x##_CFG_DEVICE_PRESENT)
229 #define SATA_CFG_VAL(x)		(PCIE_SATA##x##_SEL_SATA |	\
230 				SATA##x##_CFG_PM_CLK_EN |	\
231 				SATA##x##_CFG_POWERUP_RESET |	\
232 				SATA##x##_CFG_RX_CLK_EN |	\
233 				SATA##x##_CFG_TX_CLK_EN)
234 
235 /* Pad multiplexing for i2c0 device */
236 static const unsigned i2c0_pins[] = { 102, 103 };
237 static struct spear_muxreg i2c0_muxreg[] = {
238 	{
239 		.reg = PAD_FUNCTION_EN_0,
240 		.mask = PMX_I2C0_MASK,
241 		.val = PMX_I2C0_MASK,
242 	}, {
243 		.reg = PAD_DIRECTION_SEL_0,
244 		.mask = PMX_I2C0_MASK,
245 		.val = PMX_I2C0_MASK,
246 	},
247 };
248 
249 static struct spear_modemux i2c0_modemux[] = {
250 	{
251 		.muxregs = i2c0_muxreg,
252 		.nmuxregs = ARRAY_SIZE(i2c0_muxreg),
253 	},
254 };
255 
256 static struct spear_pingroup i2c0_pingroup = {
257 	.name = "i2c0_grp",
258 	.pins = i2c0_pins,
259 	.npins = ARRAY_SIZE(i2c0_pins),
260 	.modemuxs = i2c0_modemux,
261 	.nmodemuxs = ARRAY_SIZE(i2c0_modemux),
262 };
263 
264 static const char *const i2c0_grps[] = { "i2c0_grp" };
265 static struct spear_function i2c0_function = {
266 	.name = "i2c0",
267 	.groups = i2c0_grps,
268 	.ngroups = ARRAY_SIZE(i2c0_grps),
269 };
270 
271 /* Pad multiplexing for ssp0 device */
272 static const unsigned ssp0_pins[] = { 109, 110, 111, 112 };
273 static struct spear_muxreg ssp0_muxreg[] = {
274 	{
275 		.reg = PAD_FUNCTION_EN_0,
276 		.mask = PMX_SSP0_MASK,
277 		.val = PMX_SSP0_MASK,
278 	}, {
279 		.reg = PAD_DIRECTION_SEL_0,
280 		.mask = PMX_SSP0_MASK,
281 		.val = PMX_SSP0_MASK,
282 	},
283 };
284 
285 static struct spear_modemux ssp0_modemux[] = {
286 	{
287 		.muxregs = ssp0_muxreg,
288 		.nmuxregs = ARRAY_SIZE(ssp0_muxreg),
289 	},
290 };
291 
292 static struct spear_pingroup ssp0_pingroup = {
293 	.name = "ssp0_grp",
294 	.pins = ssp0_pins,
295 	.npins = ARRAY_SIZE(ssp0_pins),
296 	.modemuxs = ssp0_modemux,
297 	.nmodemuxs = ARRAY_SIZE(ssp0_modemux),
298 };
299 
300 /* Pad multiplexing for ssp0_cs0 device */
301 static const unsigned ssp0_cs0_pins[] = { 96 };
302 static struct spear_muxreg ssp0_cs0_muxreg[] = {
303 	{
304 		.reg = PAD_FUNCTION_EN_2,
305 		.mask = PMX_SSP0_CS0_MASK,
306 		.val = PMX_SSP0_CS0_MASK,
307 	}, {
308 		.reg = PAD_DIRECTION_SEL_2,
309 		.mask = PMX_SSP0_CS0_MASK,
310 		.val = PMX_SSP0_CS0_MASK,
311 	},
312 };
313 
314 static struct spear_modemux ssp0_cs0_modemux[] = {
315 	{
316 		.muxregs = ssp0_cs0_muxreg,
317 		.nmuxregs = ARRAY_SIZE(ssp0_cs0_muxreg),
318 	},
319 };
320 
321 static struct spear_pingroup ssp0_cs0_pingroup = {
322 	.name = "ssp0_cs0_grp",
323 	.pins = ssp0_cs0_pins,
324 	.npins = ARRAY_SIZE(ssp0_cs0_pins),
325 	.modemuxs = ssp0_cs0_modemux,
326 	.nmodemuxs = ARRAY_SIZE(ssp0_cs0_modemux),
327 };
328 
329 /* ssp0_cs1_2 device */
330 static const unsigned ssp0_cs1_2_pins[] = { 94, 95 };
331 static struct spear_muxreg ssp0_cs1_2_muxreg[] = {
332 	{
333 		.reg = PAD_FUNCTION_EN_2,
334 		.mask = PMX_SSP0_CS1_2_MASK,
335 		.val = PMX_SSP0_CS1_2_MASK,
336 	}, {
337 		.reg = PAD_DIRECTION_SEL_2,
338 		.mask = PMX_SSP0_CS1_2_MASK,
339 		.val = PMX_SSP0_CS1_2_MASK,
340 	},
341 };
342 
343 static struct spear_modemux ssp0_cs1_2_modemux[] = {
344 	{
345 		.muxregs = ssp0_cs1_2_muxreg,
346 		.nmuxregs = ARRAY_SIZE(ssp0_cs1_2_muxreg),
347 	},
348 };
349 
350 static struct spear_pingroup ssp0_cs1_2_pingroup = {
351 	.name = "ssp0_cs1_2_grp",
352 	.pins = ssp0_cs1_2_pins,
353 	.npins = ARRAY_SIZE(ssp0_cs1_2_pins),
354 	.modemuxs = ssp0_cs1_2_modemux,
355 	.nmodemuxs = ARRAY_SIZE(ssp0_cs1_2_modemux),
356 };
357 
358 static const char *const ssp0_grps[] = { "ssp0_grp", "ssp0_cs0_grp",
359 	"ssp0_cs1_2_grp" };
360 static struct spear_function ssp0_function = {
361 	.name = "ssp0",
362 	.groups = ssp0_grps,
363 	.ngroups = ARRAY_SIZE(ssp0_grps),
364 };
365 
366 /* Pad multiplexing for i2s0 device */
367 static const unsigned i2s0_pins[] = { 104, 105, 106, 107, 108 };
368 static struct spear_muxreg i2s0_muxreg[] = {
369 	{
370 		.reg = PAD_FUNCTION_EN_0,
371 		.mask = PMX_I2S0_MASK,
372 		.val = PMX_I2S0_MASK,
373 	}, {
374 		.reg = PAD_DIRECTION_SEL_0,
375 		.mask = PMX_I2S0_MASK,
376 		.val = PMX_I2S0_MASK,
377 	},
378 };
379 
380 static struct spear_modemux i2s0_modemux[] = {
381 	{
382 		.muxregs = i2s0_muxreg,
383 		.nmuxregs = ARRAY_SIZE(i2s0_muxreg),
384 	},
385 };
386 
387 static struct spear_pingroup i2s0_pingroup = {
388 	.name = "i2s0_grp",
389 	.pins = i2s0_pins,
390 	.npins = ARRAY_SIZE(i2s0_pins),
391 	.modemuxs = i2s0_modemux,
392 	.nmodemuxs = ARRAY_SIZE(i2s0_modemux),
393 };
394 
395 static const char *const i2s0_grps[] = { "i2s0_grp" };
396 static struct spear_function i2s0_function = {
397 	.name = "i2s0",
398 	.groups = i2s0_grps,
399 	.ngroups = ARRAY_SIZE(i2s0_grps),
400 };
401 
402 /* Pad multiplexing for i2s1 device */
403 static const unsigned i2s1_pins[] = { 0, 1, 2, 3 };
404 static struct spear_muxreg i2s1_muxreg[] = {
405 	{
406 		.reg = PAD_FUNCTION_EN_1,
407 		.mask = PMX_I2S1_MASK,
408 		.val = PMX_I2S1_MASK,
409 	}, {
410 		.reg = PAD_DIRECTION_SEL_1,
411 		.mask = PMX_I2S1_MASK,
412 		.val = PMX_I2S1_MASK,
413 	},
414 };
415 
416 static struct spear_modemux i2s1_modemux[] = {
417 	{
418 		.muxregs = i2s1_muxreg,
419 		.nmuxregs = ARRAY_SIZE(i2s1_muxreg),
420 	},
421 };
422 
423 static struct spear_pingroup i2s1_pingroup = {
424 	.name = "i2s1_grp",
425 	.pins = i2s1_pins,
426 	.npins = ARRAY_SIZE(i2s1_pins),
427 	.modemuxs = i2s1_modemux,
428 	.nmodemuxs = ARRAY_SIZE(i2s1_modemux),
429 };
430 
431 static const char *const i2s1_grps[] = { "i2s1_grp" };
432 static struct spear_function i2s1_function = {
433 	.name = "i2s1",
434 	.groups = i2s1_grps,
435 	.ngroups = ARRAY_SIZE(i2s1_grps),
436 };
437 
438 /* Pad multiplexing for clcd device */
439 static const unsigned clcd_pins[] = { 113, 114, 115, 116, 117, 118, 119, 120,
440 	121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
441 	135, 136, 137, 138, 139, 140, 141, 142 };
442 static struct spear_muxreg clcd_muxreg[] = {
443 	{
444 		.reg = PAD_FUNCTION_EN_0,
445 		.mask = PMX_CLCD1_MASK,
446 		.val = PMX_CLCD1_MASK,
447 	}, {
448 		.reg = PAD_DIRECTION_SEL_0,
449 		.mask = PMX_CLCD1_MASK,
450 		.val = PMX_CLCD1_MASK,
451 	},
452 };
453 
454 static struct spear_modemux clcd_modemux[] = {
455 	{
456 		.muxregs = clcd_muxreg,
457 		.nmuxregs = ARRAY_SIZE(clcd_muxreg),
458 	},
459 };
460 
461 static struct spear_pingroup clcd_pingroup = {
462 	.name = "clcd_grp",
463 	.pins = clcd_pins,
464 	.npins = ARRAY_SIZE(clcd_pins),
465 	.modemuxs = clcd_modemux,
466 	.nmodemuxs = ARRAY_SIZE(clcd_modemux),
467 };
468 
469 static const unsigned clcd_high_res_pins[] = { 30, 31, 32, 33, 34, 35, 36, 37,
470 	38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 };
471 static struct spear_muxreg clcd_high_res_muxreg[] = {
472 	{
473 		.reg = PAD_FUNCTION_EN_1,
474 		.mask = PMX_CLCD2_MASK,
475 		.val = PMX_CLCD2_MASK,
476 	}, {
477 		.reg = PAD_DIRECTION_SEL_1,
478 		.mask = PMX_CLCD2_MASK,
479 		.val = PMX_CLCD2_MASK,
480 	},
481 };
482 
483 static struct spear_modemux clcd_high_res_modemux[] = {
484 	{
485 		.muxregs = clcd_high_res_muxreg,
486 		.nmuxregs = ARRAY_SIZE(clcd_high_res_muxreg),
487 	},
488 };
489 
490 static struct spear_pingroup clcd_high_res_pingroup = {
491 	.name = "clcd_high_res_grp",
492 	.pins = clcd_high_res_pins,
493 	.npins = ARRAY_SIZE(clcd_high_res_pins),
494 	.modemuxs = clcd_high_res_modemux,
495 	.nmodemuxs = ARRAY_SIZE(clcd_high_res_modemux),
496 };
497 
498 static const char *const clcd_grps[] = { "clcd_grp", "clcd_high_res_grp" };
499 static struct spear_function clcd_function = {
500 	.name = "clcd",
501 	.groups = clcd_grps,
502 	.ngroups = ARRAY_SIZE(clcd_grps),
503 };
504 
505 static const unsigned arm_gpio_pins[] = { 18, 19, 20, 21, 22, 23, 143, 144, 145,
506 	146, 147, 148, 149, 150, 151, 152 };
507 static struct spear_muxreg arm_gpio_muxreg[] = {
508 	{
509 		.reg = PAD_FUNCTION_EN_0,
510 		.mask = PMX_EGPIO_0_GRP_MASK,
511 		.val = PMX_EGPIO_0_GRP_MASK,
512 	}, {
513 		.reg = PAD_FUNCTION_EN_1,
514 		.mask = PMX_EGPIO_1_GRP_MASK,
515 		.val = PMX_EGPIO_1_GRP_MASK,
516 	}, {
517 		.reg = PAD_DIRECTION_SEL_0,
518 		.mask = PMX_EGPIO_0_GRP_MASK,
519 		.val = PMX_EGPIO_0_GRP_MASK,
520 	}, {
521 		.reg = PAD_DIRECTION_SEL_1,
522 		.mask = PMX_EGPIO_1_GRP_MASK,
523 		.val = PMX_EGPIO_1_GRP_MASK,
524 	},
525 };
526 
527 static struct spear_modemux arm_gpio_modemux[] = {
528 	{
529 		.muxregs = arm_gpio_muxreg,
530 		.nmuxregs = ARRAY_SIZE(arm_gpio_muxreg),
531 	},
532 };
533 
534 static struct spear_pingroup arm_gpio_pingroup = {
535 	.name = "arm_gpio_grp",
536 	.pins = arm_gpio_pins,
537 	.npins = ARRAY_SIZE(arm_gpio_pins),
538 	.modemuxs = arm_gpio_modemux,
539 	.nmodemuxs = ARRAY_SIZE(arm_gpio_modemux),
540 };
541 
542 static const char *const arm_gpio_grps[] = { "arm_gpio_grp" };
543 static struct spear_function arm_gpio_function = {
544 	.name = "arm_gpio",
545 	.groups = arm_gpio_grps,
546 	.ngroups = ARRAY_SIZE(arm_gpio_grps),
547 };
548 
549 /* Pad multiplexing for smi 2 chips device */
550 static const unsigned smi_2_chips_pins[] = { 153, 154, 155, 156, 157 };
551 static struct spear_muxreg smi_2_chips_muxreg[] = {
552 	{
553 		.reg = PAD_FUNCTION_EN_0,
554 		.mask = PMX_SMI_MASK,
555 		.val = PMX_SMI_MASK,
556 	}, {
557 		.reg = PAD_DIRECTION_SEL_0,
558 		.mask = PMX_SMI_MASK,
559 		.val = PMX_SMI_MASK,
560 	},
561 };
562 
563 static struct spear_modemux smi_2_chips_modemux[] = {
564 	{
565 		.muxregs = smi_2_chips_muxreg,
566 		.nmuxregs = ARRAY_SIZE(smi_2_chips_muxreg),
567 	},
568 };
569 
570 static struct spear_pingroup smi_2_chips_pingroup = {
571 	.name = "smi_2_chips_grp",
572 	.pins = smi_2_chips_pins,
573 	.npins = ARRAY_SIZE(smi_2_chips_pins),
574 	.modemuxs = smi_2_chips_modemux,
575 	.nmodemuxs = ARRAY_SIZE(smi_2_chips_modemux),
576 };
577 
578 static const unsigned smi_4_chips_pins[] = { 54, 55 };
579 static struct spear_muxreg smi_4_chips_muxreg[] = {
580 	{
581 		.reg = PAD_FUNCTION_EN_0,
582 		.mask = PMX_SMI_MASK,
583 		.val = PMX_SMI_MASK,
584 	}, {
585 		.reg = PAD_FUNCTION_EN_1,
586 		.mask = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
587 		.val = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
588 	}, {
589 		.reg = PAD_DIRECTION_SEL_0,
590 		.mask = PMX_SMI_MASK,
591 		.val = PMX_SMI_MASK,
592 	}, {
593 		.reg = PAD_DIRECTION_SEL_1,
594 		.mask = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
595 		.val = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
596 	},
597 };
598 
599 static struct spear_modemux smi_4_chips_modemux[] = {
600 	{
601 		.muxregs = smi_4_chips_muxreg,
602 		.nmuxregs = ARRAY_SIZE(smi_4_chips_muxreg),
603 	},
604 };
605 
606 static struct spear_pingroup smi_4_chips_pingroup = {
607 	.name = "smi_4_chips_grp",
608 	.pins = smi_4_chips_pins,
609 	.npins = ARRAY_SIZE(smi_4_chips_pins),
610 	.modemuxs = smi_4_chips_modemux,
611 	.nmodemuxs = ARRAY_SIZE(smi_4_chips_modemux),
612 };
613 
614 static const char *const smi_grps[] = { "smi_2_chips_grp", "smi_4_chips_grp" };
615 static struct spear_function smi_function = {
616 	.name = "smi",
617 	.groups = smi_grps,
618 	.ngroups = ARRAY_SIZE(smi_grps),
619 };
620 
621 /* Pad multiplexing for gmii device */
622 static const unsigned gmii_pins[] = { 173, 174, 175, 176, 177, 178, 179, 180,
623 	181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
624 	195, 196, 197, 198, 199, 200 };
625 static struct spear_muxreg gmii_muxreg[] = {
626 	{
627 		.reg = PAD_FUNCTION_EN_0,
628 		.mask = PMX_GMII_MASK,
629 		.val = PMX_GMII_MASK,
630 	}, {
631 		.reg = PAD_DIRECTION_SEL_0,
632 		.mask = PMX_GMII_MASK,
633 		.val = PMX_GMII_MASK,
634 	},
635 };
636 
637 static struct spear_modemux gmii_modemux[] = {
638 	{
639 		.muxregs = gmii_muxreg,
640 		.nmuxregs = ARRAY_SIZE(gmii_muxreg),
641 	},
642 };
643 
644 static struct spear_pingroup gmii_pingroup = {
645 	.name = "gmii_grp",
646 	.pins = gmii_pins,
647 	.npins = ARRAY_SIZE(gmii_pins),
648 	.modemuxs = gmii_modemux,
649 	.nmodemuxs = ARRAY_SIZE(gmii_modemux),
650 };
651 
652 static const char *const gmii_grps[] = { "gmii_grp" };
653 static struct spear_function gmii_function = {
654 	.name = "gmii",
655 	.groups = gmii_grps,
656 	.ngroups = ARRAY_SIZE(gmii_grps),
657 };
658 
659 /* Pad multiplexing for rgmii device */
660 static const unsigned rgmii_pins[] = { 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
661 	28, 29, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 175,
662 	180, 181, 182, 183, 185, 188, 193, 194, 195, 196, 197, 198, 211, 212 };
663 static struct spear_muxreg rgmii_muxreg[] = {
664 	{
665 		.reg = PAD_FUNCTION_EN_0,
666 		.mask = PMX_RGMII_REG0_MASK,
667 		.val = 0,
668 	}, {
669 		.reg = PAD_FUNCTION_EN_1,
670 		.mask = PMX_RGMII_REG1_MASK,
671 		.val = 0,
672 	}, {
673 		.reg = PAD_FUNCTION_EN_2,
674 		.mask = PMX_RGMII_REG2_MASK,
675 		.val = 0,
676 	}, {
677 		.reg = PAD_DIRECTION_SEL_0,
678 		.mask = PMX_RGMII_REG0_MASK,
679 		.val = PMX_RGMII_REG0_MASK,
680 	}, {
681 		.reg = PAD_DIRECTION_SEL_1,
682 		.mask = PMX_RGMII_REG1_MASK,
683 		.val = PMX_RGMII_REG1_MASK,
684 	}, {
685 		.reg = PAD_DIRECTION_SEL_2,
686 		.mask = PMX_RGMII_REG2_MASK,
687 		.val = PMX_RGMII_REG2_MASK,
688 	},
689 };
690 
691 static struct spear_modemux rgmii_modemux[] = {
692 	{
693 		.muxregs = rgmii_muxreg,
694 		.nmuxregs = ARRAY_SIZE(rgmii_muxreg),
695 	},
696 };
697 
698 static struct spear_pingroup rgmii_pingroup = {
699 	.name = "rgmii_grp",
700 	.pins = rgmii_pins,
701 	.npins = ARRAY_SIZE(rgmii_pins),
702 	.modemuxs = rgmii_modemux,
703 	.nmodemuxs = ARRAY_SIZE(rgmii_modemux),
704 };
705 
706 static const char *const rgmii_grps[] = { "rgmii_grp" };
707 static struct spear_function rgmii_function = {
708 	.name = "rgmii",
709 	.groups = rgmii_grps,
710 	.ngroups = ARRAY_SIZE(rgmii_grps),
711 };
712 
713 /* Pad multiplexing for smii_0_1_2 device */
714 static const unsigned smii_0_1_2_pins[] = { 24, 25, 26, 27, 28, 29, 30, 31, 32,
715 	33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
716 	51, 52, 53, 54, 55 };
717 static struct spear_muxreg smii_0_1_2_muxreg[] = {
718 	{
719 		.reg = PAD_FUNCTION_EN_1,
720 		.mask = PMX_SMII_0_1_2_MASK,
721 		.val = 0,
722 	}, {
723 		.reg = PAD_DIRECTION_SEL_1,
724 		.mask = PMX_SMII_0_1_2_MASK,
725 		.val = PMX_SMII_0_1_2_MASK,
726 	},
727 };
728 
729 static struct spear_modemux smii_0_1_2_modemux[] = {
730 	{
731 		.muxregs = smii_0_1_2_muxreg,
732 		.nmuxregs = ARRAY_SIZE(smii_0_1_2_muxreg),
733 	},
734 };
735 
736 static struct spear_pingroup smii_0_1_2_pingroup = {
737 	.name = "smii_0_1_2_grp",
738 	.pins = smii_0_1_2_pins,
739 	.npins = ARRAY_SIZE(smii_0_1_2_pins),
740 	.modemuxs = smii_0_1_2_modemux,
741 	.nmodemuxs = ARRAY_SIZE(smii_0_1_2_modemux),
742 };
743 
744 static const char *const smii_0_1_2_grps[] = { "smii_0_1_2_grp" };
745 static struct spear_function smii_0_1_2_function = {
746 	.name = "smii_0_1_2",
747 	.groups = smii_0_1_2_grps,
748 	.ngroups = ARRAY_SIZE(smii_0_1_2_grps),
749 };
750 
751 /* Pad multiplexing for ras_mii_txclk device */
752 static const unsigned ras_mii_txclk_pins[] = { 98, 99 };
753 static struct spear_muxreg ras_mii_txclk_muxreg[] = {
754 	{
755 		.reg = PAD_FUNCTION_EN_1,
756 		.mask = PMX_NFCE2_MASK,
757 		.val = 0,
758 	}, {
759 		.reg = PAD_DIRECTION_SEL_1,
760 		.mask = PMX_NFCE2_MASK,
761 		.val = PMX_NFCE2_MASK,
762 	},
763 };
764 
765 static struct spear_modemux ras_mii_txclk_modemux[] = {
766 	{
767 		.muxregs = ras_mii_txclk_muxreg,
768 		.nmuxregs = ARRAY_SIZE(ras_mii_txclk_muxreg),
769 	},
770 };
771 
772 static struct spear_pingroup ras_mii_txclk_pingroup = {
773 	.name = "ras_mii_txclk_grp",
774 	.pins = ras_mii_txclk_pins,
775 	.npins = ARRAY_SIZE(ras_mii_txclk_pins),
776 	.modemuxs = ras_mii_txclk_modemux,
777 	.nmodemuxs = ARRAY_SIZE(ras_mii_txclk_modemux),
778 };
779 
780 static const char *const ras_mii_txclk_grps[] = { "ras_mii_txclk_grp" };
781 static struct spear_function ras_mii_txclk_function = {
782 	.name = "ras_mii_txclk",
783 	.groups = ras_mii_txclk_grps,
784 	.ngroups = ARRAY_SIZE(ras_mii_txclk_grps),
785 };
786 
787 /* Pad multiplexing for nand 8bit device (cs0 only) */
788 static const unsigned nand_8bit_pins[] = { 56, 57, 58, 59, 60, 61, 62, 63, 64,
789 	65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
790 	83, 84, 85, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
791 	170, 171, 172, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211,
792 	212 };
793 static struct spear_muxreg nand_8bit_muxreg[] = {
794 	{
795 		.reg = PAD_FUNCTION_EN_0,
796 		.mask = PMX_NAND8BIT_0_MASK,
797 		.val = PMX_NAND8BIT_0_MASK,
798 	}, {
799 		.reg = PAD_FUNCTION_EN_1,
800 		.mask = PMX_NAND8BIT_1_MASK,
801 		.val = PMX_NAND8BIT_1_MASK,
802 	}, {
803 		.reg = PAD_DIRECTION_SEL_0,
804 		.mask = PMX_NAND8BIT_0_MASK,
805 		.val = PMX_NAND8BIT_0_MASK,
806 	}, {
807 		.reg = PAD_DIRECTION_SEL_1,
808 		.mask = PMX_NAND8BIT_1_MASK,
809 		.val = PMX_NAND8BIT_1_MASK,
810 	},
811 };
812 
813 static struct spear_modemux nand_8bit_modemux[] = {
814 	{
815 		.muxregs = nand_8bit_muxreg,
816 		.nmuxregs = ARRAY_SIZE(nand_8bit_muxreg),
817 	},
818 };
819 
820 static struct spear_pingroup nand_8bit_pingroup = {
821 	.name = "nand_8bit_grp",
822 	.pins = nand_8bit_pins,
823 	.npins = ARRAY_SIZE(nand_8bit_pins),
824 	.modemuxs = nand_8bit_modemux,
825 	.nmodemuxs = ARRAY_SIZE(nand_8bit_modemux),
826 };
827 
828 /* Pad multiplexing for nand 16bit device */
829 static const unsigned nand_16bit_pins[] = { 201, 202, 203, 204, 207, 208, 209,
830 	210 };
831 static struct spear_muxreg nand_16bit_muxreg[] = {
832 	{
833 		.reg = PAD_FUNCTION_EN_1,
834 		.mask = PMX_NAND16BIT_1_MASK,
835 		.val = PMX_NAND16BIT_1_MASK,
836 	}, {
837 		.reg = PAD_DIRECTION_SEL_1,
838 		.mask = PMX_NAND16BIT_1_MASK,
839 		.val = PMX_NAND16BIT_1_MASK,
840 	},
841 };
842 
843 static struct spear_modemux nand_16bit_modemux[] = {
844 	{
845 		.muxregs = nand_16bit_muxreg,
846 		.nmuxregs = ARRAY_SIZE(nand_16bit_muxreg),
847 	},
848 };
849 
850 static struct spear_pingroup nand_16bit_pingroup = {
851 	.name = "nand_16bit_grp",
852 	.pins = nand_16bit_pins,
853 	.npins = ARRAY_SIZE(nand_16bit_pins),
854 	.modemuxs = nand_16bit_modemux,
855 	.nmodemuxs = ARRAY_SIZE(nand_16bit_modemux),
856 };
857 
858 /* Pad multiplexing for nand 4 chips */
859 static const unsigned nand_4_chips_pins[] = { 205, 206, 211, 212 };
860 static struct spear_muxreg nand_4_chips_muxreg[] = {
861 	{
862 		.reg = PAD_FUNCTION_EN_1,
863 		.mask = PMX_NAND_4CHIPS_MASK,
864 		.val = PMX_NAND_4CHIPS_MASK,
865 	}, {
866 		.reg = PAD_DIRECTION_SEL_1,
867 		.mask = PMX_NAND_4CHIPS_MASK,
868 		.val = PMX_NAND_4CHIPS_MASK,
869 	},
870 };
871 
872 static struct spear_modemux nand_4_chips_modemux[] = {
873 	{
874 		.muxregs = nand_4_chips_muxreg,
875 		.nmuxregs = ARRAY_SIZE(nand_4_chips_muxreg),
876 	},
877 };
878 
879 static struct spear_pingroup nand_4_chips_pingroup = {
880 	.name = "nand_4_chips_grp",
881 	.pins = nand_4_chips_pins,
882 	.npins = ARRAY_SIZE(nand_4_chips_pins),
883 	.modemuxs = nand_4_chips_modemux,
884 	.nmodemuxs = ARRAY_SIZE(nand_4_chips_modemux),
885 };
886 
887 static const char *const nand_grps[] = { "nand_8bit_grp", "nand_16bit_grp",
888 	"nand_4_chips_grp" };
889 static struct spear_function nand_function = {
890 	.name = "nand",
891 	.groups = nand_grps,
892 	.ngroups = ARRAY_SIZE(nand_grps),
893 };
894 
895 /* Pad multiplexing for keyboard_6x6 device */
896 static const unsigned keyboard_6x6_pins[] = { 201, 202, 203, 204, 205, 206, 207,
897 	208, 209, 210, 211, 212 };
898 static struct spear_muxreg keyboard_6x6_muxreg[] = {
899 	{
900 		.reg = PAD_FUNCTION_EN_1,
901 		.mask = PMX_KEYBOARD_6X6_MASK | PMX_NFIO8_15_MASK |
902 			PMX_NFCE1_MASK | PMX_NFCE2_MASK | PMX_NFWPRT1_MASK |
903 			PMX_NFWPRT2_MASK,
904 		.val = PMX_KEYBOARD_6X6_MASK,
905 	},
906 };
907 
908 static struct spear_modemux keyboard_6x6_modemux[] = {
909 	{
910 		.muxregs = keyboard_6x6_muxreg,
911 		.nmuxregs = ARRAY_SIZE(keyboard_6x6_muxreg),
912 	},
913 };
914 
915 static struct spear_pingroup keyboard_6x6_pingroup = {
916 	.name = "keyboard_6x6_grp",
917 	.pins = keyboard_6x6_pins,
918 	.npins = ARRAY_SIZE(keyboard_6x6_pins),
919 	.modemuxs = keyboard_6x6_modemux,
920 	.nmodemuxs = ARRAY_SIZE(keyboard_6x6_modemux),
921 };
922 
923 /* Pad multiplexing for keyboard_rowcol6_8 device */
924 static const unsigned keyboard_rowcol6_8_pins[] = { 24, 25, 26, 27, 28, 29 };
925 static struct spear_muxreg keyboard_rowcol6_8_muxreg[] = {
926 	{
927 		.reg = PAD_FUNCTION_EN_1,
928 		.mask = PMX_KBD_ROWCOL68_MASK,
929 		.val = PMX_KBD_ROWCOL68_MASK,
930 	}, {
931 		.reg = PAD_DIRECTION_SEL_1,
932 		.mask = PMX_KBD_ROWCOL68_MASK,
933 		.val = PMX_KBD_ROWCOL68_MASK,
934 	},
935 };
936 
937 static struct spear_modemux keyboard_rowcol6_8_modemux[] = {
938 	{
939 		.muxregs = keyboard_rowcol6_8_muxreg,
940 		.nmuxregs = ARRAY_SIZE(keyboard_rowcol6_8_muxreg),
941 	},
942 };
943 
944 static struct spear_pingroup keyboard_rowcol6_8_pingroup = {
945 	.name = "keyboard_rowcol6_8_grp",
946 	.pins = keyboard_rowcol6_8_pins,
947 	.npins = ARRAY_SIZE(keyboard_rowcol6_8_pins),
948 	.modemuxs = keyboard_rowcol6_8_modemux,
949 	.nmodemuxs = ARRAY_SIZE(keyboard_rowcol6_8_modemux),
950 };
951 
952 static const char *const keyboard_grps[] = { "keyboard_6x6_grp",
953 	"keyboard_rowcol6_8_grp" };
954 static struct spear_function keyboard_function = {
955 	.name = "keyboard",
956 	.groups = keyboard_grps,
957 	.ngroups = ARRAY_SIZE(keyboard_grps),
958 };
959 
960 /* Pad multiplexing for uart0 device */
961 static const unsigned uart0_pins[] = { 100, 101 };
962 static struct spear_muxreg uart0_muxreg[] = {
963 	{
964 		.reg = PAD_FUNCTION_EN_0,
965 		.mask = PMX_UART0_MASK,
966 		.val = PMX_UART0_MASK,
967 	}, {
968 		.reg = PAD_DIRECTION_SEL_0,
969 		.mask = PMX_UART0_MASK,
970 		.val = PMX_UART0_MASK,
971 	},
972 };
973 
974 static struct spear_modemux uart0_modemux[] = {
975 	{
976 		.muxregs = uart0_muxreg,
977 		.nmuxregs = ARRAY_SIZE(uart0_muxreg),
978 	},
979 };
980 
981 static struct spear_pingroup uart0_pingroup = {
982 	.name = "uart0_grp",
983 	.pins = uart0_pins,
984 	.npins = ARRAY_SIZE(uart0_pins),
985 	.modemuxs = uart0_modemux,
986 	.nmodemuxs = ARRAY_SIZE(uart0_modemux),
987 };
988 
989 /* Pad multiplexing for uart0_modem device */
990 static const unsigned uart0_modem_pins[] = { 12, 13, 14, 15, 16, 17 };
991 static struct spear_muxreg uart0_modem_muxreg[] = {
992 	{
993 		.reg = PAD_FUNCTION_EN_1,
994 		.mask = PMX_UART0_MODEM_MASK,
995 		.val = PMX_UART0_MODEM_MASK,
996 	}, {
997 		.reg = PAD_DIRECTION_SEL_1,
998 		.mask = PMX_UART0_MODEM_MASK,
999 		.val = PMX_UART0_MODEM_MASK,
1000 	},
1001 };
1002 
1003 static struct spear_modemux uart0_modem_modemux[] = {
1004 	{
1005 		.muxregs = uart0_modem_muxreg,
1006 		.nmuxregs = ARRAY_SIZE(uart0_modem_muxreg),
1007 	},
1008 };
1009 
1010 static struct spear_pingroup uart0_modem_pingroup = {
1011 	.name = "uart0_modem_grp",
1012 	.pins = uart0_modem_pins,
1013 	.npins = ARRAY_SIZE(uart0_modem_pins),
1014 	.modemuxs = uart0_modem_modemux,
1015 	.nmodemuxs = ARRAY_SIZE(uart0_modem_modemux),
1016 };
1017 
1018 static const char *const uart0_grps[] = { "uart0_grp", "uart0_modem_grp" };
1019 static struct spear_function uart0_function = {
1020 	.name = "uart0",
1021 	.groups = uart0_grps,
1022 	.ngroups = ARRAY_SIZE(uart0_grps),
1023 };
1024 
1025 /* Pad multiplexing for gpt0_tmr0 device */
1026 static const unsigned gpt0_tmr0_pins[] = { 10, 11 };
1027 static struct spear_muxreg gpt0_tmr0_muxreg[] = {
1028 	{
1029 		.reg = PAD_FUNCTION_EN_1,
1030 		.mask = PMX_GPT0_TMR0_MASK,
1031 		.val = PMX_GPT0_TMR0_MASK,
1032 	}, {
1033 		.reg = PAD_DIRECTION_SEL_1,
1034 		.mask = PMX_GPT0_TMR0_MASK,
1035 		.val = PMX_GPT0_TMR0_MASK,
1036 	},
1037 };
1038 
1039 static struct spear_modemux gpt0_tmr0_modemux[] = {
1040 	{
1041 		.muxregs = gpt0_tmr0_muxreg,
1042 		.nmuxregs = ARRAY_SIZE(gpt0_tmr0_muxreg),
1043 	},
1044 };
1045 
1046 static struct spear_pingroup gpt0_tmr0_pingroup = {
1047 	.name = "gpt0_tmr0_grp",
1048 	.pins = gpt0_tmr0_pins,
1049 	.npins = ARRAY_SIZE(gpt0_tmr0_pins),
1050 	.modemuxs = gpt0_tmr0_modemux,
1051 	.nmodemuxs = ARRAY_SIZE(gpt0_tmr0_modemux),
1052 };
1053 
1054 /* Pad multiplexing for gpt0_tmr1 device */
1055 static const unsigned gpt0_tmr1_pins[] = { 8, 9 };
1056 static struct spear_muxreg gpt0_tmr1_muxreg[] = {
1057 	{
1058 		.reg = PAD_FUNCTION_EN_1,
1059 		.mask = PMX_GPT0_TMR1_MASK,
1060 		.val = PMX_GPT0_TMR1_MASK,
1061 	}, {
1062 		.reg = PAD_DIRECTION_SEL_1,
1063 		.mask = PMX_GPT0_TMR1_MASK,
1064 		.val = PMX_GPT0_TMR1_MASK,
1065 	},
1066 };
1067 
1068 static struct spear_modemux gpt0_tmr1_modemux[] = {
1069 	{
1070 		.muxregs = gpt0_tmr1_muxreg,
1071 		.nmuxregs = ARRAY_SIZE(gpt0_tmr1_muxreg),
1072 	},
1073 };
1074 
1075 static struct spear_pingroup gpt0_tmr1_pingroup = {
1076 	.name = "gpt0_tmr1_grp",
1077 	.pins = gpt0_tmr1_pins,
1078 	.npins = ARRAY_SIZE(gpt0_tmr1_pins),
1079 	.modemuxs = gpt0_tmr1_modemux,
1080 	.nmodemuxs = ARRAY_SIZE(gpt0_tmr1_modemux),
1081 };
1082 
1083 static const char *const gpt0_grps[] = { "gpt0_tmr0_grp", "gpt0_tmr1_grp" };
1084 static struct spear_function gpt0_function = {
1085 	.name = "gpt0",
1086 	.groups = gpt0_grps,
1087 	.ngroups = ARRAY_SIZE(gpt0_grps),
1088 };
1089 
1090 /* Pad multiplexing for gpt1_tmr0 device */
1091 static const unsigned gpt1_tmr0_pins[] = { 6, 7 };
1092 static struct spear_muxreg gpt1_tmr0_muxreg[] = {
1093 	{
1094 		.reg = PAD_FUNCTION_EN_1,
1095 		.mask = PMX_GPT1_TMR0_MASK,
1096 		.val = PMX_GPT1_TMR0_MASK,
1097 	}, {
1098 		.reg = PAD_DIRECTION_SEL_1,
1099 		.mask = PMX_GPT1_TMR0_MASK,
1100 		.val = PMX_GPT1_TMR0_MASK,
1101 	},
1102 };
1103 
1104 static struct spear_modemux gpt1_tmr0_modemux[] = {
1105 	{
1106 		.muxregs = gpt1_tmr0_muxreg,
1107 		.nmuxregs = ARRAY_SIZE(gpt1_tmr0_muxreg),
1108 	},
1109 };
1110 
1111 static struct spear_pingroup gpt1_tmr0_pingroup = {
1112 	.name = "gpt1_tmr0_grp",
1113 	.pins = gpt1_tmr0_pins,
1114 	.npins = ARRAY_SIZE(gpt1_tmr0_pins),
1115 	.modemuxs = gpt1_tmr0_modemux,
1116 	.nmodemuxs = ARRAY_SIZE(gpt1_tmr0_modemux),
1117 };
1118 
1119 /* Pad multiplexing for gpt1_tmr1 device */
1120 static const unsigned gpt1_tmr1_pins[] = { 4, 5 };
1121 static struct spear_muxreg gpt1_tmr1_muxreg[] = {
1122 	{
1123 		.reg = PAD_FUNCTION_EN_1,
1124 		.mask = PMX_GPT1_TMR1_MASK,
1125 		.val = PMX_GPT1_TMR1_MASK,
1126 	}, {
1127 		.reg = PAD_DIRECTION_SEL_1,
1128 		.mask = PMX_GPT1_TMR1_MASK,
1129 		.val = PMX_GPT1_TMR1_MASK,
1130 	},
1131 };
1132 
1133 static struct spear_modemux gpt1_tmr1_modemux[] = {
1134 	{
1135 		.muxregs = gpt1_tmr1_muxreg,
1136 		.nmuxregs = ARRAY_SIZE(gpt1_tmr1_muxreg),
1137 	},
1138 };
1139 
1140 static struct spear_pingroup gpt1_tmr1_pingroup = {
1141 	.name = "gpt1_tmr1_grp",
1142 	.pins = gpt1_tmr1_pins,
1143 	.npins = ARRAY_SIZE(gpt1_tmr1_pins),
1144 	.modemuxs = gpt1_tmr1_modemux,
1145 	.nmodemuxs = ARRAY_SIZE(gpt1_tmr1_modemux),
1146 };
1147 
1148 static const char *const gpt1_grps[] = { "gpt1_tmr1_grp", "gpt1_tmr0_grp" };
1149 static struct spear_function gpt1_function = {
1150 	.name = "gpt1",
1151 	.groups = gpt1_grps,
1152 	.ngroups = ARRAY_SIZE(gpt1_grps),
1153 };
1154 
1155 /* Pad multiplexing for mcif device */
1156 static const unsigned mcif_pins[] = { 86, 87, 88, 89, 90, 91, 92, 93, 213, 214,
1157 	215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
1158 	229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242,
1159 	243, 244, 245 };
1160 #define MCIF_MUXREG						\
1161 	{							\
1162 		.reg = PAD_FUNCTION_EN_0,			\
1163 		.mask = PMX_MCI_DATA8_15_MASK,			\
1164 		.val = PMX_MCI_DATA8_15_MASK,			\
1165 	}, {							\
1166 		.reg = PAD_FUNCTION_EN_1,			\
1167 		.mask = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK |	\
1168 			PMX_NFWPRT2_MASK,			\
1169 		.val = PMX_MCIFALL_1_MASK,			\
1170 	}, {							\
1171 		.reg = PAD_FUNCTION_EN_2,			\
1172 		.mask = PMX_MCIFALL_2_MASK,			\
1173 		.val = PMX_MCIFALL_2_MASK,			\
1174 	}, {							\
1175 		.reg = PAD_DIRECTION_SEL_0,			\
1176 		.mask = PMX_MCI_DATA8_15_MASK,			\
1177 		.val = PMX_MCI_DATA8_15_MASK,			\
1178 	}, {							\
1179 		.reg = PAD_DIRECTION_SEL_1,			\
1180 		.mask = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK |	\
1181 			PMX_NFWPRT2_MASK,			\
1182 		.val = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK |  \
1183 			PMX_NFWPRT2_MASK,			\
1184 	}, {							\
1185 		.reg = PAD_DIRECTION_SEL_2,			\
1186 		.mask = PMX_MCIFALL_2_MASK,			\
1187 		.val = PMX_MCIFALL_2_MASK,			\
1188 	}
1189 
1190 /* sdhci device */
1191 static struct spear_muxreg sdhci_muxreg[] = {
1192 	MCIF_MUXREG,
1193 	{
1194 		.reg = PERIP_CFG,
1195 		.mask = MCIF_SEL_MASK,
1196 		.val = MCIF_SEL_SD,
1197 	},
1198 };
1199 
1200 static struct spear_modemux sdhci_modemux[] = {
1201 	{
1202 		.muxregs = sdhci_muxreg,
1203 		.nmuxregs = ARRAY_SIZE(sdhci_muxreg),
1204 	},
1205 };
1206 
1207 static struct spear_pingroup sdhci_pingroup = {
1208 	.name = "sdhci_grp",
1209 	.pins = mcif_pins,
1210 	.npins = ARRAY_SIZE(mcif_pins),
1211 	.modemuxs = sdhci_modemux,
1212 	.nmodemuxs = ARRAY_SIZE(sdhci_modemux),
1213 };
1214 
1215 static const char *const sdhci_grps[] = { "sdhci_grp" };
1216 static struct spear_function sdhci_function = {
1217 	.name = "sdhci",
1218 	.groups = sdhci_grps,
1219 	.ngroups = ARRAY_SIZE(sdhci_grps),
1220 };
1221 
1222 /* cf device */
1223 static struct spear_muxreg cf_muxreg[] = {
1224 	MCIF_MUXREG,
1225 	{
1226 		.reg = PERIP_CFG,
1227 		.mask = MCIF_SEL_MASK,
1228 		.val = MCIF_SEL_CF,
1229 	},
1230 };
1231 
1232 static struct spear_modemux cf_modemux[] = {
1233 	{
1234 		.muxregs = cf_muxreg,
1235 		.nmuxregs = ARRAY_SIZE(cf_muxreg),
1236 	},
1237 };
1238 
1239 static struct spear_pingroup cf_pingroup = {
1240 	.name = "cf_grp",
1241 	.pins = mcif_pins,
1242 	.npins = ARRAY_SIZE(mcif_pins),
1243 	.modemuxs = cf_modemux,
1244 	.nmodemuxs = ARRAY_SIZE(cf_modemux),
1245 };
1246 
1247 static const char *const cf_grps[] = { "cf_grp" };
1248 static struct spear_function cf_function = {
1249 	.name = "cf",
1250 	.groups = cf_grps,
1251 	.ngroups = ARRAY_SIZE(cf_grps),
1252 };
1253 
1254 /* xd device */
1255 static struct spear_muxreg xd_muxreg[] = {
1256 	MCIF_MUXREG,
1257 	{
1258 		.reg = PERIP_CFG,
1259 		.mask = MCIF_SEL_MASK,
1260 		.val = MCIF_SEL_XD,
1261 	},
1262 };
1263 
1264 static struct spear_modemux xd_modemux[] = {
1265 	{
1266 		.muxregs = xd_muxreg,
1267 		.nmuxregs = ARRAY_SIZE(xd_muxreg),
1268 	},
1269 };
1270 
1271 static struct spear_pingroup xd_pingroup = {
1272 	.name = "xd_grp",
1273 	.pins = mcif_pins,
1274 	.npins = ARRAY_SIZE(mcif_pins),
1275 	.modemuxs = xd_modemux,
1276 	.nmodemuxs = ARRAY_SIZE(xd_modemux),
1277 };
1278 
1279 static const char *const xd_grps[] = { "xd_grp" };
1280 static struct spear_function xd_function = {
1281 	.name = "xd",
1282 	.groups = xd_grps,
1283 	.ngroups = ARRAY_SIZE(xd_grps),
1284 };
1285 
1286 /* Pad multiplexing for touch_xy device */
1287 static const unsigned touch_xy_pins[] = { 97 };
1288 static struct spear_muxreg touch_xy_muxreg[] = {
1289 	{
1290 		.reg = PAD_FUNCTION_EN_2,
1291 		.mask = PMX_TOUCH_XY_MASK,
1292 		.val = PMX_TOUCH_XY_MASK,
1293 	}, {
1294 		.reg = PAD_DIRECTION_SEL_2,
1295 		.mask = PMX_TOUCH_XY_MASK,
1296 		.val = PMX_TOUCH_XY_MASK,
1297 	},
1298 };
1299 
1300 static struct spear_modemux touch_xy_modemux[] = {
1301 	{
1302 		.muxregs = touch_xy_muxreg,
1303 		.nmuxregs = ARRAY_SIZE(touch_xy_muxreg),
1304 	},
1305 };
1306 
1307 static struct spear_pingroup touch_xy_pingroup = {
1308 	.name = "touch_xy_grp",
1309 	.pins = touch_xy_pins,
1310 	.npins = ARRAY_SIZE(touch_xy_pins),
1311 	.modemuxs = touch_xy_modemux,
1312 	.nmodemuxs = ARRAY_SIZE(touch_xy_modemux),
1313 };
1314 
1315 static const char *const touch_xy_grps[] = { "touch_xy_grp" };
1316 static struct spear_function touch_xy_function = {
1317 	.name = "touchscreen",
1318 	.groups = touch_xy_grps,
1319 	.ngroups = ARRAY_SIZE(touch_xy_grps),
1320 };
1321 
1322 /* Pad multiplexing for uart1 device */
1323 /* Muxed with I2C */
1324 static const unsigned uart1_dis_i2c_pins[] = { 102, 103 };
1325 static struct spear_muxreg uart1_dis_i2c_muxreg[] = {
1326 	{
1327 		.reg = PAD_FUNCTION_EN_0,
1328 		.mask = PMX_I2C0_MASK,
1329 		.val = 0,
1330 	}, {
1331 		.reg = PAD_DIRECTION_SEL_0,
1332 		.mask = PMX_I2C0_MASK,
1333 		.val = PMX_I2C0_MASK,
1334 	},
1335 };
1336 
1337 static struct spear_modemux uart1_dis_i2c_modemux[] = {
1338 	{
1339 		.muxregs = uart1_dis_i2c_muxreg,
1340 		.nmuxregs = ARRAY_SIZE(uart1_dis_i2c_muxreg),
1341 	},
1342 };
1343 
1344 static struct spear_pingroup uart_1_dis_i2c_pingroup = {
1345 	.name = "uart1_disable_i2c_grp",
1346 	.pins = uart1_dis_i2c_pins,
1347 	.npins = ARRAY_SIZE(uart1_dis_i2c_pins),
1348 	.modemuxs = uart1_dis_i2c_modemux,
1349 	.nmodemuxs = ARRAY_SIZE(uart1_dis_i2c_modemux),
1350 };
1351 
1352 /* Muxed with SD/MMC */
1353 static const unsigned uart1_dis_sd_pins[] = { 214, 215 };
1354 static struct spear_muxreg uart1_dis_sd_muxreg[] = {
1355 	{
1356 		.reg = PAD_FUNCTION_EN_1,
1357 		.mask = PMX_MCIDATA1_MASK |
1358 			PMX_MCIDATA2_MASK,
1359 		.val = 0,
1360 	}, {
1361 		.reg = PAD_DIRECTION_SEL_1,
1362 		.mask = PMX_MCIDATA1_MASK |
1363 			PMX_MCIDATA2_MASK,
1364 		.val = PMX_MCIDATA1_MASK |
1365 			PMX_MCIDATA2_MASK,
1366 	},
1367 };
1368 
1369 static struct spear_modemux uart1_dis_sd_modemux[] = {
1370 	{
1371 		.muxregs = uart1_dis_sd_muxreg,
1372 		.nmuxregs = ARRAY_SIZE(uart1_dis_sd_muxreg),
1373 	},
1374 };
1375 
1376 static struct spear_pingroup uart_1_dis_sd_pingroup = {
1377 	.name = "uart1_disable_sd_grp",
1378 	.pins = uart1_dis_sd_pins,
1379 	.npins = ARRAY_SIZE(uart1_dis_sd_pins),
1380 	.modemuxs = uart1_dis_sd_modemux,
1381 	.nmodemuxs = ARRAY_SIZE(uart1_dis_sd_modemux),
1382 };
1383 
1384 static const char *const uart1_grps[] = { "uart1_disable_i2c_grp",
1385 	"uart1_disable_sd_grp" };
1386 static struct spear_function uart1_function = {
1387 	.name = "uart1",
1388 	.groups = uart1_grps,
1389 	.ngroups = ARRAY_SIZE(uart1_grps),
1390 };
1391 
1392 /* Pad multiplexing for uart2_3 device */
1393 static const unsigned uart2_3_pins[] = { 104, 105, 106, 107 };
1394 static struct spear_muxreg uart2_3_muxreg[] = {
1395 	{
1396 		.reg = PAD_FUNCTION_EN_0,
1397 		.mask = PMX_I2S0_MASK,
1398 		.val = 0,
1399 	}, {
1400 		.reg = PAD_DIRECTION_SEL_0,
1401 		.mask = PMX_I2S0_MASK,
1402 		.val = PMX_I2S0_MASK,
1403 	},
1404 };
1405 
1406 static struct spear_modemux uart2_3_modemux[] = {
1407 	{
1408 		.muxregs = uart2_3_muxreg,
1409 		.nmuxregs = ARRAY_SIZE(uart2_3_muxreg),
1410 	},
1411 };
1412 
1413 static struct spear_pingroup uart_2_3_pingroup = {
1414 	.name = "uart2_3_grp",
1415 	.pins = uart2_3_pins,
1416 	.npins = ARRAY_SIZE(uart2_3_pins),
1417 	.modemuxs = uart2_3_modemux,
1418 	.nmodemuxs = ARRAY_SIZE(uart2_3_modemux),
1419 };
1420 
1421 static const char *const uart2_3_grps[] = { "uart2_3_grp" };
1422 static struct spear_function uart2_3_function = {
1423 	.name = "uart2_3",
1424 	.groups = uart2_3_grps,
1425 	.ngroups = ARRAY_SIZE(uart2_3_grps),
1426 };
1427 
1428 /* Pad multiplexing for uart4 device */
1429 static const unsigned uart4_pins[] = { 108, 113 };
1430 static struct spear_muxreg uart4_muxreg[] = {
1431 	{
1432 		.reg = PAD_FUNCTION_EN_0,
1433 		.mask = PMX_I2S0_MASK | PMX_CLCD1_MASK,
1434 		.val = 0,
1435 	}, {
1436 		.reg = PAD_DIRECTION_SEL_0,
1437 		.mask = PMX_I2S0_MASK | PMX_CLCD1_MASK,
1438 		.val = PMX_I2S0_MASK | PMX_CLCD1_MASK,
1439 	},
1440 };
1441 
1442 static struct spear_modemux uart4_modemux[] = {
1443 	{
1444 		.muxregs = uart4_muxreg,
1445 		.nmuxregs = ARRAY_SIZE(uart4_muxreg),
1446 	},
1447 };
1448 
1449 static struct spear_pingroup uart_4_pingroup = {
1450 	.name = "uart4_grp",
1451 	.pins = uart4_pins,
1452 	.npins = ARRAY_SIZE(uart4_pins),
1453 	.modemuxs = uart4_modemux,
1454 	.nmodemuxs = ARRAY_SIZE(uart4_modemux),
1455 };
1456 
1457 static const char *const uart4_grps[] = { "uart4_grp" };
1458 static struct spear_function uart4_function = {
1459 	.name = "uart4",
1460 	.groups = uart4_grps,
1461 	.ngroups = ARRAY_SIZE(uart4_grps),
1462 };
1463 
1464 /* Pad multiplexing for uart5 device */
1465 static const unsigned uart5_pins[] = { 114, 115 };
1466 static struct spear_muxreg uart5_muxreg[] = {
1467 	{
1468 		.reg = PAD_FUNCTION_EN_0,
1469 		.mask = PMX_CLCD1_MASK,
1470 		.val = 0,
1471 	}, {
1472 		.reg = PAD_DIRECTION_SEL_0,
1473 		.mask = PMX_CLCD1_MASK,
1474 		.val = PMX_CLCD1_MASK,
1475 	},
1476 };
1477 
1478 static struct spear_modemux uart5_modemux[] = {
1479 	{
1480 		.muxregs = uart5_muxreg,
1481 		.nmuxregs = ARRAY_SIZE(uart5_muxreg),
1482 	},
1483 };
1484 
1485 static struct spear_pingroup uart_5_pingroup = {
1486 	.name = "uart5_grp",
1487 	.pins = uart5_pins,
1488 	.npins = ARRAY_SIZE(uart5_pins),
1489 	.modemuxs = uart5_modemux,
1490 	.nmodemuxs = ARRAY_SIZE(uart5_modemux),
1491 };
1492 
1493 static const char *const uart5_grps[] = { "uart5_grp" };
1494 static struct spear_function uart5_function = {
1495 	.name = "uart5",
1496 	.groups = uart5_grps,
1497 	.ngroups = ARRAY_SIZE(uart5_grps),
1498 };
1499 
1500 /* Pad multiplexing for rs485_0_1_tdm_0_1 device */
1501 static const unsigned rs485_0_1_tdm_0_1_pins[] = { 116, 117, 118, 119, 120, 121,
1502 	122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
1503 	136, 137 };
1504 static struct spear_muxreg rs485_0_1_tdm_0_1_muxreg[] = {
1505 	{
1506 		.reg = PAD_FUNCTION_EN_0,
1507 		.mask = PMX_CLCD1_MASK,
1508 		.val = 0,
1509 	}, {
1510 		.reg = PAD_DIRECTION_SEL_0,
1511 		.mask = PMX_CLCD1_MASK,
1512 		.val = PMX_CLCD1_MASK,
1513 	},
1514 };
1515 
1516 static struct spear_modemux rs485_0_1_tdm_0_1_modemux[] = {
1517 	{
1518 		.muxregs = rs485_0_1_tdm_0_1_muxreg,
1519 		.nmuxregs = ARRAY_SIZE(rs485_0_1_tdm_0_1_muxreg),
1520 	},
1521 };
1522 
1523 static struct spear_pingroup rs485_0_1_tdm_0_1_pingroup = {
1524 	.name = "rs485_0_1_tdm_0_1_grp",
1525 	.pins = rs485_0_1_tdm_0_1_pins,
1526 	.npins = ARRAY_SIZE(rs485_0_1_tdm_0_1_pins),
1527 	.modemuxs = rs485_0_1_tdm_0_1_modemux,
1528 	.nmodemuxs = ARRAY_SIZE(rs485_0_1_tdm_0_1_modemux),
1529 };
1530 
1531 static const char *const rs485_0_1_tdm_0_1_grps[] = { "rs485_0_1_tdm_0_1_grp" };
1532 static struct spear_function rs485_0_1_tdm_0_1_function = {
1533 	.name = "rs485_0_1_tdm_0_1",
1534 	.groups = rs485_0_1_tdm_0_1_grps,
1535 	.ngroups = ARRAY_SIZE(rs485_0_1_tdm_0_1_grps),
1536 };
1537 
1538 /* Pad multiplexing for i2c_1_2 device */
1539 static const unsigned i2c_1_2_pins[] = { 138, 139, 140, 141 };
1540 static struct spear_muxreg i2c_1_2_muxreg[] = {
1541 	{
1542 		.reg = PAD_FUNCTION_EN_0,
1543 		.mask = PMX_CLCD1_MASK,
1544 		.val = 0,
1545 	}, {
1546 		.reg = PAD_DIRECTION_SEL_0,
1547 		.mask = PMX_CLCD1_MASK,
1548 		.val = PMX_CLCD1_MASK,
1549 	},
1550 };
1551 
1552 static struct spear_modemux i2c_1_2_modemux[] = {
1553 	{
1554 		.muxregs = i2c_1_2_muxreg,
1555 		.nmuxregs = ARRAY_SIZE(i2c_1_2_muxreg),
1556 	},
1557 };
1558 
1559 static struct spear_pingroup i2c_1_2_pingroup = {
1560 	.name = "i2c_1_2_grp",
1561 	.pins = i2c_1_2_pins,
1562 	.npins = ARRAY_SIZE(i2c_1_2_pins),
1563 	.modemuxs = i2c_1_2_modemux,
1564 	.nmodemuxs = ARRAY_SIZE(i2c_1_2_modemux),
1565 };
1566 
1567 static const char *const i2c_1_2_grps[] = { "i2c_1_2_grp" };
1568 static struct spear_function i2c_1_2_function = {
1569 	.name = "i2c_1_2",
1570 	.groups = i2c_1_2_grps,
1571 	.ngroups = ARRAY_SIZE(i2c_1_2_grps),
1572 };
1573 
1574 /* Pad multiplexing for i2c3_dis_smi_clcd device */
1575 /* Muxed with SMI & CLCD */
1576 static const unsigned i2c3_dis_smi_clcd_pins[] = { 142, 153 };
1577 static struct spear_muxreg i2c3_dis_smi_clcd_muxreg[] = {
1578 	{
1579 		.reg = PAD_FUNCTION_EN_0,
1580 		.mask = PMX_CLCD1_MASK | PMX_SMI_MASK,
1581 		.val = 0,
1582 	}, {
1583 		.reg = PAD_DIRECTION_SEL_0,
1584 		.mask = PMX_CLCD1_MASK | PMX_SMI_MASK,
1585 		.val = PMX_CLCD1_MASK | PMX_SMI_MASK,
1586 	},
1587 };
1588 
1589 static struct spear_modemux i2c3_dis_smi_clcd_modemux[] = {
1590 	{
1591 		.muxregs = i2c3_dis_smi_clcd_muxreg,
1592 		.nmuxregs = ARRAY_SIZE(i2c3_dis_smi_clcd_muxreg),
1593 	},
1594 };
1595 
1596 static struct spear_pingroup i2c3_dis_smi_clcd_pingroup = {
1597 	.name = "i2c3_dis_smi_clcd_grp",
1598 	.pins = i2c3_dis_smi_clcd_pins,
1599 	.npins = ARRAY_SIZE(i2c3_dis_smi_clcd_pins),
1600 	.modemuxs = i2c3_dis_smi_clcd_modemux,
1601 	.nmodemuxs = ARRAY_SIZE(i2c3_dis_smi_clcd_modemux),
1602 };
1603 
1604 /* Pad multiplexing for i2c3_dis_sd_i2s0 device */
1605 /* Muxed with SD/MMC & I2S1 */
1606 static const unsigned i2c3_dis_sd_i2s0_pins[] = { 0, 216 };
1607 static struct spear_muxreg i2c3_dis_sd_i2s0_muxreg[] = {
1608 	{
1609 		.reg = PAD_FUNCTION_EN_1,
1610 		.mask = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
1611 		.val = 0,
1612 	}, {
1613 		.reg = PAD_DIRECTION_SEL_1,
1614 		.mask = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
1615 		.val = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
1616 	},
1617 };
1618 
1619 static struct spear_modemux i2c3_dis_sd_i2s0_modemux[] = {
1620 	{
1621 		.muxregs = i2c3_dis_sd_i2s0_muxreg,
1622 		.nmuxregs = ARRAY_SIZE(i2c3_dis_sd_i2s0_muxreg),
1623 	},
1624 };
1625 
1626 static struct spear_pingroup i2c3_dis_sd_i2s0_pingroup = {
1627 	.name = "i2c3_dis_sd_i2s0_grp",
1628 	.pins = i2c3_dis_sd_i2s0_pins,
1629 	.npins = ARRAY_SIZE(i2c3_dis_sd_i2s0_pins),
1630 	.modemuxs = i2c3_dis_sd_i2s0_modemux,
1631 	.nmodemuxs = ARRAY_SIZE(i2c3_dis_sd_i2s0_modemux),
1632 };
1633 
1634 static const char *const i2c3_grps[] = { "i2c3_dis_smi_clcd_grp",
1635 	"i2c3_dis_sd_i2s0_grp" };
1636 static struct spear_function i2c3_unction = {
1637 	.name = "i2c3_i2s1",
1638 	.groups = i2c3_grps,
1639 	.ngroups = ARRAY_SIZE(i2c3_grps),
1640 };
1641 
1642 /* Pad multiplexing for i2c_4_5_dis_smi device */
1643 /* Muxed with SMI */
1644 static const unsigned i2c_4_5_dis_smi_pins[] = { 154, 155, 156, 157 };
1645 static struct spear_muxreg i2c_4_5_dis_smi_muxreg[] = {
1646 	{
1647 		.reg = PAD_FUNCTION_EN_0,
1648 		.mask = PMX_SMI_MASK,
1649 		.val = 0,
1650 	}, {
1651 		.reg = PAD_DIRECTION_SEL_0,
1652 		.mask = PMX_SMI_MASK,
1653 		.val = PMX_SMI_MASK,
1654 	},
1655 };
1656 
1657 static struct spear_modemux i2c_4_5_dis_smi_modemux[] = {
1658 	{
1659 		.muxregs = i2c_4_5_dis_smi_muxreg,
1660 		.nmuxregs = ARRAY_SIZE(i2c_4_5_dis_smi_muxreg),
1661 	},
1662 };
1663 
1664 static struct spear_pingroup i2c_4_5_dis_smi_pingroup = {
1665 	.name = "i2c_4_5_dis_smi_grp",
1666 	.pins = i2c_4_5_dis_smi_pins,
1667 	.npins = ARRAY_SIZE(i2c_4_5_dis_smi_pins),
1668 	.modemuxs = i2c_4_5_dis_smi_modemux,
1669 	.nmodemuxs = ARRAY_SIZE(i2c_4_5_dis_smi_modemux),
1670 };
1671 
1672 /* Pad multiplexing for i2c4_dis_sd device */
1673 /* Muxed with SD/MMC */
1674 static const unsigned i2c4_dis_sd_pins[] = { 217, 218 };
1675 static struct spear_muxreg i2c4_dis_sd_muxreg[] = {
1676 	{
1677 		.reg = PAD_FUNCTION_EN_1,
1678 		.mask = PMX_MCIDATA4_MASK,
1679 		.val = 0,
1680 	}, {
1681 		.reg = PAD_FUNCTION_EN_2,
1682 		.mask = PMX_MCIDATA5_MASK,
1683 		.val = 0,
1684 	}, {
1685 		.reg = PAD_DIRECTION_SEL_1,
1686 		.mask = PMX_MCIDATA4_MASK,
1687 		.val = PMX_MCIDATA4_MASK,
1688 	}, {
1689 		.reg = PAD_DIRECTION_SEL_2,
1690 		.mask = PMX_MCIDATA5_MASK,
1691 		.val = PMX_MCIDATA5_MASK,
1692 	},
1693 };
1694 
1695 static struct spear_modemux i2c4_dis_sd_modemux[] = {
1696 	{
1697 		.muxregs = i2c4_dis_sd_muxreg,
1698 		.nmuxregs = ARRAY_SIZE(i2c4_dis_sd_muxreg),
1699 	},
1700 };
1701 
1702 static struct spear_pingroup i2c4_dis_sd_pingroup = {
1703 	.name = "i2c4_dis_sd_grp",
1704 	.pins = i2c4_dis_sd_pins,
1705 	.npins = ARRAY_SIZE(i2c4_dis_sd_pins),
1706 	.modemuxs = i2c4_dis_sd_modemux,
1707 	.nmodemuxs = ARRAY_SIZE(i2c4_dis_sd_modemux),
1708 };
1709 
1710 /* Pad multiplexing for i2c5_dis_sd device */
1711 /* Muxed with SD/MMC */
1712 static const unsigned i2c5_dis_sd_pins[] = { 219, 220 };
1713 static struct spear_muxreg i2c5_dis_sd_muxreg[] = {
1714 	{
1715 		.reg = PAD_FUNCTION_EN_2,
1716 		.mask = PMX_MCIDATA6_MASK |
1717 			PMX_MCIDATA7_MASK,
1718 		.val = 0,
1719 	}, {
1720 		.reg = PAD_DIRECTION_SEL_2,
1721 		.mask = PMX_MCIDATA6_MASK |
1722 			PMX_MCIDATA7_MASK,
1723 		.val = PMX_MCIDATA6_MASK |
1724 			PMX_MCIDATA7_MASK,
1725 	},
1726 };
1727 
1728 static struct spear_modemux i2c5_dis_sd_modemux[] = {
1729 	{
1730 		.muxregs = i2c5_dis_sd_muxreg,
1731 		.nmuxregs = ARRAY_SIZE(i2c5_dis_sd_muxreg),
1732 	},
1733 };
1734 
1735 static struct spear_pingroup i2c5_dis_sd_pingroup = {
1736 	.name = "i2c5_dis_sd_grp",
1737 	.pins = i2c5_dis_sd_pins,
1738 	.npins = ARRAY_SIZE(i2c5_dis_sd_pins),
1739 	.modemuxs = i2c5_dis_sd_modemux,
1740 	.nmodemuxs = ARRAY_SIZE(i2c5_dis_sd_modemux),
1741 };
1742 
1743 static const char *const i2c_4_5_grps[] = { "i2c5_dis_sd_grp",
1744 	"i2c4_dis_sd_grp", "i2c_4_5_dis_smi_grp" };
1745 static struct spear_function i2c_4_5_function = {
1746 	.name = "i2c_4_5",
1747 	.groups = i2c_4_5_grps,
1748 	.ngroups = ARRAY_SIZE(i2c_4_5_grps),
1749 };
1750 
1751 /* Pad multiplexing for i2c_6_7_dis_kbd device */
1752 /* Muxed with KBD */
1753 static const unsigned i2c_6_7_dis_kbd_pins[] = { 207, 208, 209, 210 };
1754 static struct spear_muxreg i2c_6_7_dis_kbd_muxreg[] = {
1755 	{
1756 		.reg = PAD_FUNCTION_EN_1,
1757 		.mask = PMX_KBD_ROWCOL25_MASK,
1758 		.val = 0,
1759 	}, {
1760 		.reg = PAD_DIRECTION_SEL_1,
1761 		.mask = PMX_KBD_ROWCOL25_MASK,
1762 		.val = PMX_KBD_ROWCOL25_MASK,
1763 	},
1764 };
1765 
1766 static struct spear_modemux i2c_6_7_dis_kbd_modemux[] = {
1767 	{
1768 		.muxregs = i2c_6_7_dis_kbd_muxreg,
1769 		.nmuxregs = ARRAY_SIZE(i2c_6_7_dis_kbd_muxreg),
1770 	},
1771 };
1772 
1773 static struct spear_pingroup i2c_6_7_dis_kbd_pingroup = {
1774 	.name = "i2c_6_7_dis_kbd_grp",
1775 	.pins = i2c_6_7_dis_kbd_pins,
1776 	.npins = ARRAY_SIZE(i2c_6_7_dis_kbd_pins),
1777 	.modemuxs = i2c_6_7_dis_kbd_modemux,
1778 	.nmodemuxs = ARRAY_SIZE(i2c_6_7_dis_kbd_modemux),
1779 };
1780 
1781 /* Pad multiplexing for i2c6_dis_sd device */
1782 /* Muxed with SD/MMC */
1783 static const unsigned i2c6_dis_sd_pins[] = { 236, 237 };
1784 static struct spear_muxreg i2c6_dis_sd_muxreg[] = {
1785 	{
1786 		.reg = PAD_FUNCTION_EN_2,
1787 		.mask = PMX_MCIIORDRE_MASK |
1788 			PMX_MCIIOWRWE_MASK,
1789 		.val = 0,
1790 	}, {
1791 		.reg = PAD_DIRECTION_SEL_2,
1792 		.mask = PMX_MCIIORDRE_MASK |
1793 			PMX_MCIIOWRWE_MASK,
1794 		.val = PMX_MCIIORDRE_MASK |
1795 			PMX_MCIIOWRWE_MASK,
1796 	},
1797 };
1798 
1799 static struct spear_modemux i2c6_dis_sd_modemux[] = {
1800 	{
1801 		.muxregs = i2c6_dis_sd_muxreg,
1802 		.nmuxregs = ARRAY_SIZE(i2c6_dis_sd_muxreg),
1803 	},
1804 };
1805 
1806 static struct spear_pingroup i2c6_dis_sd_pingroup = {
1807 	.name = "i2c6_dis_sd_grp",
1808 	.pins = i2c6_dis_sd_pins,
1809 	.npins = ARRAY_SIZE(i2c6_dis_sd_pins),
1810 	.modemuxs = i2c6_dis_sd_modemux,
1811 	.nmodemuxs = ARRAY_SIZE(i2c6_dis_sd_modemux),
1812 };
1813 
1814 /* Pad multiplexing for i2c7_dis_sd device */
1815 static const unsigned i2c7_dis_sd_pins[] = { 238, 239 };
1816 static struct spear_muxreg i2c7_dis_sd_muxreg[] = {
1817 	{
1818 		.reg = PAD_FUNCTION_EN_2,
1819 		.mask = PMX_MCIRESETCF_MASK |
1820 			PMX_MCICS0CE_MASK,
1821 		.val = 0,
1822 	}, {
1823 		.reg = PAD_DIRECTION_SEL_2,
1824 		.mask = PMX_MCIRESETCF_MASK |
1825 			PMX_MCICS0CE_MASK,
1826 		.val = PMX_MCIRESETCF_MASK |
1827 			PMX_MCICS0CE_MASK,
1828 	},
1829 };
1830 
1831 static struct spear_modemux i2c7_dis_sd_modemux[] = {
1832 	{
1833 		.muxregs = i2c7_dis_sd_muxreg,
1834 		.nmuxregs = ARRAY_SIZE(i2c7_dis_sd_muxreg),
1835 	},
1836 };
1837 
1838 static struct spear_pingroup i2c7_dis_sd_pingroup = {
1839 	.name = "i2c7_dis_sd_grp",
1840 	.pins = i2c7_dis_sd_pins,
1841 	.npins = ARRAY_SIZE(i2c7_dis_sd_pins),
1842 	.modemuxs = i2c7_dis_sd_modemux,
1843 	.nmodemuxs = ARRAY_SIZE(i2c7_dis_sd_modemux),
1844 };
1845 
1846 static const char *const i2c_6_7_grps[] = { "i2c6_dis_sd_grp",
1847 	"i2c7_dis_sd_grp", "i2c_6_7_dis_kbd_grp" };
1848 static struct spear_function i2c_6_7_function = {
1849 	.name = "i2c_6_7",
1850 	.groups = i2c_6_7_grps,
1851 	.ngroups = ARRAY_SIZE(i2c_6_7_grps),
1852 };
1853 
1854 /* Pad multiplexing for can0_dis_nor device */
1855 /* Muxed with NOR */
1856 static const unsigned can0_dis_nor_pins[] = { 56, 57 };
1857 static struct spear_muxreg can0_dis_nor_muxreg[] = {
1858 	{
1859 		.reg = PAD_FUNCTION_EN_0,
1860 		.mask = PMX_NFRSTPWDWN2_MASK,
1861 		.val = 0,
1862 	}, {
1863 		.reg = PAD_FUNCTION_EN_1,
1864 		.mask = PMX_NFRSTPWDWN3_MASK,
1865 		.val = 0,
1866 	}, {
1867 		.reg = PAD_DIRECTION_SEL_0,
1868 		.mask = PMX_NFRSTPWDWN2_MASK,
1869 		.val = PMX_NFRSTPWDWN2_MASK,
1870 	}, {
1871 		.reg = PAD_DIRECTION_SEL_1,
1872 		.mask = PMX_NFRSTPWDWN3_MASK,
1873 		.val = PMX_NFRSTPWDWN3_MASK,
1874 	},
1875 };
1876 
1877 static struct spear_modemux can0_dis_nor_modemux[] = {
1878 	{
1879 		.muxregs = can0_dis_nor_muxreg,
1880 		.nmuxregs = ARRAY_SIZE(can0_dis_nor_muxreg),
1881 	},
1882 };
1883 
1884 static struct spear_pingroup can0_dis_nor_pingroup = {
1885 	.name = "can0_dis_nor_grp",
1886 	.pins = can0_dis_nor_pins,
1887 	.npins = ARRAY_SIZE(can0_dis_nor_pins),
1888 	.modemuxs = can0_dis_nor_modemux,
1889 	.nmodemuxs = ARRAY_SIZE(can0_dis_nor_modemux),
1890 };
1891 
1892 /* Pad multiplexing for can0_dis_sd device */
1893 /* Muxed with SD/MMC */
1894 static const unsigned can0_dis_sd_pins[] = { 240, 241 };
1895 static struct spear_muxreg can0_dis_sd_muxreg[] = {
1896 	{
1897 		.reg = PAD_FUNCTION_EN_2,
1898 		.mask = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
1899 		.val = 0,
1900 	}, {
1901 		.reg = PAD_DIRECTION_SEL_2,
1902 		.mask = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
1903 		.val = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
1904 	},
1905 };
1906 
1907 static struct spear_modemux can0_dis_sd_modemux[] = {
1908 	{
1909 		.muxregs = can0_dis_sd_muxreg,
1910 		.nmuxregs = ARRAY_SIZE(can0_dis_sd_muxreg),
1911 	},
1912 };
1913 
1914 static struct spear_pingroup can0_dis_sd_pingroup = {
1915 	.name = "can0_dis_sd_grp",
1916 	.pins = can0_dis_sd_pins,
1917 	.npins = ARRAY_SIZE(can0_dis_sd_pins),
1918 	.modemuxs = can0_dis_sd_modemux,
1919 	.nmodemuxs = ARRAY_SIZE(can0_dis_sd_modemux),
1920 };
1921 
1922 static const char *const can0_grps[] = { "can0_dis_nor_grp", "can0_dis_sd_grp"
1923 };
1924 static struct spear_function can0_function = {
1925 	.name = "can0",
1926 	.groups = can0_grps,
1927 	.ngroups = ARRAY_SIZE(can0_grps),
1928 };
1929 
1930 /* Pad multiplexing for can1_dis_sd device */
1931 /* Muxed with SD/MMC */
1932 static const unsigned can1_dis_sd_pins[] = { 242, 243 };
1933 static struct spear_muxreg can1_dis_sd_muxreg[] = {
1934 	{
1935 		.reg = PAD_FUNCTION_EN_2,
1936 		.mask = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
1937 		.val = 0,
1938 	}, {
1939 		.reg = PAD_DIRECTION_SEL_2,
1940 		.mask = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
1941 		.val = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
1942 	},
1943 };
1944 
1945 static struct spear_modemux can1_dis_sd_modemux[] = {
1946 	{
1947 		.muxregs = can1_dis_sd_muxreg,
1948 		.nmuxregs = ARRAY_SIZE(can1_dis_sd_muxreg),
1949 	},
1950 };
1951 
1952 static struct spear_pingroup can1_dis_sd_pingroup = {
1953 	.name = "can1_dis_sd_grp",
1954 	.pins = can1_dis_sd_pins,
1955 	.npins = ARRAY_SIZE(can1_dis_sd_pins),
1956 	.modemuxs = can1_dis_sd_modemux,
1957 	.nmodemuxs = ARRAY_SIZE(can1_dis_sd_modemux),
1958 };
1959 
1960 /* Pad multiplexing for can1_dis_kbd device */
1961 /* Muxed with KBD */
1962 static const unsigned can1_dis_kbd_pins[] = { 201, 202 };
1963 static struct spear_muxreg can1_dis_kbd_muxreg[] = {
1964 	{
1965 		.reg = PAD_FUNCTION_EN_1,
1966 		.mask = PMX_KBD_ROWCOL25_MASK,
1967 		.val = 0,
1968 	}, {
1969 		.reg = PAD_DIRECTION_SEL_1,
1970 		.mask = PMX_KBD_ROWCOL25_MASK,
1971 		.val = PMX_KBD_ROWCOL25_MASK,
1972 	},
1973 };
1974 
1975 static struct spear_modemux can1_dis_kbd_modemux[] = {
1976 	{
1977 		.muxregs = can1_dis_kbd_muxreg,
1978 		.nmuxregs = ARRAY_SIZE(can1_dis_kbd_muxreg),
1979 	},
1980 };
1981 
1982 static struct spear_pingroup can1_dis_kbd_pingroup = {
1983 	.name = "can1_dis_kbd_grp",
1984 	.pins = can1_dis_kbd_pins,
1985 	.npins = ARRAY_SIZE(can1_dis_kbd_pins),
1986 	.modemuxs = can1_dis_kbd_modemux,
1987 	.nmodemuxs = ARRAY_SIZE(can1_dis_kbd_modemux),
1988 };
1989 
1990 static const char *const can1_grps[] = { "can1_dis_sd_grp", "can1_dis_kbd_grp"
1991 };
1992 static struct spear_function can1_function = {
1993 	.name = "can1",
1994 	.groups = can1_grps,
1995 	.ngroups = ARRAY_SIZE(can1_grps),
1996 };
1997 
1998 /* Pad multiplexing for (ras-ip) pci device */
1999 static const unsigned pci_pins[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18,
2000 	19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
2001 	37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
2002 	55, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 };
2003 
2004 static struct spear_muxreg pci_muxreg[] = {
2005 	{
2006 		.reg = PAD_FUNCTION_EN_0,
2007 		.mask = PMX_MCI_DATA8_15_MASK,
2008 		.val = 0,
2009 	}, {
2010 		.reg = PAD_FUNCTION_EN_1,
2011 		.mask = PMX_PCI_REG1_MASK,
2012 		.val = 0,
2013 	}, {
2014 		.reg = PAD_FUNCTION_EN_2,
2015 		.mask = PMX_PCI_REG2_MASK,
2016 		.val = 0,
2017 	}, {
2018 		.reg = PAD_DIRECTION_SEL_0,
2019 		.mask = PMX_MCI_DATA8_15_MASK,
2020 		.val = PMX_MCI_DATA8_15_MASK,
2021 	}, {
2022 		.reg = PAD_DIRECTION_SEL_1,
2023 		.mask = PMX_PCI_REG1_MASK,
2024 		.val = PMX_PCI_REG1_MASK,
2025 	}, {
2026 		.reg = PAD_DIRECTION_SEL_2,
2027 		.mask = PMX_PCI_REG2_MASK,
2028 		.val = PMX_PCI_REG2_MASK,
2029 	},
2030 };
2031 
2032 static struct spear_modemux pci_modemux[] = {
2033 	{
2034 		.muxregs = pci_muxreg,
2035 		.nmuxregs = ARRAY_SIZE(pci_muxreg),
2036 	},
2037 };
2038 
2039 static struct spear_pingroup pci_pingroup = {
2040 	.name = "pci_grp",
2041 	.pins = pci_pins,
2042 	.npins = ARRAY_SIZE(pci_pins),
2043 	.modemuxs = pci_modemux,
2044 	.nmodemuxs = ARRAY_SIZE(pci_modemux),
2045 };
2046 
2047 static const char *const pci_grps[] = { "pci_grp" };
2048 static struct spear_function pci_function = {
2049 	.name = "pci",
2050 	.groups = pci_grps,
2051 	.ngroups = ARRAY_SIZE(pci_grps),
2052 };
2053 
2054 /* pad multiplexing for (fix-part) pcie0 device */
2055 static struct spear_muxreg pcie0_muxreg[] = {
2056 	{
2057 		.reg = PCIE_SATA_CFG,
2058 		.mask = PCIE_CFG_VAL(0),
2059 		.val = PCIE_CFG_VAL(0),
2060 	},
2061 };
2062 
2063 static struct spear_modemux pcie0_modemux[] = {
2064 	{
2065 		.muxregs = pcie0_muxreg,
2066 		.nmuxregs = ARRAY_SIZE(pcie0_muxreg),
2067 	},
2068 };
2069 
2070 static struct spear_pingroup pcie0_pingroup = {
2071 	.name = "pcie0_grp",
2072 	.modemuxs = pcie0_modemux,
2073 	.nmodemuxs = ARRAY_SIZE(pcie0_modemux),
2074 };
2075 
2076 /* pad multiplexing for (fix-part) pcie1 device */
2077 static struct spear_muxreg pcie1_muxreg[] = {
2078 	{
2079 		.reg = PCIE_SATA_CFG,
2080 		.mask = PCIE_CFG_VAL(1),
2081 		.val = PCIE_CFG_VAL(1),
2082 	},
2083 };
2084 
2085 static struct spear_modemux pcie1_modemux[] = {
2086 	{
2087 		.muxregs = pcie1_muxreg,
2088 		.nmuxregs = ARRAY_SIZE(pcie1_muxreg),
2089 	},
2090 };
2091 
2092 static struct spear_pingroup pcie1_pingroup = {
2093 	.name = "pcie1_grp",
2094 	.modemuxs = pcie1_modemux,
2095 	.nmodemuxs = ARRAY_SIZE(pcie1_modemux),
2096 };
2097 
2098 /* pad multiplexing for (fix-part) pcie2 device */
2099 static struct spear_muxreg pcie2_muxreg[] = {
2100 	{
2101 		.reg = PCIE_SATA_CFG,
2102 		.mask = PCIE_CFG_VAL(2),
2103 		.val = PCIE_CFG_VAL(2),
2104 	},
2105 };
2106 
2107 static struct spear_modemux pcie2_modemux[] = {
2108 	{
2109 		.muxregs = pcie2_muxreg,
2110 		.nmuxregs = ARRAY_SIZE(pcie2_muxreg),
2111 	},
2112 };
2113 
2114 static struct spear_pingroup pcie2_pingroup = {
2115 	.name = "pcie2_grp",
2116 	.modemuxs = pcie2_modemux,
2117 	.nmodemuxs = ARRAY_SIZE(pcie2_modemux),
2118 };
2119 
2120 static const char *const pcie_grps[] = { "pcie0_grp", "pcie1_grp", "pcie2_grp"
2121 };
2122 static struct spear_function pcie_function = {
2123 	.name = "pci_express",
2124 	.groups = pcie_grps,
2125 	.ngroups = ARRAY_SIZE(pcie_grps),
2126 };
2127 
2128 /* pad multiplexing for sata0 device */
2129 static struct spear_muxreg sata0_muxreg[] = {
2130 	{
2131 		.reg = PCIE_SATA_CFG,
2132 		.mask = SATA_CFG_VAL(0),
2133 		.val = SATA_CFG_VAL(0),
2134 	},
2135 };
2136 
2137 static struct spear_modemux sata0_modemux[] = {
2138 	{
2139 		.muxregs = sata0_muxreg,
2140 		.nmuxregs = ARRAY_SIZE(sata0_muxreg),
2141 	},
2142 };
2143 
2144 static struct spear_pingroup sata0_pingroup = {
2145 	.name = "sata0_grp",
2146 	.modemuxs = sata0_modemux,
2147 	.nmodemuxs = ARRAY_SIZE(sata0_modemux),
2148 };
2149 
2150 /* pad multiplexing for sata1 device */
2151 static struct spear_muxreg sata1_muxreg[] = {
2152 	{
2153 		.reg = PCIE_SATA_CFG,
2154 		.mask = SATA_CFG_VAL(1),
2155 		.val = SATA_CFG_VAL(1),
2156 	},
2157 };
2158 
2159 static struct spear_modemux sata1_modemux[] = {
2160 	{
2161 		.muxregs = sata1_muxreg,
2162 		.nmuxregs = ARRAY_SIZE(sata1_muxreg),
2163 	},
2164 };
2165 
2166 static struct spear_pingroup sata1_pingroup = {
2167 	.name = "sata1_grp",
2168 	.modemuxs = sata1_modemux,
2169 	.nmodemuxs = ARRAY_SIZE(sata1_modemux),
2170 };
2171 
2172 /* pad multiplexing for sata2 device */
2173 static struct spear_muxreg sata2_muxreg[] = {
2174 	{
2175 		.reg = PCIE_SATA_CFG,
2176 		.mask = SATA_CFG_VAL(2),
2177 		.val = SATA_CFG_VAL(2),
2178 	},
2179 };
2180 
2181 static struct spear_modemux sata2_modemux[] = {
2182 	{
2183 		.muxregs = sata2_muxreg,
2184 		.nmuxregs = ARRAY_SIZE(sata2_muxreg),
2185 	},
2186 };
2187 
2188 static struct spear_pingroup sata2_pingroup = {
2189 	.name = "sata2_grp",
2190 	.modemuxs = sata2_modemux,
2191 	.nmodemuxs = ARRAY_SIZE(sata2_modemux),
2192 };
2193 
2194 static const char *const sata_grps[] = { "sata0_grp", "sata1_grp", "sata2_grp"
2195 };
2196 static struct spear_function sata_function = {
2197 	.name = "sata",
2198 	.groups = sata_grps,
2199 	.ngroups = ARRAY_SIZE(sata_grps),
2200 };
2201 
2202 /* Pad multiplexing for ssp1_dis_kbd device */
2203 static const unsigned ssp1_dis_kbd_pins[] = { 203, 204, 205, 206 };
2204 static struct spear_muxreg ssp1_dis_kbd_muxreg[] = {
2205 	{
2206 		.reg = PAD_FUNCTION_EN_1,
2207 		.mask = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
2208 			PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
2209 			PMX_NFCE2_MASK,
2210 		.val = 0,
2211 	}, {
2212 		.reg = PAD_DIRECTION_SEL_1,
2213 		.mask = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
2214 			PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
2215 			PMX_NFCE2_MASK,
2216 		.val = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
2217 			PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
2218 			PMX_NFCE2_MASK,
2219 	},
2220 };
2221 
2222 static struct spear_modemux ssp1_dis_kbd_modemux[] = {
2223 	{
2224 		.muxregs = ssp1_dis_kbd_muxreg,
2225 		.nmuxregs = ARRAY_SIZE(ssp1_dis_kbd_muxreg),
2226 	},
2227 };
2228 
2229 static struct spear_pingroup ssp1_dis_kbd_pingroup = {
2230 	.name = "ssp1_dis_kbd_grp",
2231 	.pins = ssp1_dis_kbd_pins,
2232 	.npins = ARRAY_SIZE(ssp1_dis_kbd_pins),
2233 	.modemuxs = ssp1_dis_kbd_modemux,
2234 	.nmodemuxs = ARRAY_SIZE(ssp1_dis_kbd_modemux),
2235 };
2236 
2237 /* Pad multiplexing for ssp1_dis_sd device */
2238 static const unsigned ssp1_dis_sd_pins[] = { 224, 226, 227, 228 };
2239 static struct spear_muxreg ssp1_dis_sd_muxreg[] = {
2240 	{
2241 		.reg = PAD_FUNCTION_EN_2,
2242 		.mask = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
2243 			PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
2244 		.val = 0,
2245 	}, {
2246 		.reg = PAD_DIRECTION_SEL_2,
2247 		.mask = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
2248 			PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
2249 		.val = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
2250 			PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
2251 	},
2252 };
2253 
2254 static struct spear_modemux ssp1_dis_sd_modemux[] = {
2255 	{
2256 		.muxregs = ssp1_dis_sd_muxreg,
2257 		.nmuxregs = ARRAY_SIZE(ssp1_dis_sd_muxreg),
2258 	},
2259 };
2260 
2261 static struct spear_pingroup ssp1_dis_sd_pingroup = {
2262 	.name = "ssp1_dis_sd_grp",
2263 	.pins = ssp1_dis_sd_pins,
2264 	.npins = ARRAY_SIZE(ssp1_dis_sd_pins),
2265 	.modemuxs = ssp1_dis_sd_modemux,
2266 	.nmodemuxs = ARRAY_SIZE(ssp1_dis_sd_modemux),
2267 };
2268 
2269 static const char *const ssp1_grps[] = { "ssp1_dis_kbd_grp",
2270 	"ssp1_dis_sd_grp" };
2271 static struct spear_function ssp1_function = {
2272 	.name = "ssp1",
2273 	.groups = ssp1_grps,
2274 	.ngroups = ARRAY_SIZE(ssp1_grps),
2275 };
2276 
2277 /* Pad multiplexing for gpt64 device */
2278 static const unsigned gpt64_pins[] = { 230, 231, 232, 245 };
2279 static struct spear_muxreg gpt64_muxreg[] = {
2280 	{
2281 		.reg = PAD_FUNCTION_EN_2,
2282 		.mask = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
2283 			| PMX_MCILEDS_MASK,
2284 		.val = 0,
2285 	}, {
2286 		.reg = PAD_DIRECTION_SEL_2,
2287 		.mask = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
2288 			| PMX_MCILEDS_MASK,
2289 		.val = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
2290 			| PMX_MCILEDS_MASK,
2291 	},
2292 };
2293 
2294 static struct spear_modemux gpt64_modemux[] = {
2295 	{
2296 		.muxregs = gpt64_muxreg,
2297 		.nmuxregs = ARRAY_SIZE(gpt64_muxreg),
2298 	},
2299 };
2300 
2301 static struct spear_pingroup gpt64_pingroup = {
2302 	.name = "gpt64_grp",
2303 	.pins = gpt64_pins,
2304 	.npins = ARRAY_SIZE(gpt64_pins),
2305 	.modemuxs = gpt64_modemux,
2306 	.nmodemuxs = ARRAY_SIZE(gpt64_modemux),
2307 };
2308 
2309 static const char *const gpt64_grps[] = { "gpt64_grp" };
2310 static struct spear_function gpt64_function = {
2311 	.name = "gpt64",
2312 	.groups = gpt64_grps,
2313 	.ngroups = ARRAY_SIZE(gpt64_grps),
2314 };
2315 
2316 /* pingroups */
2317 static struct spear_pingroup *spear1310_pingroups[] = {
2318 	&i2c0_pingroup,
2319 	&ssp0_pingroup,
2320 	&i2s0_pingroup,
2321 	&i2s1_pingroup,
2322 	&clcd_pingroup,
2323 	&clcd_high_res_pingroup,
2324 	&arm_gpio_pingroup,
2325 	&smi_2_chips_pingroup,
2326 	&smi_4_chips_pingroup,
2327 	&gmii_pingroup,
2328 	&rgmii_pingroup,
2329 	&smii_0_1_2_pingroup,
2330 	&ras_mii_txclk_pingroup,
2331 	&nand_8bit_pingroup,
2332 	&nand_16bit_pingroup,
2333 	&nand_4_chips_pingroup,
2334 	&keyboard_6x6_pingroup,
2335 	&keyboard_rowcol6_8_pingroup,
2336 	&uart0_pingroup,
2337 	&uart0_modem_pingroup,
2338 	&gpt0_tmr0_pingroup,
2339 	&gpt0_tmr1_pingroup,
2340 	&gpt1_tmr0_pingroup,
2341 	&gpt1_tmr1_pingroup,
2342 	&sdhci_pingroup,
2343 	&cf_pingroup,
2344 	&xd_pingroup,
2345 	&touch_xy_pingroup,
2346 	&ssp0_cs0_pingroup,
2347 	&ssp0_cs1_2_pingroup,
2348 	&uart_1_dis_i2c_pingroup,
2349 	&uart_1_dis_sd_pingroup,
2350 	&uart_2_3_pingroup,
2351 	&uart_4_pingroup,
2352 	&uart_5_pingroup,
2353 	&rs485_0_1_tdm_0_1_pingroup,
2354 	&i2c_1_2_pingroup,
2355 	&i2c3_dis_smi_clcd_pingroup,
2356 	&i2c3_dis_sd_i2s0_pingroup,
2357 	&i2c_4_5_dis_smi_pingroup,
2358 	&i2c4_dis_sd_pingroup,
2359 	&i2c5_dis_sd_pingroup,
2360 	&i2c_6_7_dis_kbd_pingroup,
2361 	&i2c6_dis_sd_pingroup,
2362 	&i2c7_dis_sd_pingroup,
2363 	&can0_dis_nor_pingroup,
2364 	&can0_dis_sd_pingroup,
2365 	&can1_dis_sd_pingroup,
2366 	&can1_dis_kbd_pingroup,
2367 	&pci_pingroup,
2368 	&pcie0_pingroup,
2369 	&pcie1_pingroup,
2370 	&pcie2_pingroup,
2371 	&sata0_pingroup,
2372 	&sata1_pingroup,
2373 	&sata2_pingroup,
2374 	&ssp1_dis_kbd_pingroup,
2375 	&ssp1_dis_sd_pingroup,
2376 	&gpt64_pingroup,
2377 };
2378 
2379 /* functions */
2380 static struct spear_function *spear1310_functions[] = {
2381 	&i2c0_function,
2382 	&ssp0_function,
2383 	&i2s0_function,
2384 	&i2s1_function,
2385 	&clcd_function,
2386 	&arm_gpio_function,
2387 	&smi_function,
2388 	&gmii_function,
2389 	&rgmii_function,
2390 	&smii_0_1_2_function,
2391 	&ras_mii_txclk_function,
2392 	&nand_function,
2393 	&keyboard_function,
2394 	&uart0_function,
2395 	&gpt0_function,
2396 	&gpt1_function,
2397 	&sdhci_function,
2398 	&cf_function,
2399 	&xd_function,
2400 	&touch_xy_function,
2401 	&uart1_function,
2402 	&uart2_3_function,
2403 	&uart4_function,
2404 	&uart5_function,
2405 	&rs485_0_1_tdm_0_1_function,
2406 	&i2c_1_2_function,
2407 	&i2c3_unction,
2408 	&i2c_4_5_function,
2409 	&i2c_6_7_function,
2410 	&can0_function,
2411 	&can1_function,
2412 	&pci_function,
2413 	&pcie_function,
2414 	&sata_function,
2415 	&ssp1_function,
2416 	&gpt64_function,
2417 };
2418 
2419 static const unsigned pin18[] = { 18, };
2420 static const unsigned pin19[] = { 19, };
2421 static const unsigned pin20[] = { 20, };
2422 static const unsigned pin21[] = { 21, };
2423 static const unsigned pin22[] = { 22, };
2424 static const unsigned pin23[] = { 23, };
2425 static const unsigned pin54[] = { 54, };
2426 static const unsigned pin55[] = { 55, };
2427 static const unsigned pin56[] = { 56, };
2428 static const unsigned pin57[] = { 57, };
2429 static const unsigned pin58[] = { 58, };
2430 static const unsigned pin59[] = { 59, };
2431 static const unsigned pin60[] = { 60, };
2432 static const unsigned pin61[] = { 61, };
2433 static const unsigned pin62[] = { 62, };
2434 static const unsigned pin63[] = { 63, };
2435 static const unsigned pin143[] = { 143, };
2436 static const unsigned pin144[] = { 144, };
2437 static const unsigned pin145[] = { 145, };
2438 static const unsigned pin146[] = { 146, };
2439 static const unsigned pin147[] = { 147, };
2440 static const unsigned pin148[] = { 148, };
2441 static const unsigned pin149[] = { 149, };
2442 static const unsigned pin150[] = { 150, };
2443 static const unsigned pin151[] = { 151, };
2444 static const unsigned pin152[] = { 152, };
2445 static const unsigned pin205[] = { 205, };
2446 static const unsigned pin206[] = { 206, };
2447 static const unsigned pin211[] = { 211, };
2448 static const unsigned pin212[] = { 212, };
2449 static const unsigned pin213[] = { 213, };
2450 static const unsigned pin214[] = { 214, };
2451 static const unsigned pin215[] = { 215, };
2452 static const unsigned pin216[] = { 216, };
2453 static const unsigned pin217[] = { 217, };
2454 static const unsigned pin218[] = { 218, };
2455 static const unsigned pin219[] = { 219, };
2456 static const unsigned pin220[] = { 220, };
2457 static const unsigned pin221[] = { 221, };
2458 static const unsigned pin222[] = { 222, };
2459 static const unsigned pin223[] = { 223, };
2460 static const unsigned pin224[] = { 224, };
2461 static const unsigned pin225[] = { 225, };
2462 static const unsigned pin226[] = { 226, };
2463 static const unsigned pin227[] = { 227, };
2464 static const unsigned pin228[] = { 228, };
2465 static const unsigned pin229[] = { 229, };
2466 static const unsigned pin230[] = { 230, };
2467 static const unsigned pin231[] = { 231, };
2468 static const unsigned pin232[] = { 232, };
2469 static const unsigned pin233[] = { 233, };
2470 static const unsigned pin234[] = { 234, };
2471 static const unsigned pin235[] = { 235, };
2472 static const unsigned pin236[] = { 236, };
2473 static const unsigned pin237[] = { 237, };
2474 static const unsigned pin238[] = { 238, };
2475 static const unsigned pin239[] = { 239, };
2476 static const unsigned pin240[] = { 240, };
2477 static const unsigned pin241[] = { 241, };
2478 static const unsigned pin242[] = { 242, };
2479 static const unsigned pin243[] = { 243, };
2480 static const unsigned pin244[] = { 244, };
2481 static const unsigned pin245[] = { 245, };
2482 
2483 static const unsigned pin_grp0[] = { 173, 174, };
2484 static const unsigned pin_grp1[] = { 175, 185, 188, 197, 198, };
2485 static const unsigned pin_grp2[] = { 176, 177, 178, 179, 184, 186, 187, 189,
2486 	190, 191, 192, };
2487 static const unsigned pin_grp3[] = { 180, 181, 182, 183, 193, 194, 195, 196, };
2488 static const unsigned pin_grp4[] = { 199, 200, };
2489 static const unsigned pin_grp5[] = { 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
2490 	75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, };
2491 static const unsigned pin_grp6[] = { 86, 87, 88, 89, 90, 91, 92, 93, };
2492 static const unsigned pin_grp7[] = { 98, 99, };
2493 static const unsigned pin_grp8[] = { 158, 159, 160, 161, 162, 163, 164, 165,
2494 	166, 167, 168, 169, 170, 171, 172, };
2495 
2496 /* Define muxreg arrays */
2497 DEFINE_2_MUXREG(i2c0_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_I2C0_MASK, 0, 1);
2498 DEFINE_2_MUXREG(ssp0_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_SSP0_MASK, 0, 1);
2499 DEFINE_2_MUXREG(ssp0_cs0_pins, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_SSP0_CS0_MASK, 0, 1);
2500 DEFINE_2_MUXREG(ssp0_cs1_2_pins, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_SSP0_CS1_2_MASK, 0, 1);
2501 DEFINE_2_MUXREG(i2s0_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_I2S0_MASK, 0, 1);
2502 DEFINE_2_MUXREG(i2s1_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_I2S1_MASK, 0, 1);
2503 DEFINE_2_MUXREG(clcd_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_CLCD1_MASK, 0, 1);
2504 DEFINE_2_MUXREG(clcd_high_res_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_CLCD2_MASK, 0, 1);
2505 DEFINE_2_MUXREG(pin18, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO15_MASK, 0, 1);
2506 DEFINE_2_MUXREG(pin19, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO14_MASK, 0, 1);
2507 DEFINE_2_MUXREG(pin20, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO13_MASK, 0, 1);
2508 DEFINE_2_MUXREG(pin21, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO12_MASK, 0, 1);
2509 DEFINE_2_MUXREG(pin22, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO11_MASK, 0, 1);
2510 DEFINE_2_MUXREG(pin23, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO10_MASK, 0, 1);
2511 DEFINE_2_MUXREG(pin143, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO00_MASK, 0, 1);
2512 DEFINE_2_MUXREG(pin144, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO01_MASK, 0, 1);
2513 DEFINE_2_MUXREG(pin145, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO02_MASK, 0, 1);
2514 DEFINE_2_MUXREG(pin146, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO03_MASK, 0, 1);
2515 DEFINE_2_MUXREG(pin147, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO04_MASK, 0, 1);
2516 DEFINE_2_MUXREG(pin148, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO05_MASK, 0, 1);
2517 DEFINE_2_MUXREG(pin149, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO06_MASK, 0, 1);
2518 DEFINE_2_MUXREG(pin150, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO07_MASK, 0, 1);
2519 DEFINE_2_MUXREG(pin151, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO08_MASK, 0, 1);
2520 DEFINE_2_MUXREG(pin152, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_EGPIO09_MASK, 0, 1);
2521 DEFINE_2_MUXREG(smi_2_chips_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_SMI_MASK, 0, 1);
2522 DEFINE_2_MUXREG(pin54, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_SMINCS3_MASK, 0, 1);
2523 DEFINE_2_MUXREG(pin55, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_SMINCS2_MASK, 0, 1);
2524 DEFINE_2_MUXREG(pin56, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_NFRSTPWDWN3_MASK, 0, 1);
2525 DEFINE_2_MUXREG(pin57, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFRSTPWDWN2_MASK, 0, 1);
2526 DEFINE_2_MUXREG(pin58, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFRSTPWDWN1_MASK, 0, 1);
2527 DEFINE_2_MUXREG(pin59, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFRSTPWDWN0_MASK, 0, 1);
2528 DEFINE_2_MUXREG(pin60, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFWPRT3_MASK, 0, 1);
2529 DEFINE_2_MUXREG(pin61, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFCE3_MASK, 0, 1);
2530 DEFINE_2_MUXREG(pin62, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFAD25_MASK, 0, 1);
2531 DEFINE_2_MUXREG(pin63, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFAD24_MASK, 0, 1);
2532 DEFINE_2_MUXREG(pin_grp0, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_GMIICLK_MASK, 0, 1);
2533 DEFINE_2_MUXREG(pin_grp1, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK, 0, 1);
2534 DEFINE_2_MUXREG(pin_grp2, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_RXCLK_RDV_TXEN_D03_MASK, 0, 1);
2535 DEFINE_2_MUXREG(pin_grp3, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_GMIID47_MASK, 0, 1);
2536 DEFINE_2_MUXREG(pin_grp4, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_MDC_MDIO_MASK, 0, 1);
2537 DEFINE_2_MUXREG(pin_grp5, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_NFAD23_MASK, 0, 1);
2538 DEFINE_2_MUXREG(pin_grp6, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_MCI_DATA8_15_MASK, 0, 1);
2539 DEFINE_2_MUXREG(pin_grp7, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_NFCE2_MASK, 0, 1);
2540 DEFINE_2_MUXREG(pin_grp8, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_NAND8_MASK, 0, 1);
2541 DEFINE_2_MUXREG(nand_16bit_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_NAND16BIT_1_MASK, 0, 1);
2542 DEFINE_2_MUXREG(pin205, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_COL1_MASK | PMX_NFCE1_MASK, 0, 1);
2543 DEFINE_2_MUXREG(pin206, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_COL0_MASK | PMX_NFCE2_MASK, 0, 1);
2544 DEFINE_2_MUXREG(pin211, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_ROW1_MASK | PMX_NFWPRT1_MASK, 0, 1);
2545 DEFINE_2_MUXREG(pin212, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_ROW0_MASK | PMX_NFWPRT2_MASK, 0, 1);
2546 DEFINE_2_MUXREG(pin213, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA0_MASK, 0, 1);
2547 DEFINE_2_MUXREG(pin214, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA1_MASK, 0, 1);
2548 DEFINE_2_MUXREG(pin215, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA2_MASK, 0, 1);
2549 DEFINE_2_MUXREG(pin216, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA3_MASK, 0, 1);
2550 DEFINE_2_MUXREG(pin217, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_MCIDATA4_MASK, 0, 1);
2551 DEFINE_2_MUXREG(pin218, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA5_MASK, 0, 1);
2552 DEFINE_2_MUXREG(pin219, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA6_MASK, 0, 1);
2553 DEFINE_2_MUXREG(pin220, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA7_MASK, 0, 1);
2554 DEFINE_2_MUXREG(pin221, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA1SD_MASK, 0, 1);
2555 DEFINE_2_MUXREG(pin222, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA2SD_MASK, 0, 1);
2556 DEFINE_2_MUXREG(pin223, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATA3SD_MASK, 0, 1);
2557 DEFINE_2_MUXREG(pin224, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIADDR0ALE_MASK, 0, 1);
2558 DEFINE_2_MUXREG(pin225, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIADDR1CLECLK_MASK, 0, 1);
2559 DEFINE_2_MUXREG(pin226, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIADDR2_MASK, 0, 1);
2560 DEFINE_2_MUXREG(pin227, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICECF_MASK, 0, 1);
2561 DEFINE_2_MUXREG(pin228, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICEXD_MASK, 0, 1);
2562 DEFINE_2_MUXREG(pin229, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICESDMMC_MASK, 0, 1);
2563 DEFINE_2_MUXREG(pin230, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICDCF1_MASK, 0, 1);
2564 DEFINE_2_MUXREG(pin231, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICDCF2_MASK, 0, 1);
2565 DEFINE_2_MUXREG(pin232, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICDXD_MASK, 0, 1);
2566 DEFINE_2_MUXREG(pin233, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICDSDMMC_MASK, 0, 1);
2567 DEFINE_2_MUXREG(pin234, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDATADIR_MASK, 0, 1);
2568 DEFINE_2_MUXREG(pin235, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDMARQWP_MASK, 0, 1);
2569 DEFINE_2_MUXREG(pin236, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIIORDRE_MASK, 0, 1);
2570 DEFINE_2_MUXREG(pin237, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIIOWRWE_MASK, 0, 1);
2571 DEFINE_2_MUXREG(pin238, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIRESETCF_MASK, 0, 1);
2572 DEFINE_2_MUXREG(pin239, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICS0CE_MASK, 0, 1);
2573 DEFINE_2_MUXREG(pin240, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICFINTR_MASK, 0, 1);
2574 DEFINE_2_MUXREG(pin241, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIIORDY_MASK, 0, 1);
2575 DEFINE_2_MUXREG(pin242, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCICS1_MASK, 0, 1);
2576 DEFINE_2_MUXREG(pin243, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCIDMAACK_MASK, 0, 1);
2577 DEFINE_2_MUXREG(pin244, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCISDCMD_MASK, 0, 1);
2578 DEFINE_2_MUXREG(pin245, PAD_FUNCTION_EN_2, PAD_DIRECTION_SEL_2, PMX_MCILEDS_MASK, 0, 1);
2579 DEFINE_2_MUXREG(keyboard_rowcol6_8_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_KBD_ROWCOL68_MASK, 0, 1);
2580 DEFINE_2_MUXREG(uart0_pins, PAD_FUNCTION_EN_0, PAD_DIRECTION_SEL_0, PMX_UART0_MASK, 0, 1);
2581 DEFINE_2_MUXREG(uart0_modem_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_UART0_MODEM_MASK, 0, 1);
2582 DEFINE_2_MUXREG(gpt0_tmr0_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_GPT0_TMR0_MASK, 0, 1);
2583 DEFINE_2_MUXREG(gpt0_tmr1_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_GPT0_TMR1_MASK, 0, 1);
2584 DEFINE_2_MUXREG(gpt1_tmr0_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_GPT1_TMR0_MASK, 0, 1);
2585 DEFINE_2_MUXREG(gpt1_tmr1_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_GPT1_TMR1_MASK, 0, 1);
2586 DEFINE_2_MUXREG(touch_xy_pins, PAD_FUNCTION_EN_1, PAD_DIRECTION_SEL_1, PMX_TOUCH_XY_MASK, 0, 1);
2587 
2588 static struct spear_gpio_pingroup spear1310_gpio_pingroup[] = {
2589 	GPIO_PINGROUP(i2c0_pins),
2590 	GPIO_PINGROUP(ssp0_pins),
2591 	GPIO_PINGROUP(ssp0_cs0_pins),
2592 	GPIO_PINGROUP(ssp0_cs1_2_pins),
2593 	GPIO_PINGROUP(i2s0_pins),
2594 	GPIO_PINGROUP(i2s1_pins),
2595 	GPIO_PINGROUP(clcd_pins),
2596 	GPIO_PINGROUP(clcd_high_res_pins),
2597 	GPIO_PINGROUP(pin18),
2598 	GPIO_PINGROUP(pin19),
2599 	GPIO_PINGROUP(pin20),
2600 	GPIO_PINGROUP(pin21),
2601 	GPIO_PINGROUP(pin22),
2602 	GPIO_PINGROUP(pin23),
2603 	GPIO_PINGROUP(pin143),
2604 	GPIO_PINGROUP(pin144),
2605 	GPIO_PINGROUP(pin145),
2606 	GPIO_PINGROUP(pin146),
2607 	GPIO_PINGROUP(pin147),
2608 	GPIO_PINGROUP(pin148),
2609 	GPIO_PINGROUP(pin149),
2610 	GPIO_PINGROUP(pin150),
2611 	GPIO_PINGROUP(pin151),
2612 	GPIO_PINGROUP(pin152),
2613 	GPIO_PINGROUP(smi_2_chips_pins),
2614 	GPIO_PINGROUP(pin54),
2615 	GPIO_PINGROUP(pin55),
2616 	GPIO_PINGROUP(pin56),
2617 	GPIO_PINGROUP(pin57),
2618 	GPIO_PINGROUP(pin58),
2619 	GPIO_PINGROUP(pin59),
2620 	GPIO_PINGROUP(pin60),
2621 	GPIO_PINGROUP(pin61),
2622 	GPIO_PINGROUP(pin62),
2623 	GPIO_PINGROUP(pin63),
2624 	GPIO_PINGROUP(pin_grp0),
2625 	GPIO_PINGROUP(pin_grp1),
2626 	GPIO_PINGROUP(pin_grp2),
2627 	GPIO_PINGROUP(pin_grp3),
2628 	GPIO_PINGROUP(pin_grp4),
2629 	GPIO_PINGROUP(pin_grp5),
2630 	GPIO_PINGROUP(pin_grp6),
2631 	GPIO_PINGROUP(pin_grp7),
2632 	GPIO_PINGROUP(pin_grp8),
2633 	GPIO_PINGROUP(nand_16bit_pins),
2634 	GPIO_PINGROUP(pin205),
2635 	GPIO_PINGROUP(pin206),
2636 	GPIO_PINGROUP(pin211),
2637 	GPIO_PINGROUP(pin212),
2638 	GPIO_PINGROUP(pin213),
2639 	GPIO_PINGROUP(pin214),
2640 	GPIO_PINGROUP(pin215),
2641 	GPIO_PINGROUP(pin216),
2642 	GPIO_PINGROUP(pin217),
2643 	GPIO_PINGROUP(pin218),
2644 	GPIO_PINGROUP(pin219),
2645 	GPIO_PINGROUP(pin220),
2646 	GPIO_PINGROUP(pin221),
2647 	GPIO_PINGROUP(pin222),
2648 	GPIO_PINGROUP(pin223),
2649 	GPIO_PINGROUP(pin224),
2650 	GPIO_PINGROUP(pin225),
2651 	GPIO_PINGROUP(pin226),
2652 	GPIO_PINGROUP(pin227),
2653 	GPIO_PINGROUP(pin228),
2654 	GPIO_PINGROUP(pin229),
2655 	GPIO_PINGROUP(pin230),
2656 	GPIO_PINGROUP(pin231),
2657 	GPIO_PINGROUP(pin232),
2658 	GPIO_PINGROUP(pin233),
2659 	GPIO_PINGROUP(pin234),
2660 	GPIO_PINGROUP(pin235),
2661 	GPIO_PINGROUP(pin236),
2662 	GPIO_PINGROUP(pin237),
2663 	GPIO_PINGROUP(pin238),
2664 	GPIO_PINGROUP(pin239),
2665 	GPIO_PINGROUP(pin240),
2666 	GPIO_PINGROUP(pin241),
2667 	GPIO_PINGROUP(pin242),
2668 	GPIO_PINGROUP(pin243),
2669 	GPIO_PINGROUP(pin244),
2670 	GPIO_PINGROUP(pin245),
2671 	GPIO_PINGROUP(keyboard_rowcol6_8_pins),
2672 	GPIO_PINGROUP(uart0_pins),
2673 	GPIO_PINGROUP(uart0_modem_pins),
2674 	GPIO_PINGROUP(gpt0_tmr0_pins),
2675 	GPIO_PINGROUP(gpt0_tmr1_pins),
2676 	GPIO_PINGROUP(gpt1_tmr0_pins),
2677 	GPIO_PINGROUP(gpt1_tmr1_pins),
2678 	GPIO_PINGROUP(touch_xy_pins),
2679 };
2680 
2681 static struct spear_pinctrl_machdata spear1310_machdata = {
2682 	.pins = spear1310_pins,
2683 	.npins = ARRAY_SIZE(spear1310_pins),
2684 	.groups = spear1310_pingroups,
2685 	.ngroups = ARRAY_SIZE(spear1310_pingroups),
2686 	.functions = spear1310_functions,
2687 	.nfunctions = ARRAY_SIZE(spear1310_functions),
2688 	.gpio_pingroups = spear1310_gpio_pingroup,
2689 	.ngpio_pingroups = ARRAY_SIZE(spear1310_gpio_pingroup),
2690 	.modes_supported = false,
2691 };
2692 
2693 static const struct of_device_id spear1310_pinctrl_of_match[] = {
2694 	{
2695 		.compatible = "st,spear1310-pinmux",
2696 	},
2697 	{},
2698 };
2699 
spear1310_pinctrl_probe(struct platform_device * pdev)2700 static int spear1310_pinctrl_probe(struct platform_device *pdev)
2701 {
2702 	return spear_pinctrl_probe(pdev, &spear1310_machdata);
2703 }
2704 
2705 static struct platform_driver spear1310_pinctrl_driver = {
2706 	.driver = {
2707 		.name = DRIVER_NAME,
2708 		.of_match_table = spear1310_pinctrl_of_match,
2709 	},
2710 	.probe = spear1310_pinctrl_probe,
2711 };
2712 
spear1310_pinctrl_init(void)2713 static int __init spear1310_pinctrl_init(void)
2714 {
2715 	return platform_driver_register(&spear1310_pinctrl_driver);
2716 }
2717 arch_initcall(spear1310_pinctrl_init);
2718