PM / sleep: Asynchronous threads for suspend_noirq
[linux/fpc-iii.git] / drivers / pinctrl / spear / pinctrl-spear1340.c
blob873966e2b99f2ebbe64c6a9921fe7a5fa9a497a2
1 /*
2 * Driver for the ST Microelectronics SPEAr1340 pinmux
4 * Copyright (C) 2012 ST Microelectronics
5 * Viresh Kumar <viresh.linux@gmail.com>
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.
12 #include <linux/err.h>
13 #include <linux/init.h>
14 #include <linux/module.h>
15 #include <linux/of_device.h>
16 #include <linux/platform_device.h>
17 #include "pinctrl-spear.h"
19 #define DRIVER_NAME "spear1340-pinmux"
21 /* pins */
22 static const struct pinctrl_pin_desc spear1340_pins[] = {
23 SPEAR_PIN_0_TO_101,
24 SPEAR_PIN_102_TO_245,
25 PINCTRL_PIN(246, "PLGPIO246"),
26 PINCTRL_PIN(247, "PLGPIO247"),
27 PINCTRL_PIN(248, "PLGPIO248"),
28 PINCTRL_PIN(249, "PLGPIO249"),
29 PINCTRL_PIN(250, "PLGPIO250"),
30 PINCTRL_PIN(251, "PLGPIO251"),
33 /* In SPEAr1340 there are two levels of pad muxing */
34 /* - pads as gpio OR peripherals */
35 #define PAD_FUNCTION_EN_1 0x668
36 #define PAD_FUNCTION_EN_2 0x66C
37 #define PAD_FUNCTION_EN_3 0x670
38 #define PAD_FUNCTION_EN_4 0x674
39 #define PAD_FUNCTION_EN_5 0x690
40 #define PAD_FUNCTION_EN_6 0x694
41 #define PAD_FUNCTION_EN_7 0x698
42 #define PAD_FUNCTION_EN_8 0x69C
44 /* - If peripherals, then primary OR alternate peripheral */
45 #define PAD_SHARED_IP_EN_1 0x6A0
46 #define PAD_SHARED_IP_EN_2 0x6A4
49 * Macro's for first level of pmx - pads as gpio OR peripherals. There are 8
50 * registers with 32 bits each for handling gpio pads, register 8 has only 26
51 * relevant bits.
53 /* macro's for making pads as gpio's */
54 #define PADS_AS_GPIO_REG0_MASK 0xFFFFFFFE
55 #define PADS_AS_GPIO_REGS_MASK 0xFFFFFFFF
56 #define PADS_AS_GPIO_REG7_MASK 0x07FFFFFF
58 /* macro's for making pads as peripherals */
59 #define FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK 0x00000FFE
60 #define UART0_ENH_AND_GPT_REG0_MASK 0x0003F000
61 #define PWM1_AND_KBD_COL5_REG0_MASK 0x00040000
62 #define I2C1_REG0_MASK 0x01080000
63 #define SPDIF_IN_REG0_MASK 0x00100000
64 #define PWM2_AND_GPT0_TMR0_CPT_REG0_MASK 0x00400000
65 #define PWM3_AND_GPT0_TMR1_CLK_REG0_MASK 0x00800000
66 #define PWM0_AND_SSP0_CS1_REG0_MASK 0x02000000
67 #define VIP_AND_CAM3_REG0_MASK 0xFC200000
68 #define VIP_AND_CAM3_REG1_MASK 0x0000000F
69 #define VIP_REG1_MASK 0x00001EF0
70 #define VIP_AND_CAM2_REG1_MASK 0x007FE100
71 #define VIP_AND_CAM1_REG1_MASK 0xFF800000
72 #define VIP_AND_CAM1_REG2_MASK 0x00000003
73 #define VIP_AND_CAM0_REG2_MASK 0x00001FFC
74 #define SMI_REG2_MASK 0x0021E000
75 #define SSP0_REG2_MASK 0x001E0000
76 #define TS_AND_SSP0_CS2_REG2_MASK 0x00400000
77 #define UART0_REG2_MASK 0x01800000
78 #define UART1_REG2_MASK 0x06000000
79 #define I2S_IN_REG2_MASK 0xF8000000
80 #define DEVS_GRP_AND_MIPHY_DBG_REG3_MASK 0x000001FE
81 #define I2S_OUT_REG3_MASK 0x000001EF
82 #define I2S_IN_REG3_MASK 0x00000010
83 #define GMAC_REG3_MASK 0xFFFFFE00
84 #define GMAC_REG4_MASK 0x0000001F
85 #define DEVS_GRP_AND_MIPHY_DBG_REG4_MASK 0x7FFFFF20
86 #define SSP0_CS3_REG4_MASK 0x00000020
87 #define I2C0_REG4_MASK 0x000000C0
88 #define CEC0_REG4_MASK 0x00000100
89 #define CEC1_REG4_MASK 0x00000200
90 #define SPDIF_OUT_REG4_MASK 0x00000400
91 #define CLCD_REG4_MASK 0x7FFFF800
92 #define CLCD_AND_ARM_TRACE_REG4_MASK 0x80000000
93 #define CLCD_AND_ARM_TRACE_REG5_MASK 0xFFFFFFFF
94 #define CLCD_AND_ARM_TRACE_REG6_MASK 0x00000001
95 #define FSMC_PNOR_AND_MCIF_REG6_MASK 0x073FFFFE
96 #define MCIF_REG6_MASK 0xF8C00000
97 #define MCIF_REG7_MASK 0x000043FF
98 #define FSMC_8BIT_REG7_MASK 0x07FFBC00
100 /* other registers */
101 #define PERIP_CFG 0x42C
102 /* PERIP_CFG register masks */
103 #define SSP_CS_CTL_HW 0
104 #define SSP_CS_CTL_SW 1
105 #define SSP_CS_CTL_MASK 1
106 #define SSP_CS_CTL_SHIFT 21
107 #define SSP_CS_VAL_MASK 1
108 #define SSP_CS_VAL_SHIFT 20
109 #define SSP_CS_SEL_CS0 0
110 #define SSP_CS_SEL_CS1 1
111 #define SSP_CS_SEL_CS2 2
112 #define SSP_CS_SEL_MASK 3
113 #define SSP_CS_SEL_SHIFT 18
115 #define I2S_CHNL_2_0 (0)
116 #define I2S_CHNL_3_1 (1)
117 #define I2S_CHNL_5_1 (2)
118 #define I2S_CHNL_7_1 (3)
119 #define I2S_CHNL_PLAY_SHIFT (4)
120 #define I2S_CHNL_PLAY_MASK (3 << 4)
121 #define I2S_CHNL_REC_SHIFT (6)
122 #define I2S_CHNL_REC_MASK (3 << 6)
124 #define SPDIF_OUT_ENB_MASK (1 << 2)
125 #define SPDIF_OUT_ENB_SHIFT 2
127 #define MCIF_SEL_SD 1
128 #define MCIF_SEL_CF 2
129 #define MCIF_SEL_XD 3
130 #define MCIF_SEL_MASK 3
131 #define MCIF_SEL_SHIFT 0
133 #define GMAC_CLK_CFG 0x248
134 #define GMAC_PHY_IF_GMII_VAL (0 << 3)
135 #define GMAC_PHY_IF_RGMII_VAL (1 << 3)
136 #define GMAC_PHY_IF_SGMII_VAL (2 << 3)
137 #define GMAC_PHY_IF_RMII_VAL (4 << 3)
138 #define GMAC_PHY_IF_SEL_MASK (7 << 3)
139 #define GMAC_PHY_INPUT_ENB_VAL 0
140 #define GMAC_PHY_SYNT_ENB_VAL 1
141 #define GMAC_PHY_CLK_MASK 1
142 #define GMAC_PHY_CLK_SHIFT 2
143 #define GMAC_PHY_125M_PAD_VAL 0
144 #define GMAC_PHY_PLL2_VAL 1
145 #define GMAC_PHY_OSC3_VAL 2
146 #define GMAC_PHY_INPUT_CLK_MASK 3
147 #define GMAC_PHY_INPUT_CLK_SHIFT 0
149 #define PCIE_SATA_CFG 0x424
150 /* PCIE CFG MASks */
151 #define PCIE_CFG_DEVICE_PRESENT (1 << 11)
152 #define PCIE_CFG_POWERUP_RESET (1 << 10)
153 #define PCIE_CFG_CORE_CLK_EN (1 << 9)
154 #define PCIE_CFG_AUX_CLK_EN (1 << 8)
155 #define SATA_CFG_TX_CLK_EN (1 << 4)
156 #define SATA_CFG_RX_CLK_EN (1 << 3)
157 #define SATA_CFG_POWERUP_RESET (1 << 2)
158 #define SATA_CFG_PM_CLK_EN (1 << 1)
159 #define PCIE_SATA_SEL_PCIE (0)
160 #define PCIE_SATA_SEL_SATA (1)
161 #define SATA_PCIE_CFG_MASK 0xF1F
162 #define PCIE_CFG_VAL (PCIE_SATA_SEL_PCIE | PCIE_CFG_AUX_CLK_EN | \
163 PCIE_CFG_CORE_CLK_EN | PCIE_CFG_POWERUP_RESET |\
164 PCIE_CFG_DEVICE_PRESENT)
165 #define SATA_CFG_VAL (PCIE_SATA_SEL_SATA | SATA_CFG_PM_CLK_EN | \
166 SATA_CFG_POWERUP_RESET | SATA_CFG_RX_CLK_EN | \
167 SATA_CFG_TX_CLK_EN)
169 /* Macro's for second level of pmx - pads as primary OR alternate peripheral */
170 /* Write 0 to enable FSMC_16_BIT */
171 #define KBD_ROW_COL_MASK (1 << 0)
173 /* Write 0 to enable UART0_ENH */
174 #define GPT_MASK (1 << 1) /* Only clk & cpt */
176 /* Write 0 to enable PWM1 */
177 #define KBD_COL5_MASK (1 << 2)
179 /* Write 0 to enable PWM2 */
180 #define GPT0_TMR0_CPT_MASK (1 << 3) /* Only clk & cpt */
182 /* Write 0 to enable PWM3 */
183 #define GPT0_TMR1_CLK_MASK (1 << 4) /* Only clk & cpt */
185 /* Write 0 to enable PWM0 */
186 #define SSP0_CS1_MASK (1 << 5)
188 /* Write 0 to enable VIP */
189 #define CAM3_MASK (1 << 6)
191 /* Write 0 to enable VIP */
192 #define CAM2_MASK (1 << 7)
194 /* Write 0 to enable VIP */
195 #define CAM1_MASK (1 << 8)
197 /* Write 0 to enable VIP */
198 #define CAM0_MASK (1 << 9)
200 /* Write 0 to enable TS */
201 #define SSP0_CS2_MASK (1 << 10)
203 /* Write 0 to enable FSMC PNOR */
204 #define MCIF_MASK (1 << 11)
206 /* Write 0 to enable CLCD */
207 #define ARM_TRACE_MASK (1 << 12)
209 /* Write 0 to enable I2S, SSP0_CS2, CEC0, 1, SPDIF out, CLCD */
210 #define MIPHY_DBG_MASK (1 << 13)
213 * Pad multiplexing for making all pads as gpio's. This is done to override the
214 * values passed from bootloader and start from scratch.
216 static const unsigned pads_as_gpio_pins[] = { 12, 88, 89, 251 };
217 static struct spear_muxreg pads_as_gpio_muxreg[] = {
219 .reg = PAD_FUNCTION_EN_1,
220 .mask = PADS_AS_GPIO_REG0_MASK,
221 .val = 0x0,
222 }, {
223 .reg = PAD_FUNCTION_EN_2,
224 .mask = PADS_AS_GPIO_REGS_MASK,
225 .val = 0x0,
226 }, {
227 .reg = PAD_FUNCTION_EN_3,
228 .mask = PADS_AS_GPIO_REGS_MASK,
229 .val = 0x0,
230 }, {
231 .reg = PAD_FUNCTION_EN_4,
232 .mask = PADS_AS_GPIO_REGS_MASK,
233 .val = 0x0,
234 }, {
235 .reg = PAD_FUNCTION_EN_5,
236 .mask = PADS_AS_GPIO_REGS_MASK,
237 .val = 0x0,
238 }, {
239 .reg = PAD_FUNCTION_EN_6,
240 .mask = PADS_AS_GPIO_REGS_MASK,
241 .val = 0x0,
242 }, {
243 .reg = PAD_FUNCTION_EN_7,
244 .mask = PADS_AS_GPIO_REGS_MASK,
245 .val = 0x0,
246 }, {
247 .reg = PAD_FUNCTION_EN_8,
248 .mask = PADS_AS_GPIO_REG7_MASK,
249 .val = 0x0,
253 static struct spear_modemux pads_as_gpio_modemux[] = {
255 .muxregs = pads_as_gpio_muxreg,
256 .nmuxregs = ARRAY_SIZE(pads_as_gpio_muxreg),
260 static struct spear_pingroup pads_as_gpio_pingroup = {
261 .name = "pads_as_gpio_grp",
262 .pins = pads_as_gpio_pins,
263 .npins = ARRAY_SIZE(pads_as_gpio_pins),
264 .modemuxs = pads_as_gpio_modemux,
265 .nmodemuxs = ARRAY_SIZE(pads_as_gpio_modemux),
268 static const char *const pads_as_gpio_grps[] = { "pads_as_gpio_grp" };
269 static struct spear_function pads_as_gpio_function = {
270 .name = "pads_as_gpio",
271 .groups = pads_as_gpio_grps,
272 .ngroups = ARRAY_SIZE(pads_as_gpio_grps),
275 /* Pad multiplexing for fsmc_8bit device */
276 static const unsigned fsmc_8bit_pins[] = { 233, 234, 235, 236, 238, 239, 240,
277 241, 242, 243, 244, 245, 246, 247, 248, 249 };
278 static struct spear_muxreg fsmc_8bit_muxreg[] = {
280 .reg = PAD_FUNCTION_EN_8,
281 .mask = FSMC_8BIT_REG7_MASK,
282 .val = FSMC_8BIT_REG7_MASK,
286 static struct spear_modemux fsmc_8bit_modemux[] = {
288 .muxregs = fsmc_8bit_muxreg,
289 .nmuxregs = ARRAY_SIZE(fsmc_8bit_muxreg),
293 static struct spear_pingroup fsmc_8bit_pingroup = {
294 .name = "fsmc_8bit_grp",
295 .pins = fsmc_8bit_pins,
296 .npins = ARRAY_SIZE(fsmc_8bit_pins),
297 .modemuxs = fsmc_8bit_modemux,
298 .nmodemuxs = ARRAY_SIZE(fsmc_8bit_modemux),
301 /* Pad multiplexing for fsmc_16bit device */
302 static const unsigned fsmc_16bit_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
303 static struct spear_muxreg fsmc_16bit_muxreg[] = {
305 .reg = PAD_SHARED_IP_EN_1,
306 .mask = KBD_ROW_COL_MASK,
307 .val = 0,
308 }, {
309 .reg = PAD_FUNCTION_EN_1,
310 .mask = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
311 .val = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
315 static struct spear_modemux fsmc_16bit_modemux[] = {
317 .muxregs = fsmc_16bit_muxreg,
318 .nmuxregs = ARRAY_SIZE(fsmc_16bit_muxreg),
322 static struct spear_pingroup fsmc_16bit_pingroup = {
323 .name = "fsmc_16bit_grp",
324 .pins = fsmc_16bit_pins,
325 .npins = ARRAY_SIZE(fsmc_16bit_pins),
326 .modemuxs = fsmc_16bit_modemux,
327 .nmodemuxs = ARRAY_SIZE(fsmc_16bit_modemux),
330 /* pad multiplexing for fsmc_pnor device */
331 static const unsigned fsmc_pnor_pins[] = { 192, 193, 194, 195, 196, 197, 198,
332 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
333 215, 216, 217 };
334 static struct spear_muxreg fsmc_pnor_muxreg[] = {
336 .reg = PAD_SHARED_IP_EN_1,
337 .mask = MCIF_MASK,
338 .val = 0,
339 }, {
340 .reg = PAD_FUNCTION_EN_7,
341 .mask = FSMC_PNOR_AND_MCIF_REG6_MASK,
342 .val = FSMC_PNOR_AND_MCIF_REG6_MASK,
346 static struct spear_modemux fsmc_pnor_modemux[] = {
348 .muxregs = fsmc_pnor_muxreg,
349 .nmuxregs = ARRAY_SIZE(fsmc_pnor_muxreg),
353 static struct spear_pingroup fsmc_pnor_pingroup = {
354 .name = "fsmc_pnor_grp",
355 .pins = fsmc_pnor_pins,
356 .npins = ARRAY_SIZE(fsmc_pnor_pins),
357 .modemuxs = fsmc_pnor_modemux,
358 .nmodemuxs = ARRAY_SIZE(fsmc_pnor_modemux),
361 static const char *const fsmc_grps[] = { "fsmc_8bit_grp", "fsmc_16bit_grp",
362 "fsmc_pnor_grp" };
363 static struct spear_function fsmc_function = {
364 .name = "fsmc",
365 .groups = fsmc_grps,
366 .ngroups = ARRAY_SIZE(fsmc_grps),
369 /* pad multiplexing for keyboard rows-cols device */
370 static const unsigned keyboard_row_col_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
371 10 };
372 static struct spear_muxreg keyboard_row_col_muxreg[] = {
374 .reg = PAD_SHARED_IP_EN_1,
375 .mask = KBD_ROW_COL_MASK,
376 .val = KBD_ROW_COL_MASK,
377 }, {
378 .reg = PAD_FUNCTION_EN_1,
379 .mask = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
380 .val = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
384 static struct spear_modemux keyboard_row_col_modemux[] = {
386 .muxregs = keyboard_row_col_muxreg,
387 .nmuxregs = ARRAY_SIZE(keyboard_row_col_muxreg),
391 static struct spear_pingroup keyboard_row_col_pingroup = {
392 .name = "keyboard_row_col_grp",
393 .pins = keyboard_row_col_pins,
394 .npins = ARRAY_SIZE(keyboard_row_col_pins),
395 .modemuxs = keyboard_row_col_modemux,
396 .nmodemuxs = ARRAY_SIZE(keyboard_row_col_modemux),
399 /* pad multiplexing for keyboard col5 device */
400 static const unsigned keyboard_col5_pins[] = { 17 };
401 static struct spear_muxreg keyboard_col5_muxreg[] = {
403 .reg = PAD_SHARED_IP_EN_1,
404 .mask = KBD_COL5_MASK,
405 .val = KBD_COL5_MASK,
406 }, {
407 .reg = PAD_FUNCTION_EN_1,
408 .mask = PWM1_AND_KBD_COL5_REG0_MASK,
409 .val = PWM1_AND_KBD_COL5_REG0_MASK,
413 static struct spear_modemux keyboard_col5_modemux[] = {
415 .muxregs = keyboard_col5_muxreg,
416 .nmuxregs = ARRAY_SIZE(keyboard_col5_muxreg),
420 static struct spear_pingroup keyboard_col5_pingroup = {
421 .name = "keyboard_col5_grp",
422 .pins = keyboard_col5_pins,
423 .npins = ARRAY_SIZE(keyboard_col5_pins),
424 .modemuxs = keyboard_col5_modemux,
425 .nmodemuxs = ARRAY_SIZE(keyboard_col5_modemux),
428 static const char *const keyboard_grps[] = { "keyboard_row_col_grp",
429 "keyboard_col5_grp" };
430 static struct spear_function keyboard_function = {
431 .name = "keyboard",
432 .groups = keyboard_grps,
433 .ngroups = ARRAY_SIZE(keyboard_grps),
436 /* pad multiplexing for spdif_in device */
437 static const unsigned spdif_in_pins[] = { 19 };
438 static struct spear_muxreg spdif_in_muxreg[] = {
440 .reg = PAD_FUNCTION_EN_1,
441 .mask = SPDIF_IN_REG0_MASK,
442 .val = SPDIF_IN_REG0_MASK,
446 static struct spear_modemux spdif_in_modemux[] = {
448 .muxregs = spdif_in_muxreg,
449 .nmuxregs = ARRAY_SIZE(spdif_in_muxreg),
453 static struct spear_pingroup spdif_in_pingroup = {
454 .name = "spdif_in_grp",
455 .pins = spdif_in_pins,
456 .npins = ARRAY_SIZE(spdif_in_pins),
457 .modemuxs = spdif_in_modemux,
458 .nmodemuxs = ARRAY_SIZE(spdif_in_modemux),
461 static const char *const spdif_in_grps[] = { "spdif_in_grp" };
462 static struct spear_function spdif_in_function = {
463 .name = "spdif_in",
464 .groups = spdif_in_grps,
465 .ngroups = ARRAY_SIZE(spdif_in_grps),
468 /* pad multiplexing for spdif_out device */
469 static const unsigned spdif_out_pins[] = { 137 };
470 static struct spear_muxreg spdif_out_muxreg[] = {
472 .reg = PAD_FUNCTION_EN_5,
473 .mask = SPDIF_OUT_REG4_MASK,
474 .val = SPDIF_OUT_REG4_MASK,
475 }, {
476 .reg = PERIP_CFG,
477 .mask = SPDIF_OUT_ENB_MASK,
478 .val = SPDIF_OUT_ENB_MASK,
482 static struct spear_modemux spdif_out_modemux[] = {
484 .muxregs = spdif_out_muxreg,
485 .nmuxregs = ARRAY_SIZE(spdif_out_muxreg),
489 static struct spear_pingroup spdif_out_pingroup = {
490 .name = "spdif_out_grp",
491 .pins = spdif_out_pins,
492 .npins = ARRAY_SIZE(spdif_out_pins),
493 .modemuxs = spdif_out_modemux,
494 .nmodemuxs = ARRAY_SIZE(spdif_out_modemux),
497 static const char *const spdif_out_grps[] = { "spdif_out_grp" };
498 static struct spear_function spdif_out_function = {
499 .name = "spdif_out",
500 .groups = spdif_out_grps,
501 .ngroups = ARRAY_SIZE(spdif_out_grps),
504 /* pad multiplexing for gpt_0_1 device */
505 static const unsigned gpt_0_1_pins[] = { 11, 12, 13, 14, 15, 16, 21, 22 };
506 static struct spear_muxreg gpt_0_1_muxreg[] = {
508 .reg = PAD_SHARED_IP_EN_1,
509 .mask = GPT_MASK | GPT0_TMR0_CPT_MASK | GPT0_TMR1_CLK_MASK,
510 .val = GPT_MASK | GPT0_TMR0_CPT_MASK | GPT0_TMR1_CLK_MASK,
511 }, {
512 .reg = PAD_FUNCTION_EN_1,
513 .mask = UART0_ENH_AND_GPT_REG0_MASK |
514 PWM2_AND_GPT0_TMR0_CPT_REG0_MASK |
515 PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
516 .val = UART0_ENH_AND_GPT_REG0_MASK |
517 PWM2_AND_GPT0_TMR0_CPT_REG0_MASK |
518 PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
522 static struct spear_modemux gpt_0_1_modemux[] = {
524 .muxregs = gpt_0_1_muxreg,
525 .nmuxregs = ARRAY_SIZE(gpt_0_1_muxreg),
529 static struct spear_pingroup gpt_0_1_pingroup = {
530 .name = "gpt_0_1_grp",
531 .pins = gpt_0_1_pins,
532 .npins = ARRAY_SIZE(gpt_0_1_pins),
533 .modemuxs = gpt_0_1_modemux,
534 .nmodemuxs = ARRAY_SIZE(gpt_0_1_modemux),
537 static const char *const gpt_0_1_grps[] = { "gpt_0_1_grp" };
538 static struct spear_function gpt_0_1_function = {
539 .name = "gpt_0_1",
540 .groups = gpt_0_1_grps,
541 .ngroups = ARRAY_SIZE(gpt_0_1_grps),
544 /* pad multiplexing for pwm0 device */
545 static const unsigned pwm0_pins[] = { 24 };
546 static struct spear_muxreg pwm0_muxreg[] = {
548 .reg = PAD_SHARED_IP_EN_1,
549 .mask = SSP0_CS1_MASK,
550 .val = 0,
551 }, {
552 .reg = PAD_FUNCTION_EN_1,
553 .mask = PWM0_AND_SSP0_CS1_REG0_MASK,
554 .val = PWM0_AND_SSP0_CS1_REG0_MASK,
558 static struct spear_modemux pwm0_modemux[] = {
560 .muxregs = pwm0_muxreg,
561 .nmuxregs = ARRAY_SIZE(pwm0_muxreg),
565 static struct spear_pingroup pwm0_pingroup = {
566 .name = "pwm0_grp",
567 .pins = pwm0_pins,
568 .npins = ARRAY_SIZE(pwm0_pins),
569 .modemuxs = pwm0_modemux,
570 .nmodemuxs = ARRAY_SIZE(pwm0_modemux),
573 /* pad multiplexing for pwm1 device */
574 static const unsigned pwm1_pins[] = { 17 };
575 static struct spear_muxreg pwm1_muxreg[] = {
577 .reg = PAD_SHARED_IP_EN_1,
578 .mask = KBD_COL5_MASK,
579 .val = 0,
580 }, {
581 .reg = PAD_FUNCTION_EN_1,
582 .mask = PWM1_AND_KBD_COL5_REG0_MASK,
583 .val = PWM1_AND_KBD_COL5_REG0_MASK,
587 static struct spear_modemux pwm1_modemux[] = {
589 .muxregs = pwm1_muxreg,
590 .nmuxregs = ARRAY_SIZE(pwm1_muxreg),
594 static struct spear_pingroup pwm1_pingroup = {
595 .name = "pwm1_grp",
596 .pins = pwm1_pins,
597 .npins = ARRAY_SIZE(pwm1_pins),
598 .modemuxs = pwm1_modemux,
599 .nmodemuxs = ARRAY_SIZE(pwm1_modemux),
602 /* pad multiplexing for pwm2 device */
603 static const unsigned pwm2_pins[] = { 21 };
604 static struct spear_muxreg pwm2_muxreg[] = {
606 .reg = PAD_SHARED_IP_EN_1,
607 .mask = GPT0_TMR0_CPT_MASK,
608 .val = 0,
609 }, {
610 .reg = PAD_FUNCTION_EN_1,
611 .mask = PWM2_AND_GPT0_TMR0_CPT_REG0_MASK,
612 .val = PWM2_AND_GPT0_TMR0_CPT_REG0_MASK,
616 static struct spear_modemux pwm2_modemux[] = {
618 .muxregs = pwm2_muxreg,
619 .nmuxregs = ARRAY_SIZE(pwm2_muxreg),
623 static struct spear_pingroup pwm2_pingroup = {
624 .name = "pwm2_grp",
625 .pins = pwm2_pins,
626 .npins = ARRAY_SIZE(pwm2_pins),
627 .modemuxs = pwm2_modemux,
628 .nmodemuxs = ARRAY_SIZE(pwm2_modemux),
631 /* pad multiplexing for pwm3 device */
632 static const unsigned pwm3_pins[] = { 22 };
633 static struct spear_muxreg pwm3_muxreg[] = {
635 .reg = PAD_SHARED_IP_EN_1,
636 .mask = GPT0_TMR1_CLK_MASK,
637 .val = 0,
638 }, {
639 .reg = PAD_FUNCTION_EN_1,
640 .mask = PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
641 .val = PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
645 static struct spear_modemux pwm3_modemux[] = {
647 .muxregs = pwm3_muxreg,
648 .nmuxregs = ARRAY_SIZE(pwm3_muxreg),
652 static struct spear_pingroup pwm3_pingroup = {
653 .name = "pwm3_grp",
654 .pins = pwm3_pins,
655 .npins = ARRAY_SIZE(pwm3_pins),
656 .modemuxs = pwm3_modemux,
657 .nmodemuxs = ARRAY_SIZE(pwm3_modemux),
660 static const char *const pwm_grps[] = { "pwm0_grp", "pwm1_grp", "pwm2_grp",
661 "pwm3_grp" };
662 static struct spear_function pwm_function = {
663 .name = "pwm",
664 .groups = pwm_grps,
665 .ngroups = ARRAY_SIZE(pwm_grps),
668 /* pad multiplexing for vip_mux device */
669 static const unsigned vip_mux_pins[] = { 35, 36, 37, 38, 40, 41, 42, 43 };
670 static struct spear_muxreg vip_mux_muxreg[] = {
672 .reg = PAD_FUNCTION_EN_2,
673 .mask = VIP_REG1_MASK,
674 .val = VIP_REG1_MASK,
678 static struct spear_modemux vip_mux_modemux[] = {
680 .muxregs = vip_mux_muxreg,
681 .nmuxregs = ARRAY_SIZE(vip_mux_muxreg),
685 static struct spear_pingroup vip_mux_pingroup = {
686 .name = "vip_mux_grp",
687 .pins = vip_mux_pins,
688 .npins = ARRAY_SIZE(vip_mux_pins),
689 .modemuxs = vip_mux_modemux,
690 .nmodemuxs = ARRAY_SIZE(vip_mux_modemux),
693 /* pad multiplexing for vip_mux_cam0 (disables cam0) device */
694 static const unsigned vip_mux_cam0_pins[] = { 65, 66, 67, 68, 69, 70, 71, 72,
695 73, 74, 75 };
696 static struct spear_muxreg vip_mux_cam0_muxreg[] = {
698 .reg = PAD_SHARED_IP_EN_1,
699 .mask = CAM0_MASK,
700 .val = 0,
701 }, {
702 .reg = PAD_FUNCTION_EN_3,
703 .mask = VIP_AND_CAM0_REG2_MASK,
704 .val = VIP_AND_CAM0_REG2_MASK,
708 static struct spear_modemux vip_mux_cam0_modemux[] = {
710 .muxregs = vip_mux_cam0_muxreg,
711 .nmuxregs = ARRAY_SIZE(vip_mux_cam0_muxreg),
715 static struct spear_pingroup vip_mux_cam0_pingroup = {
716 .name = "vip_mux_cam0_grp",
717 .pins = vip_mux_cam0_pins,
718 .npins = ARRAY_SIZE(vip_mux_cam0_pins),
719 .modemuxs = vip_mux_cam0_modemux,
720 .nmodemuxs = ARRAY_SIZE(vip_mux_cam0_modemux),
723 /* pad multiplexing for vip_mux_cam1 (disables cam1) device */
724 static const unsigned vip_mux_cam1_pins[] = { 54, 55, 56, 57, 58, 59, 60, 61,
725 62, 63, 64 };
726 static struct spear_muxreg vip_mux_cam1_muxreg[] = {
728 .reg = PAD_SHARED_IP_EN_1,
729 .mask = CAM1_MASK,
730 .val = 0,
731 }, {
732 .reg = PAD_FUNCTION_EN_2,
733 .mask = VIP_AND_CAM1_REG1_MASK,
734 .val = VIP_AND_CAM1_REG1_MASK,
735 }, {
736 .reg = PAD_FUNCTION_EN_3,
737 .mask = VIP_AND_CAM1_REG2_MASK,
738 .val = VIP_AND_CAM1_REG2_MASK,
742 static struct spear_modemux vip_mux_cam1_modemux[] = {
744 .muxregs = vip_mux_cam1_muxreg,
745 .nmuxregs = ARRAY_SIZE(vip_mux_cam1_muxreg),
749 static struct spear_pingroup vip_mux_cam1_pingroup = {
750 .name = "vip_mux_cam1_grp",
751 .pins = vip_mux_cam1_pins,
752 .npins = ARRAY_SIZE(vip_mux_cam1_pins),
753 .modemuxs = vip_mux_cam1_modemux,
754 .nmodemuxs = ARRAY_SIZE(vip_mux_cam1_modemux),
757 /* pad multiplexing for vip_mux_cam2 (disables cam2) device */
758 static const unsigned vip_mux_cam2_pins[] = { 39, 44, 45, 46, 47, 48, 49, 50,
759 51, 52, 53 };
760 static struct spear_muxreg vip_mux_cam2_muxreg[] = {
762 .reg = PAD_SHARED_IP_EN_1,
763 .mask = CAM2_MASK,
764 .val = 0,
765 }, {
766 .reg = PAD_FUNCTION_EN_2,
767 .mask = VIP_AND_CAM2_REG1_MASK,
768 .val = VIP_AND_CAM2_REG1_MASK,
772 static struct spear_modemux vip_mux_cam2_modemux[] = {
774 .muxregs = vip_mux_cam2_muxreg,
775 .nmuxregs = ARRAY_SIZE(vip_mux_cam2_muxreg),
779 static struct spear_pingroup vip_mux_cam2_pingroup = {
780 .name = "vip_mux_cam2_grp",
781 .pins = vip_mux_cam2_pins,
782 .npins = ARRAY_SIZE(vip_mux_cam2_pins),
783 .modemuxs = vip_mux_cam2_modemux,
784 .nmodemuxs = ARRAY_SIZE(vip_mux_cam2_modemux),
787 /* pad multiplexing for vip_mux_cam3 (disables cam3) device */
788 static const unsigned vip_mux_cam3_pins[] = { 20, 25, 26, 27, 28, 29, 30, 31,
789 32, 33, 34 };
790 static struct spear_muxreg vip_mux_cam3_muxreg[] = {
792 .reg = PAD_SHARED_IP_EN_1,
793 .mask = CAM3_MASK,
794 .val = 0,
795 }, {
796 .reg = PAD_FUNCTION_EN_1,
797 .mask = VIP_AND_CAM3_REG0_MASK,
798 .val = VIP_AND_CAM3_REG0_MASK,
799 }, {
800 .reg = PAD_FUNCTION_EN_2,
801 .mask = VIP_AND_CAM3_REG1_MASK,
802 .val = VIP_AND_CAM3_REG1_MASK,
806 static struct spear_modemux vip_mux_cam3_modemux[] = {
808 .muxregs = vip_mux_cam3_muxreg,
809 .nmuxregs = ARRAY_SIZE(vip_mux_cam3_muxreg),
813 static struct spear_pingroup vip_mux_cam3_pingroup = {
814 .name = "vip_mux_cam3_grp",
815 .pins = vip_mux_cam3_pins,
816 .npins = ARRAY_SIZE(vip_mux_cam3_pins),
817 .modemuxs = vip_mux_cam3_modemux,
818 .nmodemuxs = ARRAY_SIZE(vip_mux_cam3_modemux),
821 static const char *const vip_grps[] = { "vip_mux_grp", "vip_mux_cam0_grp" ,
822 "vip_mux_cam1_grp" , "vip_mux_cam2_grp", "vip_mux_cam3_grp" };
823 static struct spear_function vip_function = {
824 .name = "vip",
825 .groups = vip_grps,
826 .ngroups = ARRAY_SIZE(vip_grps),
829 /* pad multiplexing for cam0 device */
830 static const unsigned cam0_pins[] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75
832 static struct spear_muxreg cam0_muxreg[] = {
834 .reg = PAD_SHARED_IP_EN_1,
835 .mask = CAM0_MASK,
836 .val = CAM0_MASK,
837 }, {
838 .reg = PAD_FUNCTION_EN_3,
839 .mask = VIP_AND_CAM0_REG2_MASK,
840 .val = VIP_AND_CAM0_REG2_MASK,
844 static struct spear_modemux cam0_modemux[] = {
846 .muxregs = cam0_muxreg,
847 .nmuxregs = ARRAY_SIZE(cam0_muxreg),
851 static struct spear_pingroup cam0_pingroup = {
852 .name = "cam0_grp",
853 .pins = cam0_pins,
854 .npins = ARRAY_SIZE(cam0_pins),
855 .modemuxs = cam0_modemux,
856 .nmodemuxs = ARRAY_SIZE(cam0_modemux),
859 static const char *const cam0_grps[] = { "cam0_grp" };
860 static struct spear_function cam0_function = {
861 .name = "cam0",
862 .groups = cam0_grps,
863 .ngroups = ARRAY_SIZE(cam0_grps),
866 /* pad multiplexing for cam1 device */
867 static const unsigned cam1_pins[] = { 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
869 static struct spear_muxreg cam1_muxreg[] = {
871 .reg = PAD_SHARED_IP_EN_1,
872 .mask = CAM1_MASK,
873 .val = CAM1_MASK,
874 }, {
875 .reg = PAD_FUNCTION_EN_2,
876 .mask = VIP_AND_CAM1_REG1_MASK,
877 .val = VIP_AND_CAM1_REG1_MASK,
878 }, {
879 .reg = PAD_FUNCTION_EN_3,
880 .mask = VIP_AND_CAM1_REG2_MASK,
881 .val = VIP_AND_CAM1_REG2_MASK,
885 static struct spear_modemux cam1_modemux[] = {
887 .muxregs = cam1_muxreg,
888 .nmuxregs = ARRAY_SIZE(cam1_muxreg),
892 static struct spear_pingroup cam1_pingroup = {
893 .name = "cam1_grp",
894 .pins = cam1_pins,
895 .npins = ARRAY_SIZE(cam1_pins),
896 .modemuxs = cam1_modemux,
897 .nmodemuxs = ARRAY_SIZE(cam1_modemux),
900 static const char *const cam1_grps[] = { "cam1_grp" };
901 static struct spear_function cam1_function = {
902 .name = "cam1",
903 .groups = cam1_grps,
904 .ngroups = ARRAY_SIZE(cam1_grps),
907 /* pad multiplexing for cam2 device */
908 static const unsigned cam2_pins[] = { 39, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
910 static struct spear_muxreg cam2_muxreg[] = {
912 .reg = PAD_SHARED_IP_EN_1,
913 .mask = CAM2_MASK,
914 .val = CAM2_MASK,
915 }, {
916 .reg = PAD_FUNCTION_EN_2,
917 .mask = VIP_AND_CAM2_REG1_MASK,
918 .val = VIP_AND_CAM2_REG1_MASK,
922 static struct spear_modemux cam2_modemux[] = {
924 .muxregs = cam2_muxreg,
925 .nmuxregs = ARRAY_SIZE(cam2_muxreg),
929 static struct spear_pingroup cam2_pingroup = {
930 .name = "cam2_grp",
931 .pins = cam2_pins,
932 .npins = ARRAY_SIZE(cam2_pins),
933 .modemuxs = cam2_modemux,
934 .nmodemuxs = ARRAY_SIZE(cam2_modemux),
937 static const char *const cam2_grps[] = { "cam2_grp" };
938 static struct spear_function cam2_function = {
939 .name = "cam2",
940 .groups = cam2_grps,
941 .ngroups = ARRAY_SIZE(cam2_grps),
944 /* pad multiplexing for cam3 device */
945 static const unsigned cam3_pins[] = { 20, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
947 static struct spear_muxreg cam3_muxreg[] = {
949 .reg = PAD_SHARED_IP_EN_1,
950 .mask = CAM3_MASK,
951 .val = CAM3_MASK,
952 }, {
953 .reg = PAD_FUNCTION_EN_1,
954 .mask = VIP_AND_CAM3_REG0_MASK,
955 .val = VIP_AND_CAM3_REG0_MASK,
956 }, {
957 .reg = PAD_FUNCTION_EN_2,
958 .mask = VIP_AND_CAM3_REG1_MASK,
959 .val = VIP_AND_CAM3_REG1_MASK,
963 static struct spear_modemux cam3_modemux[] = {
965 .muxregs = cam3_muxreg,
966 .nmuxregs = ARRAY_SIZE(cam3_muxreg),
970 static struct spear_pingroup cam3_pingroup = {
971 .name = "cam3_grp",
972 .pins = cam3_pins,
973 .npins = ARRAY_SIZE(cam3_pins),
974 .modemuxs = cam3_modemux,
975 .nmodemuxs = ARRAY_SIZE(cam3_modemux),
978 static const char *const cam3_grps[] = { "cam3_grp" };
979 static struct spear_function cam3_function = {
980 .name = "cam3",
981 .groups = cam3_grps,
982 .ngroups = ARRAY_SIZE(cam3_grps),
985 /* pad multiplexing for smi device */
986 static const unsigned smi_pins[] = { 76, 77, 78, 79, 84 };
987 static struct spear_muxreg smi_muxreg[] = {
989 .reg = PAD_FUNCTION_EN_3,
990 .mask = SMI_REG2_MASK,
991 .val = SMI_REG2_MASK,
995 static struct spear_modemux smi_modemux[] = {
997 .muxregs = smi_muxreg,
998 .nmuxregs = ARRAY_SIZE(smi_muxreg),
1002 static struct spear_pingroup smi_pingroup = {
1003 .name = "smi_grp",
1004 .pins = smi_pins,
1005 .npins = ARRAY_SIZE(smi_pins),
1006 .modemuxs = smi_modemux,
1007 .nmodemuxs = ARRAY_SIZE(smi_modemux),
1010 static const char *const smi_grps[] = { "smi_grp" };
1011 static struct spear_function smi_function = {
1012 .name = "smi",
1013 .groups = smi_grps,
1014 .ngroups = ARRAY_SIZE(smi_grps),
1017 /* pad multiplexing for ssp0 device */
1018 static const unsigned ssp0_pins[] = { 80, 81, 82, 83 };
1019 static struct spear_muxreg ssp0_muxreg[] = {
1021 .reg = PAD_FUNCTION_EN_3,
1022 .mask = SSP0_REG2_MASK,
1023 .val = SSP0_REG2_MASK,
1027 static struct spear_modemux ssp0_modemux[] = {
1029 .muxregs = ssp0_muxreg,
1030 .nmuxregs = ARRAY_SIZE(ssp0_muxreg),
1034 static struct spear_pingroup ssp0_pingroup = {
1035 .name = "ssp0_grp",
1036 .pins = ssp0_pins,
1037 .npins = ARRAY_SIZE(ssp0_pins),
1038 .modemuxs = ssp0_modemux,
1039 .nmodemuxs = ARRAY_SIZE(ssp0_modemux),
1042 /* pad multiplexing for ssp0_cs1 device */
1043 static const unsigned ssp0_cs1_pins[] = { 24 };
1044 static struct spear_muxreg ssp0_cs1_muxreg[] = {
1046 .reg = PAD_SHARED_IP_EN_1,
1047 .mask = SSP0_CS1_MASK,
1048 .val = SSP0_CS1_MASK,
1049 }, {
1050 .reg = PAD_FUNCTION_EN_1,
1051 .mask = PWM0_AND_SSP0_CS1_REG0_MASK,
1052 .val = PWM0_AND_SSP0_CS1_REG0_MASK,
1056 static struct spear_modemux ssp0_cs1_modemux[] = {
1058 .muxregs = ssp0_cs1_muxreg,
1059 .nmuxregs = ARRAY_SIZE(ssp0_cs1_muxreg),
1063 static struct spear_pingroup ssp0_cs1_pingroup = {
1064 .name = "ssp0_cs1_grp",
1065 .pins = ssp0_cs1_pins,
1066 .npins = ARRAY_SIZE(ssp0_cs1_pins),
1067 .modemuxs = ssp0_cs1_modemux,
1068 .nmodemuxs = ARRAY_SIZE(ssp0_cs1_modemux),
1071 /* pad multiplexing for ssp0_cs2 device */
1072 static const unsigned ssp0_cs2_pins[] = { 85 };
1073 static struct spear_muxreg ssp0_cs2_muxreg[] = {
1075 .reg = PAD_SHARED_IP_EN_1,
1076 .mask = SSP0_CS2_MASK,
1077 .val = SSP0_CS2_MASK,
1078 }, {
1079 .reg = PAD_FUNCTION_EN_3,
1080 .mask = TS_AND_SSP0_CS2_REG2_MASK,
1081 .val = TS_AND_SSP0_CS2_REG2_MASK,
1085 static struct spear_modemux ssp0_cs2_modemux[] = {
1087 .muxregs = ssp0_cs2_muxreg,
1088 .nmuxregs = ARRAY_SIZE(ssp0_cs2_muxreg),
1092 static struct spear_pingroup ssp0_cs2_pingroup = {
1093 .name = "ssp0_cs2_grp",
1094 .pins = ssp0_cs2_pins,
1095 .npins = ARRAY_SIZE(ssp0_cs2_pins),
1096 .modemuxs = ssp0_cs2_modemux,
1097 .nmodemuxs = ARRAY_SIZE(ssp0_cs2_modemux),
1100 /* pad multiplexing for ssp0_cs3 device */
1101 static const unsigned ssp0_cs3_pins[] = { 132 };
1102 static struct spear_muxreg ssp0_cs3_muxreg[] = {
1104 .reg = PAD_FUNCTION_EN_5,
1105 .mask = SSP0_CS3_REG4_MASK,
1106 .val = SSP0_CS3_REG4_MASK,
1110 static struct spear_modemux ssp0_cs3_modemux[] = {
1112 .muxregs = ssp0_cs3_muxreg,
1113 .nmuxregs = ARRAY_SIZE(ssp0_cs3_muxreg),
1117 static struct spear_pingroup ssp0_cs3_pingroup = {
1118 .name = "ssp0_cs3_grp",
1119 .pins = ssp0_cs3_pins,
1120 .npins = ARRAY_SIZE(ssp0_cs3_pins),
1121 .modemuxs = ssp0_cs3_modemux,
1122 .nmodemuxs = ARRAY_SIZE(ssp0_cs3_modemux),
1125 static const char *const ssp0_grps[] = { "ssp0_grp", "ssp0_cs1_grp",
1126 "ssp0_cs2_grp", "ssp0_cs3_grp" };
1127 static struct spear_function ssp0_function = {
1128 .name = "ssp0",
1129 .groups = ssp0_grps,
1130 .ngroups = ARRAY_SIZE(ssp0_grps),
1133 /* pad multiplexing for uart0 device */
1134 static const unsigned uart0_pins[] = { 86, 87 };
1135 static struct spear_muxreg uart0_muxreg[] = {
1137 .reg = PAD_FUNCTION_EN_3,
1138 .mask = UART0_REG2_MASK,
1139 .val = UART0_REG2_MASK,
1143 static struct spear_modemux uart0_modemux[] = {
1145 .muxregs = uart0_muxreg,
1146 .nmuxregs = ARRAY_SIZE(uart0_muxreg),
1150 static struct spear_pingroup uart0_pingroup = {
1151 .name = "uart0_grp",
1152 .pins = uart0_pins,
1153 .npins = ARRAY_SIZE(uart0_pins),
1154 .modemuxs = uart0_modemux,
1155 .nmodemuxs = ARRAY_SIZE(uart0_modemux),
1158 /* pad multiplexing for uart0_enh device */
1159 static const unsigned uart0_enh_pins[] = { 11, 12, 13, 14, 15, 16 };
1160 static struct spear_muxreg uart0_enh_muxreg[] = {
1162 .reg = PAD_SHARED_IP_EN_1,
1163 .mask = GPT_MASK,
1164 .val = 0,
1165 }, {
1166 .reg = PAD_FUNCTION_EN_1,
1167 .mask = UART0_ENH_AND_GPT_REG0_MASK,
1168 .val = UART0_ENH_AND_GPT_REG0_MASK,
1172 static struct spear_modemux uart0_enh_modemux[] = {
1174 .muxregs = uart0_enh_muxreg,
1175 .nmuxregs = ARRAY_SIZE(uart0_enh_muxreg),
1179 static struct spear_pingroup uart0_enh_pingroup = {
1180 .name = "uart0_enh_grp",
1181 .pins = uart0_enh_pins,
1182 .npins = ARRAY_SIZE(uart0_enh_pins),
1183 .modemuxs = uart0_enh_modemux,
1184 .nmodemuxs = ARRAY_SIZE(uart0_enh_modemux),
1187 static const char *const uart0_grps[] = { "uart0_grp", "uart0_enh_grp" };
1188 static struct spear_function uart0_function = {
1189 .name = "uart0",
1190 .groups = uart0_grps,
1191 .ngroups = ARRAY_SIZE(uart0_grps),
1194 /* pad multiplexing for uart1 device */
1195 static const unsigned uart1_pins[] = { 88, 89 };
1196 static struct spear_muxreg uart1_muxreg[] = {
1198 .reg = PAD_FUNCTION_EN_3,
1199 .mask = UART1_REG2_MASK,
1200 .val = UART1_REG2_MASK,
1204 static struct spear_modemux uart1_modemux[] = {
1206 .muxregs = uart1_muxreg,
1207 .nmuxregs = ARRAY_SIZE(uart1_muxreg),
1211 static struct spear_pingroup uart1_pingroup = {
1212 .name = "uart1_grp",
1213 .pins = uart1_pins,
1214 .npins = ARRAY_SIZE(uart1_pins),
1215 .modemuxs = uart1_modemux,
1216 .nmodemuxs = ARRAY_SIZE(uart1_modemux),
1219 static const char *const uart1_grps[] = { "uart1_grp" };
1220 static struct spear_function uart1_function = {
1221 .name = "uart1",
1222 .groups = uart1_grps,
1223 .ngroups = ARRAY_SIZE(uart1_grps),
1226 /* pad multiplexing for i2s_in device */
1227 static const unsigned i2s_in_pins[] = { 90, 91, 92, 93, 94, 99 };
1228 static struct spear_muxreg i2s_in_muxreg[] = {
1230 .reg = PAD_FUNCTION_EN_3,
1231 .mask = I2S_IN_REG2_MASK,
1232 .val = I2S_IN_REG2_MASK,
1233 }, {
1234 .reg = PAD_FUNCTION_EN_4,
1235 .mask = I2S_IN_REG3_MASK,
1236 .val = I2S_IN_REG3_MASK,
1240 static struct spear_modemux i2s_in_modemux[] = {
1242 .muxregs = i2s_in_muxreg,
1243 .nmuxregs = ARRAY_SIZE(i2s_in_muxreg),
1247 static struct spear_pingroup i2s_in_pingroup = {
1248 .name = "i2s_in_grp",
1249 .pins = i2s_in_pins,
1250 .npins = ARRAY_SIZE(i2s_in_pins),
1251 .modemuxs = i2s_in_modemux,
1252 .nmodemuxs = ARRAY_SIZE(i2s_in_modemux),
1255 /* pad multiplexing for i2s_out device */
1256 static const unsigned i2s_out_pins[] = { 95, 96, 97, 98, 100, 101, 102, 103 };
1257 static struct spear_muxreg i2s_out_muxreg[] = {
1259 .reg = PAD_FUNCTION_EN_4,
1260 .mask = I2S_OUT_REG3_MASK,
1261 .val = I2S_OUT_REG3_MASK,
1265 static struct spear_modemux i2s_out_modemux[] = {
1267 .muxregs = i2s_out_muxreg,
1268 .nmuxregs = ARRAY_SIZE(i2s_out_muxreg),
1272 static struct spear_pingroup i2s_out_pingroup = {
1273 .name = "i2s_out_grp",
1274 .pins = i2s_out_pins,
1275 .npins = ARRAY_SIZE(i2s_out_pins),
1276 .modemuxs = i2s_out_modemux,
1277 .nmodemuxs = ARRAY_SIZE(i2s_out_modemux),
1280 static const char *const i2s_grps[] = { "i2s_in_grp", "i2s_out_grp" };
1281 static struct spear_function i2s_function = {
1282 .name = "i2s",
1283 .groups = i2s_grps,
1284 .ngroups = ARRAY_SIZE(i2s_grps),
1287 /* pad multiplexing for gmac device */
1288 static const unsigned gmac_pins[] = { 104, 105, 106, 107, 108, 109, 110, 111,
1289 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1290 126, 127, 128, 129, 130, 131 };
1291 #define GMAC_MUXREG \
1293 .reg = PAD_FUNCTION_EN_4, \
1294 .mask = GMAC_REG3_MASK, \
1295 .val = GMAC_REG3_MASK, \
1296 }, { \
1297 .reg = PAD_FUNCTION_EN_5, \
1298 .mask = GMAC_REG4_MASK, \
1299 .val = GMAC_REG4_MASK, \
1302 /* pad multiplexing for gmii device */
1303 static struct spear_muxreg gmii_muxreg[] = {
1304 GMAC_MUXREG,
1306 .reg = GMAC_CLK_CFG,
1307 .mask = GMAC_PHY_IF_SEL_MASK,
1308 .val = GMAC_PHY_IF_GMII_VAL,
1312 static struct spear_modemux gmii_modemux[] = {
1314 .muxregs = gmii_muxreg,
1315 .nmuxregs = ARRAY_SIZE(gmii_muxreg),
1319 static struct spear_pingroup gmii_pingroup = {
1320 .name = "gmii_grp",
1321 .pins = gmac_pins,
1322 .npins = ARRAY_SIZE(gmac_pins),
1323 .modemuxs = gmii_modemux,
1324 .nmodemuxs = ARRAY_SIZE(gmii_modemux),
1327 /* pad multiplexing for rgmii device */
1328 static struct spear_muxreg rgmii_muxreg[] = {
1329 GMAC_MUXREG,
1331 .reg = GMAC_CLK_CFG,
1332 .mask = GMAC_PHY_IF_SEL_MASK,
1333 .val = GMAC_PHY_IF_RGMII_VAL,
1337 static struct spear_modemux rgmii_modemux[] = {
1339 .muxregs = rgmii_muxreg,
1340 .nmuxregs = ARRAY_SIZE(rgmii_muxreg),
1344 static struct spear_pingroup rgmii_pingroup = {
1345 .name = "rgmii_grp",
1346 .pins = gmac_pins,
1347 .npins = ARRAY_SIZE(gmac_pins),
1348 .modemuxs = rgmii_modemux,
1349 .nmodemuxs = ARRAY_SIZE(rgmii_modemux),
1352 /* pad multiplexing for rmii device */
1353 static struct spear_muxreg rmii_muxreg[] = {
1354 GMAC_MUXREG,
1356 .reg = GMAC_CLK_CFG,
1357 .mask = GMAC_PHY_IF_SEL_MASK,
1358 .val = GMAC_PHY_IF_RMII_VAL,
1362 static struct spear_modemux rmii_modemux[] = {
1364 .muxregs = rmii_muxreg,
1365 .nmuxregs = ARRAY_SIZE(rmii_muxreg),
1369 static struct spear_pingroup rmii_pingroup = {
1370 .name = "rmii_grp",
1371 .pins = gmac_pins,
1372 .npins = ARRAY_SIZE(gmac_pins),
1373 .modemuxs = rmii_modemux,
1374 .nmodemuxs = ARRAY_SIZE(rmii_modemux),
1377 /* pad multiplexing for sgmii device */
1378 static struct spear_muxreg sgmii_muxreg[] = {
1379 GMAC_MUXREG,
1381 .reg = GMAC_CLK_CFG,
1382 .mask = GMAC_PHY_IF_SEL_MASK,
1383 .val = GMAC_PHY_IF_SGMII_VAL,
1387 static struct spear_modemux sgmii_modemux[] = {
1389 .muxregs = sgmii_muxreg,
1390 .nmuxregs = ARRAY_SIZE(sgmii_muxreg),
1394 static struct spear_pingroup sgmii_pingroup = {
1395 .name = "sgmii_grp",
1396 .pins = gmac_pins,
1397 .npins = ARRAY_SIZE(gmac_pins),
1398 .modemuxs = sgmii_modemux,
1399 .nmodemuxs = ARRAY_SIZE(sgmii_modemux),
1402 static const char *const gmac_grps[] = { "gmii_grp", "rgmii_grp", "rmii_grp",
1403 "sgmii_grp" };
1404 static struct spear_function gmac_function = {
1405 .name = "gmac",
1406 .groups = gmac_grps,
1407 .ngroups = ARRAY_SIZE(gmac_grps),
1410 /* pad multiplexing for i2c0 device */
1411 static const unsigned i2c0_pins[] = { 133, 134 };
1412 static struct spear_muxreg i2c0_muxreg[] = {
1414 .reg = PAD_FUNCTION_EN_5,
1415 .mask = I2C0_REG4_MASK,
1416 .val = I2C0_REG4_MASK,
1420 static struct spear_modemux i2c0_modemux[] = {
1422 .muxregs = i2c0_muxreg,
1423 .nmuxregs = ARRAY_SIZE(i2c0_muxreg),
1427 static struct spear_pingroup i2c0_pingroup = {
1428 .name = "i2c0_grp",
1429 .pins = i2c0_pins,
1430 .npins = ARRAY_SIZE(i2c0_pins),
1431 .modemuxs = i2c0_modemux,
1432 .nmodemuxs = ARRAY_SIZE(i2c0_modemux),
1435 static const char *const i2c0_grps[] = { "i2c0_grp" };
1436 static struct spear_function i2c0_function = {
1437 .name = "i2c0",
1438 .groups = i2c0_grps,
1439 .ngroups = ARRAY_SIZE(i2c0_grps),
1442 /* pad multiplexing for i2c1 device */
1443 static const unsigned i2c1_pins[] = { 18, 23 };
1444 static struct spear_muxreg i2c1_muxreg[] = {
1446 .reg = PAD_FUNCTION_EN_1,
1447 .mask = I2C1_REG0_MASK,
1448 .val = I2C1_REG0_MASK,
1452 static struct spear_modemux i2c1_modemux[] = {
1454 .muxregs = i2c1_muxreg,
1455 .nmuxregs = ARRAY_SIZE(i2c1_muxreg),
1459 static struct spear_pingroup i2c1_pingroup = {
1460 .name = "i2c1_grp",
1461 .pins = i2c1_pins,
1462 .npins = ARRAY_SIZE(i2c1_pins),
1463 .modemuxs = i2c1_modemux,
1464 .nmodemuxs = ARRAY_SIZE(i2c1_modemux),
1467 static const char *const i2c1_grps[] = { "i2c1_grp" };
1468 static struct spear_function i2c1_function = {
1469 .name = "i2c1",
1470 .groups = i2c1_grps,
1471 .ngroups = ARRAY_SIZE(i2c1_grps),
1474 /* pad multiplexing for cec0 device */
1475 static const unsigned cec0_pins[] = { 135 };
1476 static struct spear_muxreg cec0_muxreg[] = {
1478 .reg = PAD_FUNCTION_EN_5,
1479 .mask = CEC0_REG4_MASK,
1480 .val = CEC0_REG4_MASK,
1484 static struct spear_modemux cec0_modemux[] = {
1486 .muxregs = cec0_muxreg,
1487 .nmuxregs = ARRAY_SIZE(cec0_muxreg),
1491 static struct spear_pingroup cec0_pingroup = {
1492 .name = "cec0_grp",
1493 .pins = cec0_pins,
1494 .npins = ARRAY_SIZE(cec0_pins),
1495 .modemuxs = cec0_modemux,
1496 .nmodemuxs = ARRAY_SIZE(cec0_modemux),
1499 static const char *const cec0_grps[] = { "cec0_grp" };
1500 static struct spear_function cec0_function = {
1501 .name = "cec0",
1502 .groups = cec0_grps,
1503 .ngroups = ARRAY_SIZE(cec0_grps),
1506 /* pad multiplexing for cec1 device */
1507 static const unsigned cec1_pins[] = { 136 };
1508 static struct spear_muxreg cec1_muxreg[] = {
1510 .reg = PAD_FUNCTION_EN_5,
1511 .mask = CEC1_REG4_MASK,
1512 .val = CEC1_REG4_MASK,
1516 static struct spear_modemux cec1_modemux[] = {
1518 .muxregs = cec1_muxreg,
1519 .nmuxregs = ARRAY_SIZE(cec1_muxreg),
1523 static struct spear_pingroup cec1_pingroup = {
1524 .name = "cec1_grp",
1525 .pins = cec1_pins,
1526 .npins = ARRAY_SIZE(cec1_pins),
1527 .modemuxs = cec1_modemux,
1528 .nmodemuxs = ARRAY_SIZE(cec1_modemux),
1531 static const char *const cec1_grps[] = { "cec1_grp" };
1532 static struct spear_function cec1_function = {
1533 .name = "cec1",
1534 .groups = cec1_grps,
1535 .ngroups = ARRAY_SIZE(cec1_grps),
1538 /* pad multiplexing for mcif devices */
1539 static const unsigned mcif_pins[] = { 193, 194, 195, 196, 197, 198, 199, 200,
1540 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
1541 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
1542 229, 230, 231, 232, 237 };
1543 #define MCIF_MUXREG \
1545 .reg = PAD_SHARED_IP_EN_1, \
1546 .mask = MCIF_MASK, \
1547 .val = MCIF_MASK, \
1548 }, { \
1549 .reg = PAD_FUNCTION_EN_7, \
1550 .mask = FSMC_PNOR_AND_MCIF_REG6_MASK | MCIF_REG6_MASK, \
1551 .val = FSMC_PNOR_AND_MCIF_REG6_MASK | MCIF_REG6_MASK, \
1552 }, { \
1553 .reg = PAD_FUNCTION_EN_8, \
1554 .mask = MCIF_REG7_MASK, \
1555 .val = MCIF_REG7_MASK, \
1558 /* Pad multiplexing for sdhci device */
1559 static struct spear_muxreg sdhci_muxreg[] = {
1560 MCIF_MUXREG,
1562 .reg = PERIP_CFG,
1563 .mask = MCIF_SEL_MASK,
1564 .val = MCIF_SEL_SD,
1568 static struct spear_modemux sdhci_modemux[] = {
1570 .muxregs = sdhci_muxreg,
1571 .nmuxregs = ARRAY_SIZE(sdhci_muxreg),
1575 static struct spear_pingroup sdhci_pingroup = {
1576 .name = "sdhci_grp",
1577 .pins = mcif_pins,
1578 .npins = ARRAY_SIZE(mcif_pins),
1579 .modemuxs = sdhci_modemux,
1580 .nmodemuxs = ARRAY_SIZE(sdhci_modemux),
1583 static const char *const sdhci_grps[] = { "sdhci_grp" };
1584 static struct spear_function sdhci_function = {
1585 .name = "sdhci",
1586 .groups = sdhci_grps,
1587 .ngroups = ARRAY_SIZE(sdhci_grps),
1590 /* Pad multiplexing for cf device */
1591 static struct spear_muxreg cf_muxreg[] = {
1592 MCIF_MUXREG,
1594 .reg = PERIP_CFG,
1595 .mask = MCIF_SEL_MASK,
1596 .val = MCIF_SEL_CF,
1600 static struct spear_modemux cf_modemux[] = {
1602 .muxregs = cf_muxreg,
1603 .nmuxregs = ARRAY_SIZE(cf_muxreg),
1607 static struct spear_pingroup cf_pingroup = {
1608 .name = "cf_grp",
1609 .pins = mcif_pins,
1610 .npins = ARRAY_SIZE(mcif_pins),
1611 .modemuxs = cf_modemux,
1612 .nmodemuxs = ARRAY_SIZE(cf_modemux),
1615 static const char *const cf_grps[] = { "cf_grp" };
1616 static struct spear_function cf_function = {
1617 .name = "cf",
1618 .groups = cf_grps,
1619 .ngroups = ARRAY_SIZE(cf_grps),
1622 /* Pad multiplexing for xd device */
1623 static struct spear_muxreg xd_muxreg[] = {
1624 MCIF_MUXREG,
1626 .reg = PERIP_CFG,
1627 .mask = MCIF_SEL_MASK,
1628 .val = MCIF_SEL_XD,
1632 static struct spear_modemux xd_modemux[] = {
1634 .muxregs = xd_muxreg,
1635 .nmuxregs = ARRAY_SIZE(xd_muxreg),
1639 static struct spear_pingroup xd_pingroup = {
1640 .name = "xd_grp",
1641 .pins = mcif_pins,
1642 .npins = ARRAY_SIZE(mcif_pins),
1643 .modemuxs = xd_modemux,
1644 .nmodemuxs = ARRAY_SIZE(xd_modemux),
1647 static const char *const xd_grps[] = { "xd_grp" };
1648 static struct spear_function xd_function = {
1649 .name = "xd",
1650 .groups = xd_grps,
1651 .ngroups = ARRAY_SIZE(xd_grps),
1654 /* pad multiplexing for clcd device */
1655 static const unsigned clcd_pins[] = { 138, 139, 140, 141, 142, 143, 144, 145,
1656 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1657 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
1658 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1659 188, 189, 190, 191 };
1660 static struct spear_muxreg clcd_muxreg[] = {
1662 .reg = PAD_SHARED_IP_EN_1,
1663 .mask = ARM_TRACE_MASK | MIPHY_DBG_MASK,
1664 .val = 0,
1665 }, {
1666 .reg = PAD_FUNCTION_EN_5,
1667 .mask = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
1668 .val = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
1669 }, {
1670 .reg = PAD_FUNCTION_EN_6,
1671 .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
1672 .val = CLCD_AND_ARM_TRACE_REG5_MASK,
1673 }, {
1674 .reg = PAD_FUNCTION_EN_7,
1675 .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
1676 .val = CLCD_AND_ARM_TRACE_REG6_MASK,
1680 static struct spear_modemux clcd_modemux[] = {
1682 .muxregs = clcd_muxreg,
1683 .nmuxregs = ARRAY_SIZE(clcd_muxreg),
1687 static struct spear_pingroup clcd_pingroup = {
1688 .name = "clcd_grp",
1689 .pins = clcd_pins,
1690 .npins = ARRAY_SIZE(clcd_pins),
1691 .modemuxs = clcd_modemux,
1692 .nmodemuxs = ARRAY_SIZE(clcd_modemux),
1695 /* Disable cld runtime to save panel damage */
1696 static struct spear_muxreg clcd_sleep_muxreg[] = {
1698 .reg = PAD_SHARED_IP_EN_1,
1699 .mask = ARM_TRACE_MASK | MIPHY_DBG_MASK,
1700 .val = 0,
1701 }, {
1702 .reg = PAD_FUNCTION_EN_5,
1703 .mask = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
1704 .val = 0x0,
1705 }, {
1706 .reg = PAD_FUNCTION_EN_6,
1707 .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
1708 .val = 0x0,
1709 }, {
1710 .reg = PAD_FUNCTION_EN_7,
1711 .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
1712 .val = 0x0,
1716 static struct spear_modemux clcd_sleep_modemux[] = {
1718 .muxregs = clcd_sleep_muxreg,
1719 .nmuxregs = ARRAY_SIZE(clcd_sleep_muxreg),
1723 static struct spear_pingroup clcd_sleep_pingroup = {
1724 .name = "clcd_sleep_grp",
1725 .pins = clcd_pins,
1726 .npins = ARRAY_SIZE(clcd_pins),
1727 .modemuxs = clcd_sleep_modemux,
1728 .nmodemuxs = ARRAY_SIZE(clcd_sleep_modemux),
1731 static const char *const clcd_grps[] = { "clcd_grp", "clcd_sleep_grp" };
1732 static struct spear_function clcd_function = {
1733 .name = "clcd",
1734 .groups = clcd_grps,
1735 .ngroups = ARRAY_SIZE(clcd_grps),
1738 /* pad multiplexing for arm_trace device */
1739 static const unsigned arm_trace_pins[] = { 158, 159, 160, 161, 162, 163, 164,
1740 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
1741 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
1742 193, 194, 195, 196, 197, 198, 199, 200 };
1743 static struct spear_muxreg arm_trace_muxreg[] = {
1745 .reg = PAD_SHARED_IP_EN_1,
1746 .mask = ARM_TRACE_MASK,
1747 .val = ARM_TRACE_MASK,
1748 }, {
1749 .reg = PAD_FUNCTION_EN_5,
1750 .mask = CLCD_AND_ARM_TRACE_REG4_MASK,
1751 .val = CLCD_AND_ARM_TRACE_REG4_MASK,
1752 }, {
1753 .reg = PAD_FUNCTION_EN_6,
1754 .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
1755 .val = CLCD_AND_ARM_TRACE_REG5_MASK,
1756 }, {
1757 .reg = PAD_FUNCTION_EN_7,
1758 .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
1759 .val = CLCD_AND_ARM_TRACE_REG6_MASK,
1763 static struct spear_modemux arm_trace_modemux[] = {
1765 .muxregs = arm_trace_muxreg,
1766 .nmuxregs = ARRAY_SIZE(arm_trace_muxreg),
1770 static struct spear_pingroup arm_trace_pingroup = {
1771 .name = "arm_trace_grp",
1772 .pins = arm_trace_pins,
1773 .npins = ARRAY_SIZE(arm_trace_pins),
1774 .modemuxs = arm_trace_modemux,
1775 .nmodemuxs = ARRAY_SIZE(arm_trace_modemux),
1778 static const char *const arm_trace_grps[] = { "arm_trace_grp" };
1779 static struct spear_function arm_trace_function = {
1780 .name = "arm_trace",
1781 .groups = arm_trace_grps,
1782 .ngroups = ARRAY_SIZE(arm_trace_grps),
1785 /* pad multiplexing for miphy_dbg device */
1786 static const unsigned miphy_dbg_pins[] = { 96, 97, 98, 99, 100, 101, 102, 103,
1787 132, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
1788 148, 149, 150, 151, 152, 153, 154, 155, 156, 157 };
1789 static struct spear_muxreg miphy_dbg_muxreg[] = {
1791 .reg = PAD_SHARED_IP_EN_1,
1792 .mask = MIPHY_DBG_MASK,
1793 .val = MIPHY_DBG_MASK,
1794 }, {
1795 .reg = PAD_FUNCTION_EN_5,
1796 .mask = DEVS_GRP_AND_MIPHY_DBG_REG4_MASK,
1797 .val = DEVS_GRP_AND_MIPHY_DBG_REG4_MASK,
1801 static struct spear_modemux miphy_dbg_modemux[] = {
1803 .muxregs = miphy_dbg_muxreg,
1804 .nmuxregs = ARRAY_SIZE(miphy_dbg_muxreg),
1808 static struct spear_pingroup miphy_dbg_pingroup = {
1809 .name = "miphy_dbg_grp",
1810 .pins = miphy_dbg_pins,
1811 .npins = ARRAY_SIZE(miphy_dbg_pins),
1812 .modemuxs = miphy_dbg_modemux,
1813 .nmodemuxs = ARRAY_SIZE(miphy_dbg_modemux),
1816 static const char *const miphy_dbg_grps[] = { "miphy_dbg_grp" };
1817 static struct spear_function miphy_dbg_function = {
1818 .name = "miphy_dbg",
1819 .groups = miphy_dbg_grps,
1820 .ngroups = ARRAY_SIZE(miphy_dbg_grps),
1823 /* pad multiplexing for pcie device */
1824 static const unsigned pcie_pins[] = { 250 };
1825 static struct spear_muxreg pcie_muxreg[] = {
1827 .reg = PCIE_SATA_CFG,
1828 .mask = SATA_PCIE_CFG_MASK,
1829 .val = PCIE_CFG_VAL,
1833 static struct spear_modemux pcie_modemux[] = {
1835 .muxregs = pcie_muxreg,
1836 .nmuxregs = ARRAY_SIZE(pcie_muxreg),
1840 static struct spear_pingroup pcie_pingroup = {
1841 .name = "pcie_grp",
1842 .pins = pcie_pins,
1843 .npins = ARRAY_SIZE(pcie_pins),
1844 .modemuxs = pcie_modemux,
1845 .nmodemuxs = ARRAY_SIZE(pcie_modemux),
1848 static const char *const pcie_grps[] = { "pcie_grp" };
1849 static struct spear_function pcie_function = {
1850 .name = "pcie",
1851 .groups = pcie_grps,
1852 .ngroups = ARRAY_SIZE(pcie_grps),
1855 /* pad multiplexing for sata device */
1856 static const unsigned sata_pins[] = { 250 };
1857 static struct spear_muxreg sata_muxreg[] = {
1859 .reg = PCIE_SATA_CFG,
1860 .mask = SATA_PCIE_CFG_MASK,
1861 .val = SATA_CFG_VAL,
1865 static struct spear_modemux sata_modemux[] = {
1867 .muxregs = sata_muxreg,
1868 .nmuxregs = ARRAY_SIZE(sata_muxreg),
1872 static struct spear_pingroup sata_pingroup = {
1873 .name = "sata_grp",
1874 .pins = sata_pins,
1875 .npins = ARRAY_SIZE(sata_pins),
1876 .modemuxs = sata_modemux,
1877 .nmodemuxs = ARRAY_SIZE(sata_modemux),
1880 static const char *const sata_grps[] = { "sata_grp" };
1881 static struct spear_function sata_function = {
1882 .name = "sata",
1883 .groups = sata_grps,
1884 .ngroups = ARRAY_SIZE(sata_grps),
1887 /* pingroups */
1888 static struct spear_pingroup *spear1340_pingroups[] = {
1889 &pads_as_gpio_pingroup,
1890 &fsmc_8bit_pingroup,
1891 &fsmc_16bit_pingroup,
1892 &fsmc_pnor_pingroup,
1893 &keyboard_row_col_pingroup,
1894 &keyboard_col5_pingroup,
1895 &spdif_in_pingroup,
1896 &spdif_out_pingroup,
1897 &gpt_0_1_pingroup,
1898 &pwm0_pingroup,
1899 &pwm1_pingroup,
1900 &pwm2_pingroup,
1901 &pwm3_pingroup,
1902 &vip_mux_pingroup,
1903 &vip_mux_cam0_pingroup,
1904 &vip_mux_cam1_pingroup,
1905 &vip_mux_cam2_pingroup,
1906 &vip_mux_cam3_pingroup,
1907 &cam0_pingroup,
1908 &cam1_pingroup,
1909 &cam2_pingroup,
1910 &cam3_pingroup,
1911 &smi_pingroup,
1912 &ssp0_pingroup,
1913 &ssp0_cs1_pingroup,
1914 &ssp0_cs2_pingroup,
1915 &ssp0_cs3_pingroup,
1916 &uart0_pingroup,
1917 &uart0_enh_pingroup,
1918 &uart1_pingroup,
1919 &i2s_in_pingroup,
1920 &i2s_out_pingroup,
1921 &gmii_pingroup,
1922 &rgmii_pingroup,
1923 &rmii_pingroup,
1924 &sgmii_pingroup,
1925 &i2c0_pingroup,
1926 &i2c1_pingroup,
1927 &cec0_pingroup,
1928 &cec1_pingroup,
1929 &sdhci_pingroup,
1930 &cf_pingroup,
1931 &xd_pingroup,
1932 &clcd_sleep_pingroup,
1933 &clcd_pingroup,
1934 &arm_trace_pingroup,
1935 &miphy_dbg_pingroup,
1936 &pcie_pingroup,
1937 &sata_pingroup,
1940 /* functions */
1941 static struct spear_function *spear1340_functions[] = {
1942 &pads_as_gpio_function,
1943 &fsmc_function,
1944 &keyboard_function,
1945 &spdif_in_function,
1946 &spdif_out_function,
1947 &gpt_0_1_function,
1948 &pwm_function,
1949 &vip_function,
1950 &cam0_function,
1951 &cam1_function,
1952 &cam2_function,
1953 &cam3_function,
1954 &smi_function,
1955 &ssp0_function,
1956 &uart0_function,
1957 &uart1_function,
1958 &i2s_function,
1959 &gmac_function,
1960 &i2c0_function,
1961 &i2c1_function,
1962 &cec0_function,
1963 &cec1_function,
1964 &sdhci_function,
1965 &cf_function,
1966 &xd_function,
1967 &clcd_function,
1968 &arm_trace_function,
1969 &miphy_dbg_function,
1970 &pcie_function,
1971 &sata_function,
1974 static void gpio_request_endisable(struct spear_pmx *pmx, int pin,
1975 bool enable)
1977 unsigned int regoffset, regindex, bitoffset;
1978 unsigned int val;
1980 /* pin++ as gpio configuration starts from 2nd bit of base register */
1981 pin++;
1983 regindex = pin / 32;
1984 bitoffset = pin % 32;
1986 if (regindex <= 3)
1987 regoffset = PAD_FUNCTION_EN_1 + regindex * sizeof(int *);
1988 else
1989 regoffset = PAD_FUNCTION_EN_5 + (regindex - 4) * sizeof(int *);
1991 val = pmx_readl(pmx, regoffset);
1992 if (enable)
1993 val &= ~(0x1 << bitoffset);
1994 else
1995 val |= 0x1 << bitoffset;
1997 pmx_writel(pmx, val, regoffset);
2000 static struct spear_pinctrl_machdata spear1340_machdata = {
2001 .pins = spear1340_pins,
2002 .npins = ARRAY_SIZE(spear1340_pins),
2003 .groups = spear1340_pingroups,
2004 .ngroups = ARRAY_SIZE(spear1340_pingroups),
2005 .functions = spear1340_functions,
2006 .nfunctions = ARRAY_SIZE(spear1340_functions),
2007 .gpio_request_endisable = gpio_request_endisable,
2008 .modes_supported = false,
2011 static struct of_device_id spear1340_pinctrl_of_match[] = {
2013 .compatible = "st,spear1340-pinmux",
2018 static int spear1340_pinctrl_probe(struct platform_device *pdev)
2020 return spear_pinctrl_probe(pdev, &spear1340_machdata);
2023 static int spear1340_pinctrl_remove(struct platform_device *pdev)
2025 return spear_pinctrl_remove(pdev);
2028 static struct platform_driver spear1340_pinctrl_driver = {
2029 .driver = {
2030 .name = DRIVER_NAME,
2031 .owner = THIS_MODULE,
2032 .of_match_table = spear1340_pinctrl_of_match,
2034 .probe = spear1340_pinctrl_probe,
2035 .remove = spear1340_pinctrl_remove,
2038 static int __init spear1340_pinctrl_init(void)
2040 return platform_driver_register(&spear1340_pinctrl_driver);
2042 arch_initcall(spear1340_pinctrl_init);
2044 static void __exit spear1340_pinctrl_exit(void)
2046 platform_driver_unregister(&spear1340_pinctrl_driver);
2048 module_exit(spear1340_pinctrl_exit);
2050 MODULE_AUTHOR("Viresh Kumar <viresh.linux@gmail.com>");
2051 MODULE_DESCRIPTION("ST Microelectronics SPEAr1340 pinctrl driver");
2052 MODULE_LICENSE("GPL v2");
2053 MODULE_DEVICE_TABLE(of, spear1340_pinctrl_of_match);