0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #include <linux/err.h>
0013 #include <linux/init.h>
0014 #include <linux/of_device.h>
0015 #include <linux/platform_device.h>
0016 #include "pinctrl-spear.h"
0017
0018 #define DRIVER_NAME "spear1340-pinmux"
0019
0020
0021 static const struct pinctrl_pin_desc spear1340_pins[] = {
0022 SPEAR_PIN_0_TO_101,
0023 SPEAR_PIN_102_TO_245,
0024 PINCTRL_PIN(246, "PLGPIO246"),
0025 PINCTRL_PIN(247, "PLGPIO247"),
0026 PINCTRL_PIN(248, "PLGPIO248"),
0027 PINCTRL_PIN(249, "PLGPIO249"),
0028 PINCTRL_PIN(250, "PLGPIO250"),
0029 PINCTRL_PIN(251, "PLGPIO251"),
0030 };
0031
0032
0033
0034 #define PAD_FUNCTION_EN_1 0x668
0035 #define PAD_FUNCTION_EN_2 0x66C
0036 #define PAD_FUNCTION_EN_3 0x670
0037 #define PAD_FUNCTION_EN_4 0x674
0038 #define PAD_FUNCTION_EN_5 0x690
0039 #define PAD_FUNCTION_EN_6 0x694
0040 #define PAD_FUNCTION_EN_7 0x698
0041 #define PAD_FUNCTION_EN_8 0x69C
0042
0043
0044 #define PAD_SHARED_IP_EN_1 0x6A0
0045 #define PAD_SHARED_IP_EN_2 0x6A4
0046
0047
0048
0049
0050
0051
0052
0053 #define PADS_AS_GPIO_REG0_MASK 0xFFFFFFFE
0054 #define PADS_AS_GPIO_REGS_MASK 0xFFFFFFFF
0055 #define PADS_AS_GPIO_REG7_MASK 0x07FFFFFF
0056
0057
0058 #define FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK 0x00000FFE
0059 #define UART0_ENH_AND_GPT_REG0_MASK 0x0003F000
0060 #define PWM1_AND_KBD_COL5_REG0_MASK 0x00040000
0061 #define I2C1_REG0_MASK 0x01080000
0062 #define SPDIF_IN_REG0_MASK 0x00100000
0063 #define PWM2_AND_GPT0_TMR0_CPT_REG0_MASK 0x00400000
0064 #define PWM3_AND_GPT0_TMR1_CLK_REG0_MASK 0x00800000
0065 #define PWM0_AND_SSP0_CS1_REG0_MASK 0x02000000
0066 #define VIP_AND_CAM3_REG0_MASK 0xFC200000
0067 #define VIP_AND_CAM3_REG1_MASK 0x0000000F
0068 #define VIP_REG1_MASK 0x00001EF0
0069 #define VIP_AND_CAM2_REG1_MASK 0x007FE100
0070 #define VIP_AND_CAM1_REG1_MASK 0xFF800000
0071 #define VIP_AND_CAM1_REG2_MASK 0x00000003
0072 #define VIP_AND_CAM0_REG2_MASK 0x00001FFC
0073 #define SMI_REG2_MASK 0x0021E000
0074 #define SSP0_REG2_MASK 0x001E0000
0075 #define TS_AND_SSP0_CS2_REG2_MASK 0x00400000
0076 #define UART0_REG2_MASK 0x01800000
0077 #define UART1_REG2_MASK 0x06000000
0078 #define I2S_IN_REG2_MASK 0xF8000000
0079 #define DEVS_GRP_AND_MIPHY_DBG_REG3_MASK 0x000001FE
0080 #define I2S_OUT_REG3_MASK 0x000001EF
0081 #define I2S_IN_REG3_MASK 0x00000010
0082 #define GMAC_REG3_MASK 0xFFFFFE00
0083 #define GMAC_REG4_MASK 0x0000001F
0084 #define DEVS_GRP_AND_MIPHY_DBG_REG4_MASK 0x7FFFFF20
0085 #define SSP0_CS3_REG4_MASK 0x00000020
0086 #define I2C0_REG4_MASK 0x000000C0
0087 #define CEC0_REG4_MASK 0x00000100
0088 #define CEC1_REG4_MASK 0x00000200
0089 #define SPDIF_OUT_REG4_MASK 0x00000400
0090 #define CLCD_REG4_MASK 0x7FFFF800
0091 #define CLCD_AND_ARM_TRACE_REG4_MASK 0x80000000
0092 #define CLCD_AND_ARM_TRACE_REG5_MASK 0xFFFFFFFF
0093 #define CLCD_AND_ARM_TRACE_REG6_MASK 0x00000001
0094 #define FSMC_PNOR_AND_MCIF_REG6_MASK 0x073FFFFE
0095 #define MCIF_REG6_MASK 0xF8C00000
0096 #define MCIF_REG7_MASK 0x000043FF
0097 #define FSMC_8BIT_REG7_MASK 0x07FFBC00
0098
0099
0100 #define PERIP_CFG 0x42C
0101
0102 #define SSP_CS_CTL_HW 0
0103 #define SSP_CS_CTL_SW 1
0104 #define SSP_CS_CTL_MASK 1
0105 #define SSP_CS_CTL_SHIFT 21
0106 #define SSP_CS_VAL_MASK 1
0107 #define SSP_CS_VAL_SHIFT 20
0108 #define SSP_CS_SEL_CS0 0
0109 #define SSP_CS_SEL_CS1 1
0110 #define SSP_CS_SEL_CS2 2
0111 #define SSP_CS_SEL_MASK 3
0112 #define SSP_CS_SEL_SHIFT 18
0113
0114 #define I2S_CHNL_2_0 (0)
0115 #define I2S_CHNL_3_1 (1)
0116 #define I2S_CHNL_5_1 (2)
0117 #define I2S_CHNL_7_1 (3)
0118 #define I2S_CHNL_PLAY_SHIFT (4)
0119 #define I2S_CHNL_PLAY_MASK (3 << 4)
0120 #define I2S_CHNL_REC_SHIFT (6)
0121 #define I2S_CHNL_REC_MASK (3 << 6)
0122
0123 #define SPDIF_OUT_ENB_MASK (1 << 2)
0124 #define SPDIF_OUT_ENB_SHIFT 2
0125
0126 #define MCIF_SEL_SD 1
0127 #define MCIF_SEL_CF 2
0128 #define MCIF_SEL_XD 3
0129 #define MCIF_SEL_MASK 3
0130 #define MCIF_SEL_SHIFT 0
0131
0132 #define GMAC_CLK_CFG 0x248
0133 #define GMAC_PHY_IF_GMII_VAL (0 << 3)
0134 #define GMAC_PHY_IF_RGMII_VAL (1 << 3)
0135 #define GMAC_PHY_IF_SGMII_VAL (2 << 3)
0136 #define GMAC_PHY_IF_RMII_VAL (4 << 3)
0137 #define GMAC_PHY_IF_SEL_MASK (7 << 3)
0138 #define GMAC_PHY_INPUT_ENB_VAL 0
0139 #define GMAC_PHY_SYNT_ENB_VAL 1
0140 #define GMAC_PHY_CLK_MASK 1
0141 #define GMAC_PHY_CLK_SHIFT 2
0142 #define GMAC_PHY_125M_PAD_VAL 0
0143 #define GMAC_PHY_PLL2_VAL 1
0144 #define GMAC_PHY_OSC3_VAL 2
0145 #define GMAC_PHY_INPUT_CLK_MASK 3
0146 #define GMAC_PHY_INPUT_CLK_SHIFT 0
0147
0148 #define PCIE_SATA_CFG 0x424
0149
0150 #define PCIE_CFG_DEVICE_PRESENT (1 << 11)
0151 #define PCIE_CFG_POWERUP_RESET (1 << 10)
0152 #define PCIE_CFG_CORE_CLK_EN (1 << 9)
0153 #define PCIE_CFG_AUX_CLK_EN (1 << 8)
0154 #define SATA_CFG_TX_CLK_EN (1 << 4)
0155 #define SATA_CFG_RX_CLK_EN (1 << 3)
0156 #define SATA_CFG_POWERUP_RESET (1 << 2)
0157 #define SATA_CFG_PM_CLK_EN (1 << 1)
0158 #define PCIE_SATA_SEL_PCIE (0)
0159 #define PCIE_SATA_SEL_SATA (1)
0160 #define SATA_PCIE_CFG_MASK 0xF1F
0161 #define PCIE_CFG_VAL (PCIE_SATA_SEL_PCIE | PCIE_CFG_AUX_CLK_EN | \
0162 PCIE_CFG_CORE_CLK_EN | PCIE_CFG_POWERUP_RESET |\
0163 PCIE_CFG_DEVICE_PRESENT)
0164 #define SATA_CFG_VAL (PCIE_SATA_SEL_SATA | SATA_CFG_PM_CLK_EN | \
0165 SATA_CFG_POWERUP_RESET | SATA_CFG_RX_CLK_EN | \
0166 SATA_CFG_TX_CLK_EN)
0167
0168
0169
0170 #define KBD_ROW_COL_MASK (1 << 0)
0171
0172
0173 #define GPT_MASK (1 << 1)
0174
0175
0176 #define KBD_COL5_MASK (1 << 2)
0177
0178
0179 #define GPT0_TMR0_CPT_MASK (1 << 3)
0180
0181
0182 #define GPT0_TMR1_CLK_MASK (1 << 4)
0183
0184
0185 #define SSP0_CS1_MASK (1 << 5)
0186
0187
0188 #define CAM3_MASK (1 << 6)
0189
0190
0191 #define CAM2_MASK (1 << 7)
0192
0193
0194 #define CAM1_MASK (1 << 8)
0195
0196
0197 #define CAM0_MASK (1 << 9)
0198
0199
0200 #define SSP0_CS2_MASK (1 << 10)
0201
0202
0203 #define MCIF_MASK (1 << 11)
0204
0205
0206 #define ARM_TRACE_MASK (1 << 12)
0207
0208
0209 #define MIPHY_DBG_MASK (1 << 13)
0210
0211
0212
0213
0214
0215 static const unsigned pads_as_gpio_pins[] = { 12, 88, 89, 251 };
0216 static struct spear_muxreg pads_as_gpio_muxreg[] = {
0217 {
0218 .reg = PAD_FUNCTION_EN_1,
0219 .mask = PADS_AS_GPIO_REG0_MASK,
0220 .val = 0x0,
0221 }, {
0222 .reg = PAD_FUNCTION_EN_2,
0223 .mask = PADS_AS_GPIO_REGS_MASK,
0224 .val = 0x0,
0225 }, {
0226 .reg = PAD_FUNCTION_EN_3,
0227 .mask = PADS_AS_GPIO_REGS_MASK,
0228 .val = 0x0,
0229 }, {
0230 .reg = PAD_FUNCTION_EN_4,
0231 .mask = PADS_AS_GPIO_REGS_MASK,
0232 .val = 0x0,
0233 }, {
0234 .reg = PAD_FUNCTION_EN_5,
0235 .mask = PADS_AS_GPIO_REGS_MASK,
0236 .val = 0x0,
0237 }, {
0238 .reg = PAD_FUNCTION_EN_6,
0239 .mask = PADS_AS_GPIO_REGS_MASK,
0240 .val = 0x0,
0241 }, {
0242 .reg = PAD_FUNCTION_EN_7,
0243 .mask = PADS_AS_GPIO_REGS_MASK,
0244 .val = 0x0,
0245 }, {
0246 .reg = PAD_FUNCTION_EN_8,
0247 .mask = PADS_AS_GPIO_REG7_MASK,
0248 .val = 0x0,
0249 },
0250 };
0251
0252 static struct spear_modemux pads_as_gpio_modemux[] = {
0253 {
0254 .muxregs = pads_as_gpio_muxreg,
0255 .nmuxregs = ARRAY_SIZE(pads_as_gpio_muxreg),
0256 },
0257 };
0258
0259 static struct spear_pingroup pads_as_gpio_pingroup = {
0260 .name = "pads_as_gpio_grp",
0261 .pins = pads_as_gpio_pins,
0262 .npins = ARRAY_SIZE(pads_as_gpio_pins),
0263 .modemuxs = pads_as_gpio_modemux,
0264 .nmodemuxs = ARRAY_SIZE(pads_as_gpio_modemux),
0265 };
0266
0267 static const char *const pads_as_gpio_grps[] = { "pads_as_gpio_grp" };
0268 static struct spear_function pads_as_gpio_function = {
0269 .name = "pads_as_gpio",
0270 .groups = pads_as_gpio_grps,
0271 .ngroups = ARRAY_SIZE(pads_as_gpio_grps),
0272 };
0273
0274
0275 static const unsigned fsmc_8bit_pins[] = { 233, 234, 235, 236, 238, 239, 240,
0276 241, 242, 243, 244, 245, 246, 247, 248, 249 };
0277 static struct spear_muxreg fsmc_8bit_muxreg[] = {
0278 {
0279 .reg = PAD_FUNCTION_EN_8,
0280 .mask = FSMC_8BIT_REG7_MASK,
0281 .val = FSMC_8BIT_REG7_MASK,
0282 }
0283 };
0284
0285 static struct spear_modemux fsmc_8bit_modemux[] = {
0286 {
0287 .muxregs = fsmc_8bit_muxreg,
0288 .nmuxregs = ARRAY_SIZE(fsmc_8bit_muxreg),
0289 },
0290 };
0291
0292 static struct spear_pingroup fsmc_8bit_pingroup = {
0293 .name = "fsmc_8bit_grp",
0294 .pins = fsmc_8bit_pins,
0295 .npins = ARRAY_SIZE(fsmc_8bit_pins),
0296 .modemuxs = fsmc_8bit_modemux,
0297 .nmodemuxs = ARRAY_SIZE(fsmc_8bit_modemux),
0298 };
0299
0300
0301 static const unsigned fsmc_16bit_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
0302 static struct spear_muxreg fsmc_16bit_muxreg[] = {
0303 {
0304 .reg = PAD_SHARED_IP_EN_1,
0305 .mask = KBD_ROW_COL_MASK,
0306 .val = 0,
0307 }, {
0308 .reg = PAD_FUNCTION_EN_1,
0309 .mask = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
0310 .val = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
0311 },
0312 };
0313
0314 static struct spear_modemux fsmc_16bit_modemux[] = {
0315 {
0316 .muxregs = fsmc_16bit_muxreg,
0317 .nmuxregs = ARRAY_SIZE(fsmc_16bit_muxreg),
0318 },
0319 };
0320
0321 static struct spear_pingroup fsmc_16bit_pingroup = {
0322 .name = "fsmc_16bit_grp",
0323 .pins = fsmc_16bit_pins,
0324 .npins = ARRAY_SIZE(fsmc_16bit_pins),
0325 .modemuxs = fsmc_16bit_modemux,
0326 .nmodemuxs = ARRAY_SIZE(fsmc_16bit_modemux),
0327 };
0328
0329
0330 static const unsigned fsmc_pnor_pins[] = { 192, 193, 194, 195, 196, 197, 198,
0331 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
0332 215, 216, 217 };
0333 static struct spear_muxreg fsmc_pnor_muxreg[] = {
0334 {
0335 .reg = PAD_SHARED_IP_EN_1,
0336 .mask = MCIF_MASK,
0337 .val = 0,
0338 }, {
0339 .reg = PAD_FUNCTION_EN_7,
0340 .mask = FSMC_PNOR_AND_MCIF_REG6_MASK,
0341 .val = FSMC_PNOR_AND_MCIF_REG6_MASK,
0342 },
0343 };
0344
0345 static struct spear_modemux fsmc_pnor_modemux[] = {
0346 {
0347 .muxregs = fsmc_pnor_muxreg,
0348 .nmuxregs = ARRAY_SIZE(fsmc_pnor_muxreg),
0349 },
0350 };
0351
0352 static struct spear_pingroup fsmc_pnor_pingroup = {
0353 .name = "fsmc_pnor_grp",
0354 .pins = fsmc_pnor_pins,
0355 .npins = ARRAY_SIZE(fsmc_pnor_pins),
0356 .modemuxs = fsmc_pnor_modemux,
0357 .nmodemuxs = ARRAY_SIZE(fsmc_pnor_modemux),
0358 };
0359
0360 static const char *const fsmc_grps[] = { "fsmc_8bit_grp", "fsmc_16bit_grp",
0361 "fsmc_pnor_grp" };
0362 static struct spear_function fsmc_function = {
0363 .name = "fsmc",
0364 .groups = fsmc_grps,
0365 .ngroups = ARRAY_SIZE(fsmc_grps),
0366 };
0367
0368
0369 static const unsigned keyboard_row_col_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
0370 10 };
0371 static struct spear_muxreg keyboard_row_col_muxreg[] = {
0372 {
0373 .reg = PAD_SHARED_IP_EN_1,
0374 .mask = KBD_ROW_COL_MASK,
0375 .val = KBD_ROW_COL_MASK,
0376 }, {
0377 .reg = PAD_FUNCTION_EN_1,
0378 .mask = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
0379 .val = FSMC_16_BIT_AND_KBD_ROW_COL_REG0_MASK,
0380 },
0381 };
0382
0383 static struct spear_modemux keyboard_row_col_modemux[] = {
0384 {
0385 .muxregs = keyboard_row_col_muxreg,
0386 .nmuxregs = ARRAY_SIZE(keyboard_row_col_muxreg),
0387 },
0388 };
0389
0390 static struct spear_pingroup keyboard_row_col_pingroup = {
0391 .name = "keyboard_row_col_grp",
0392 .pins = keyboard_row_col_pins,
0393 .npins = ARRAY_SIZE(keyboard_row_col_pins),
0394 .modemuxs = keyboard_row_col_modemux,
0395 .nmodemuxs = ARRAY_SIZE(keyboard_row_col_modemux),
0396 };
0397
0398
0399 static const unsigned keyboard_col5_pins[] = { 17 };
0400 static struct spear_muxreg keyboard_col5_muxreg[] = {
0401 {
0402 .reg = PAD_SHARED_IP_EN_1,
0403 .mask = KBD_COL5_MASK,
0404 .val = KBD_COL5_MASK,
0405 }, {
0406 .reg = PAD_FUNCTION_EN_1,
0407 .mask = PWM1_AND_KBD_COL5_REG0_MASK,
0408 .val = PWM1_AND_KBD_COL5_REG0_MASK,
0409 },
0410 };
0411
0412 static struct spear_modemux keyboard_col5_modemux[] = {
0413 {
0414 .muxregs = keyboard_col5_muxreg,
0415 .nmuxregs = ARRAY_SIZE(keyboard_col5_muxreg),
0416 },
0417 };
0418
0419 static struct spear_pingroup keyboard_col5_pingroup = {
0420 .name = "keyboard_col5_grp",
0421 .pins = keyboard_col5_pins,
0422 .npins = ARRAY_SIZE(keyboard_col5_pins),
0423 .modemuxs = keyboard_col5_modemux,
0424 .nmodemuxs = ARRAY_SIZE(keyboard_col5_modemux),
0425 };
0426
0427 static const char *const keyboard_grps[] = { "keyboard_row_col_grp",
0428 "keyboard_col5_grp" };
0429 static struct spear_function keyboard_function = {
0430 .name = "keyboard",
0431 .groups = keyboard_grps,
0432 .ngroups = ARRAY_SIZE(keyboard_grps),
0433 };
0434
0435
0436 static const unsigned spdif_in_pins[] = { 19 };
0437 static struct spear_muxreg spdif_in_muxreg[] = {
0438 {
0439 .reg = PAD_FUNCTION_EN_1,
0440 .mask = SPDIF_IN_REG0_MASK,
0441 .val = SPDIF_IN_REG0_MASK,
0442 },
0443 };
0444
0445 static struct spear_modemux spdif_in_modemux[] = {
0446 {
0447 .muxregs = spdif_in_muxreg,
0448 .nmuxregs = ARRAY_SIZE(spdif_in_muxreg),
0449 },
0450 };
0451
0452 static struct spear_pingroup spdif_in_pingroup = {
0453 .name = "spdif_in_grp",
0454 .pins = spdif_in_pins,
0455 .npins = ARRAY_SIZE(spdif_in_pins),
0456 .modemuxs = spdif_in_modemux,
0457 .nmodemuxs = ARRAY_SIZE(spdif_in_modemux),
0458 };
0459
0460 static const char *const spdif_in_grps[] = { "spdif_in_grp" };
0461 static struct spear_function spdif_in_function = {
0462 .name = "spdif_in",
0463 .groups = spdif_in_grps,
0464 .ngroups = ARRAY_SIZE(spdif_in_grps),
0465 };
0466
0467
0468 static const unsigned spdif_out_pins[] = { 137 };
0469 static struct spear_muxreg spdif_out_muxreg[] = {
0470 {
0471 .reg = PAD_FUNCTION_EN_5,
0472 .mask = SPDIF_OUT_REG4_MASK,
0473 .val = SPDIF_OUT_REG4_MASK,
0474 }, {
0475 .reg = PERIP_CFG,
0476 .mask = SPDIF_OUT_ENB_MASK,
0477 .val = SPDIF_OUT_ENB_MASK,
0478 }
0479 };
0480
0481 static struct spear_modemux spdif_out_modemux[] = {
0482 {
0483 .muxregs = spdif_out_muxreg,
0484 .nmuxregs = ARRAY_SIZE(spdif_out_muxreg),
0485 },
0486 };
0487
0488 static struct spear_pingroup spdif_out_pingroup = {
0489 .name = "spdif_out_grp",
0490 .pins = spdif_out_pins,
0491 .npins = ARRAY_SIZE(spdif_out_pins),
0492 .modemuxs = spdif_out_modemux,
0493 .nmodemuxs = ARRAY_SIZE(spdif_out_modemux),
0494 };
0495
0496 static const char *const spdif_out_grps[] = { "spdif_out_grp" };
0497 static struct spear_function spdif_out_function = {
0498 .name = "spdif_out",
0499 .groups = spdif_out_grps,
0500 .ngroups = ARRAY_SIZE(spdif_out_grps),
0501 };
0502
0503
0504 static const unsigned gpt_0_1_pins[] = { 11, 12, 13, 14, 15, 16, 21, 22 };
0505 static struct spear_muxreg gpt_0_1_muxreg[] = {
0506 {
0507 .reg = PAD_SHARED_IP_EN_1,
0508 .mask = GPT_MASK | GPT0_TMR0_CPT_MASK | GPT0_TMR1_CLK_MASK,
0509 .val = GPT_MASK | GPT0_TMR0_CPT_MASK | GPT0_TMR1_CLK_MASK,
0510 }, {
0511 .reg = PAD_FUNCTION_EN_1,
0512 .mask = UART0_ENH_AND_GPT_REG0_MASK |
0513 PWM2_AND_GPT0_TMR0_CPT_REG0_MASK |
0514 PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
0515 .val = UART0_ENH_AND_GPT_REG0_MASK |
0516 PWM2_AND_GPT0_TMR0_CPT_REG0_MASK |
0517 PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
0518 },
0519 };
0520
0521 static struct spear_modemux gpt_0_1_modemux[] = {
0522 {
0523 .muxregs = gpt_0_1_muxreg,
0524 .nmuxregs = ARRAY_SIZE(gpt_0_1_muxreg),
0525 },
0526 };
0527
0528 static struct spear_pingroup gpt_0_1_pingroup = {
0529 .name = "gpt_0_1_grp",
0530 .pins = gpt_0_1_pins,
0531 .npins = ARRAY_SIZE(gpt_0_1_pins),
0532 .modemuxs = gpt_0_1_modemux,
0533 .nmodemuxs = ARRAY_SIZE(gpt_0_1_modemux),
0534 };
0535
0536 static const char *const gpt_0_1_grps[] = { "gpt_0_1_grp" };
0537 static struct spear_function gpt_0_1_function = {
0538 .name = "gpt_0_1",
0539 .groups = gpt_0_1_grps,
0540 .ngroups = ARRAY_SIZE(gpt_0_1_grps),
0541 };
0542
0543
0544 static const unsigned pwm0_pins[] = { 24 };
0545 static struct spear_muxreg pwm0_muxreg[] = {
0546 {
0547 .reg = PAD_SHARED_IP_EN_1,
0548 .mask = SSP0_CS1_MASK,
0549 .val = 0,
0550 }, {
0551 .reg = PAD_FUNCTION_EN_1,
0552 .mask = PWM0_AND_SSP0_CS1_REG0_MASK,
0553 .val = PWM0_AND_SSP0_CS1_REG0_MASK,
0554 },
0555 };
0556
0557 static struct spear_modemux pwm0_modemux[] = {
0558 {
0559 .muxregs = pwm0_muxreg,
0560 .nmuxregs = ARRAY_SIZE(pwm0_muxreg),
0561 },
0562 };
0563
0564 static struct spear_pingroup pwm0_pingroup = {
0565 .name = "pwm0_grp",
0566 .pins = pwm0_pins,
0567 .npins = ARRAY_SIZE(pwm0_pins),
0568 .modemuxs = pwm0_modemux,
0569 .nmodemuxs = ARRAY_SIZE(pwm0_modemux),
0570 };
0571
0572
0573 static const unsigned pwm1_pins[] = { 17 };
0574 static struct spear_muxreg pwm1_muxreg[] = {
0575 {
0576 .reg = PAD_SHARED_IP_EN_1,
0577 .mask = KBD_COL5_MASK,
0578 .val = 0,
0579 }, {
0580 .reg = PAD_FUNCTION_EN_1,
0581 .mask = PWM1_AND_KBD_COL5_REG0_MASK,
0582 .val = PWM1_AND_KBD_COL5_REG0_MASK,
0583 },
0584 };
0585
0586 static struct spear_modemux pwm1_modemux[] = {
0587 {
0588 .muxregs = pwm1_muxreg,
0589 .nmuxregs = ARRAY_SIZE(pwm1_muxreg),
0590 },
0591 };
0592
0593 static struct spear_pingroup pwm1_pingroup = {
0594 .name = "pwm1_grp",
0595 .pins = pwm1_pins,
0596 .npins = ARRAY_SIZE(pwm1_pins),
0597 .modemuxs = pwm1_modemux,
0598 .nmodemuxs = ARRAY_SIZE(pwm1_modemux),
0599 };
0600
0601
0602 static const unsigned pwm2_pins[] = { 21 };
0603 static struct spear_muxreg pwm2_muxreg[] = {
0604 {
0605 .reg = PAD_SHARED_IP_EN_1,
0606 .mask = GPT0_TMR0_CPT_MASK,
0607 .val = 0,
0608 }, {
0609 .reg = PAD_FUNCTION_EN_1,
0610 .mask = PWM2_AND_GPT0_TMR0_CPT_REG0_MASK,
0611 .val = PWM2_AND_GPT0_TMR0_CPT_REG0_MASK,
0612 },
0613 };
0614
0615 static struct spear_modemux pwm2_modemux[] = {
0616 {
0617 .muxregs = pwm2_muxreg,
0618 .nmuxregs = ARRAY_SIZE(pwm2_muxreg),
0619 },
0620 };
0621
0622 static struct spear_pingroup pwm2_pingroup = {
0623 .name = "pwm2_grp",
0624 .pins = pwm2_pins,
0625 .npins = ARRAY_SIZE(pwm2_pins),
0626 .modemuxs = pwm2_modemux,
0627 .nmodemuxs = ARRAY_SIZE(pwm2_modemux),
0628 };
0629
0630
0631 static const unsigned pwm3_pins[] = { 22 };
0632 static struct spear_muxreg pwm3_muxreg[] = {
0633 {
0634 .reg = PAD_SHARED_IP_EN_1,
0635 .mask = GPT0_TMR1_CLK_MASK,
0636 .val = 0,
0637 }, {
0638 .reg = PAD_FUNCTION_EN_1,
0639 .mask = PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
0640 .val = PWM3_AND_GPT0_TMR1_CLK_REG0_MASK,
0641 },
0642 };
0643
0644 static struct spear_modemux pwm3_modemux[] = {
0645 {
0646 .muxregs = pwm3_muxreg,
0647 .nmuxregs = ARRAY_SIZE(pwm3_muxreg),
0648 },
0649 };
0650
0651 static struct spear_pingroup pwm3_pingroup = {
0652 .name = "pwm3_grp",
0653 .pins = pwm3_pins,
0654 .npins = ARRAY_SIZE(pwm3_pins),
0655 .modemuxs = pwm3_modemux,
0656 .nmodemuxs = ARRAY_SIZE(pwm3_modemux),
0657 };
0658
0659 static const char *const pwm_grps[] = { "pwm0_grp", "pwm1_grp", "pwm2_grp",
0660 "pwm3_grp" };
0661 static struct spear_function pwm_function = {
0662 .name = "pwm",
0663 .groups = pwm_grps,
0664 .ngroups = ARRAY_SIZE(pwm_grps),
0665 };
0666
0667
0668 static const unsigned vip_mux_pins[] = { 35, 36, 37, 38, 40, 41, 42, 43 };
0669 static struct spear_muxreg vip_mux_muxreg[] = {
0670 {
0671 .reg = PAD_FUNCTION_EN_2,
0672 .mask = VIP_REG1_MASK,
0673 .val = VIP_REG1_MASK,
0674 },
0675 };
0676
0677 static struct spear_modemux vip_mux_modemux[] = {
0678 {
0679 .muxregs = vip_mux_muxreg,
0680 .nmuxregs = ARRAY_SIZE(vip_mux_muxreg),
0681 },
0682 };
0683
0684 static struct spear_pingroup vip_mux_pingroup = {
0685 .name = "vip_mux_grp",
0686 .pins = vip_mux_pins,
0687 .npins = ARRAY_SIZE(vip_mux_pins),
0688 .modemuxs = vip_mux_modemux,
0689 .nmodemuxs = ARRAY_SIZE(vip_mux_modemux),
0690 };
0691
0692
0693 static const unsigned vip_mux_cam0_pins[] = { 65, 66, 67, 68, 69, 70, 71, 72,
0694 73, 74, 75 };
0695 static struct spear_muxreg vip_mux_cam0_muxreg[] = {
0696 {
0697 .reg = PAD_SHARED_IP_EN_1,
0698 .mask = CAM0_MASK,
0699 .val = 0,
0700 }, {
0701 .reg = PAD_FUNCTION_EN_3,
0702 .mask = VIP_AND_CAM0_REG2_MASK,
0703 .val = VIP_AND_CAM0_REG2_MASK,
0704 },
0705 };
0706
0707 static struct spear_modemux vip_mux_cam0_modemux[] = {
0708 {
0709 .muxregs = vip_mux_cam0_muxreg,
0710 .nmuxregs = ARRAY_SIZE(vip_mux_cam0_muxreg),
0711 },
0712 };
0713
0714 static struct spear_pingroup vip_mux_cam0_pingroup = {
0715 .name = "vip_mux_cam0_grp",
0716 .pins = vip_mux_cam0_pins,
0717 .npins = ARRAY_SIZE(vip_mux_cam0_pins),
0718 .modemuxs = vip_mux_cam0_modemux,
0719 .nmodemuxs = ARRAY_SIZE(vip_mux_cam0_modemux),
0720 };
0721
0722
0723 static const unsigned vip_mux_cam1_pins[] = { 54, 55, 56, 57, 58, 59, 60, 61,
0724 62, 63, 64 };
0725 static struct spear_muxreg vip_mux_cam1_muxreg[] = {
0726 {
0727 .reg = PAD_SHARED_IP_EN_1,
0728 .mask = CAM1_MASK,
0729 .val = 0,
0730 }, {
0731 .reg = PAD_FUNCTION_EN_2,
0732 .mask = VIP_AND_CAM1_REG1_MASK,
0733 .val = VIP_AND_CAM1_REG1_MASK,
0734 }, {
0735 .reg = PAD_FUNCTION_EN_3,
0736 .mask = VIP_AND_CAM1_REG2_MASK,
0737 .val = VIP_AND_CAM1_REG2_MASK,
0738 },
0739 };
0740
0741 static struct spear_modemux vip_mux_cam1_modemux[] = {
0742 {
0743 .muxregs = vip_mux_cam1_muxreg,
0744 .nmuxregs = ARRAY_SIZE(vip_mux_cam1_muxreg),
0745 },
0746 };
0747
0748 static struct spear_pingroup vip_mux_cam1_pingroup = {
0749 .name = "vip_mux_cam1_grp",
0750 .pins = vip_mux_cam1_pins,
0751 .npins = ARRAY_SIZE(vip_mux_cam1_pins),
0752 .modemuxs = vip_mux_cam1_modemux,
0753 .nmodemuxs = ARRAY_SIZE(vip_mux_cam1_modemux),
0754 };
0755
0756
0757 static const unsigned vip_mux_cam2_pins[] = { 39, 44, 45, 46, 47, 48, 49, 50,
0758 51, 52, 53 };
0759 static struct spear_muxreg vip_mux_cam2_muxreg[] = {
0760 {
0761 .reg = PAD_SHARED_IP_EN_1,
0762 .mask = CAM2_MASK,
0763 .val = 0,
0764 }, {
0765 .reg = PAD_FUNCTION_EN_2,
0766 .mask = VIP_AND_CAM2_REG1_MASK,
0767 .val = VIP_AND_CAM2_REG1_MASK,
0768 },
0769 };
0770
0771 static struct spear_modemux vip_mux_cam2_modemux[] = {
0772 {
0773 .muxregs = vip_mux_cam2_muxreg,
0774 .nmuxregs = ARRAY_SIZE(vip_mux_cam2_muxreg),
0775 },
0776 };
0777
0778 static struct spear_pingroup vip_mux_cam2_pingroup = {
0779 .name = "vip_mux_cam2_grp",
0780 .pins = vip_mux_cam2_pins,
0781 .npins = ARRAY_SIZE(vip_mux_cam2_pins),
0782 .modemuxs = vip_mux_cam2_modemux,
0783 .nmodemuxs = ARRAY_SIZE(vip_mux_cam2_modemux),
0784 };
0785
0786
0787 static const unsigned vip_mux_cam3_pins[] = { 20, 25, 26, 27, 28, 29, 30, 31,
0788 32, 33, 34 };
0789 static struct spear_muxreg vip_mux_cam3_muxreg[] = {
0790 {
0791 .reg = PAD_SHARED_IP_EN_1,
0792 .mask = CAM3_MASK,
0793 .val = 0,
0794 }, {
0795 .reg = PAD_FUNCTION_EN_1,
0796 .mask = VIP_AND_CAM3_REG0_MASK,
0797 .val = VIP_AND_CAM3_REG0_MASK,
0798 }, {
0799 .reg = PAD_FUNCTION_EN_2,
0800 .mask = VIP_AND_CAM3_REG1_MASK,
0801 .val = VIP_AND_CAM3_REG1_MASK,
0802 },
0803 };
0804
0805 static struct spear_modemux vip_mux_cam3_modemux[] = {
0806 {
0807 .muxregs = vip_mux_cam3_muxreg,
0808 .nmuxregs = ARRAY_SIZE(vip_mux_cam3_muxreg),
0809 },
0810 };
0811
0812 static struct spear_pingroup vip_mux_cam3_pingroup = {
0813 .name = "vip_mux_cam3_grp",
0814 .pins = vip_mux_cam3_pins,
0815 .npins = ARRAY_SIZE(vip_mux_cam3_pins),
0816 .modemuxs = vip_mux_cam3_modemux,
0817 .nmodemuxs = ARRAY_SIZE(vip_mux_cam3_modemux),
0818 };
0819
0820 static const char *const vip_grps[] = { "vip_mux_grp", "vip_mux_cam0_grp" ,
0821 "vip_mux_cam1_grp" , "vip_mux_cam2_grp", "vip_mux_cam3_grp" };
0822 static struct spear_function vip_function = {
0823 .name = "vip",
0824 .groups = vip_grps,
0825 .ngroups = ARRAY_SIZE(vip_grps),
0826 };
0827
0828
0829 static const unsigned cam0_pins[] = { 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75
0830 };
0831 static struct spear_muxreg cam0_muxreg[] = {
0832 {
0833 .reg = PAD_SHARED_IP_EN_1,
0834 .mask = CAM0_MASK,
0835 .val = CAM0_MASK,
0836 }, {
0837 .reg = PAD_FUNCTION_EN_3,
0838 .mask = VIP_AND_CAM0_REG2_MASK,
0839 .val = VIP_AND_CAM0_REG2_MASK,
0840 },
0841 };
0842
0843 static struct spear_modemux cam0_modemux[] = {
0844 {
0845 .muxregs = cam0_muxreg,
0846 .nmuxregs = ARRAY_SIZE(cam0_muxreg),
0847 },
0848 };
0849
0850 static struct spear_pingroup cam0_pingroup = {
0851 .name = "cam0_grp",
0852 .pins = cam0_pins,
0853 .npins = ARRAY_SIZE(cam0_pins),
0854 .modemuxs = cam0_modemux,
0855 .nmodemuxs = ARRAY_SIZE(cam0_modemux),
0856 };
0857
0858 static const char *const cam0_grps[] = { "cam0_grp" };
0859 static struct spear_function cam0_function = {
0860 .name = "cam0",
0861 .groups = cam0_grps,
0862 .ngroups = ARRAY_SIZE(cam0_grps),
0863 };
0864
0865
0866 static const unsigned cam1_pins[] = { 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64
0867 };
0868 static struct spear_muxreg cam1_muxreg[] = {
0869 {
0870 .reg = PAD_SHARED_IP_EN_1,
0871 .mask = CAM1_MASK,
0872 .val = CAM1_MASK,
0873 }, {
0874 .reg = PAD_FUNCTION_EN_2,
0875 .mask = VIP_AND_CAM1_REG1_MASK,
0876 .val = VIP_AND_CAM1_REG1_MASK,
0877 }, {
0878 .reg = PAD_FUNCTION_EN_3,
0879 .mask = VIP_AND_CAM1_REG2_MASK,
0880 .val = VIP_AND_CAM1_REG2_MASK,
0881 },
0882 };
0883
0884 static struct spear_modemux cam1_modemux[] = {
0885 {
0886 .muxregs = cam1_muxreg,
0887 .nmuxregs = ARRAY_SIZE(cam1_muxreg),
0888 },
0889 };
0890
0891 static struct spear_pingroup cam1_pingroup = {
0892 .name = "cam1_grp",
0893 .pins = cam1_pins,
0894 .npins = ARRAY_SIZE(cam1_pins),
0895 .modemuxs = cam1_modemux,
0896 .nmodemuxs = ARRAY_SIZE(cam1_modemux),
0897 };
0898
0899 static const char *const cam1_grps[] = { "cam1_grp" };
0900 static struct spear_function cam1_function = {
0901 .name = "cam1",
0902 .groups = cam1_grps,
0903 .ngroups = ARRAY_SIZE(cam1_grps),
0904 };
0905
0906
0907 static const unsigned cam2_pins[] = { 39, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
0908 };
0909 static struct spear_muxreg cam2_muxreg[] = {
0910 {
0911 .reg = PAD_SHARED_IP_EN_1,
0912 .mask = CAM2_MASK,
0913 .val = CAM2_MASK,
0914 }, {
0915 .reg = PAD_FUNCTION_EN_2,
0916 .mask = VIP_AND_CAM2_REG1_MASK,
0917 .val = VIP_AND_CAM2_REG1_MASK,
0918 },
0919 };
0920
0921 static struct spear_modemux cam2_modemux[] = {
0922 {
0923 .muxregs = cam2_muxreg,
0924 .nmuxregs = ARRAY_SIZE(cam2_muxreg),
0925 },
0926 };
0927
0928 static struct spear_pingroup cam2_pingroup = {
0929 .name = "cam2_grp",
0930 .pins = cam2_pins,
0931 .npins = ARRAY_SIZE(cam2_pins),
0932 .modemuxs = cam2_modemux,
0933 .nmodemuxs = ARRAY_SIZE(cam2_modemux),
0934 };
0935
0936 static const char *const cam2_grps[] = { "cam2_grp" };
0937 static struct spear_function cam2_function = {
0938 .name = "cam2",
0939 .groups = cam2_grps,
0940 .ngroups = ARRAY_SIZE(cam2_grps),
0941 };
0942
0943
0944 static const unsigned cam3_pins[] = { 20, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
0945 };
0946 static struct spear_muxreg cam3_muxreg[] = {
0947 {
0948 .reg = PAD_SHARED_IP_EN_1,
0949 .mask = CAM3_MASK,
0950 .val = CAM3_MASK,
0951 }, {
0952 .reg = PAD_FUNCTION_EN_1,
0953 .mask = VIP_AND_CAM3_REG0_MASK,
0954 .val = VIP_AND_CAM3_REG0_MASK,
0955 }, {
0956 .reg = PAD_FUNCTION_EN_2,
0957 .mask = VIP_AND_CAM3_REG1_MASK,
0958 .val = VIP_AND_CAM3_REG1_MASK,
0959 },
0960 };
0961
0962 static struct spear_modemux cam3_modemux[] = {
0963 {
0964 .muxregs = cam3_muxreg,
0965 .nmuxregs = ARRAY_SIZE(cam3_muxreg),
0966 },
0967 };
0968
0969 static struct spear_pingroup cam3_pingroup = {
0970 .name = "cam3_grp",
0971 .pins = cam3_pins,
0972 .npins = ARRAY_SIZE(cam3_pins),
0973 .modemuxs = cam3_modemux,
0974 .nmodemuxs = ARRAY_SIZE(cam3_modemux),
0975 };
0976
0977 static const char *const cam3_grps[] = { "cam3_grp" };
0978 static struct spear_function cam3_function = {
0979 .name = "cam3",
0980 .groups = cam3_grps,
0981 .ngroups = ARRAY_SIZE(cam3_grps),
0982 };
0983
0984
0985 static const unsigned smi_pins[] = { 76, 77, 78, 79, 84 };
0986 static struct spear_muxreg smi_muxreg[] = {
0987 {
0988 .reg = PAD_FUNCTION_EN_3,
0989 .mask = SMI_REG2_MASK,
0990 .val = SMI_REG2_MASK,
0991 },
0992 };
0993
0994 static struct spear_modemux smi_modemux[] = {
0995 {
0996 .muxregs = smi_muxreg,
0997 .nmuxregs = ARRAY_SIZE(smi_muxreg),
0998 },
0999 };
1000
1001 static struct spear_pingroup smi_pingroup = {
1002 .name = "smi_grp",
1003 .pins = smi_pins,
1004 .npins = ARRAY_SIZE(smi_pins),
1005 .modemuxs = smi_modemux,
1006 .nmodemuxs = ARRAY_SIZE(smi_modemux),
1007 };
1008
1009 static const char *const smi_grps[] = { "smi_grp" };
1010 static struct spear_function smi_function = {
1011 .name = "smi",
1012 .groups = smi_grps,
1013 .ngroups = ARRAY_SIZE(smi_grps),
1014 };
1015
1016
1017 static const unsigned ssp0_pins[] = { 80, 81, 82, 83 };
1018 static struct spear_muxreg ssp0_muxreg[] = {
1019 {
1020 .reg = PAD_FUNCTION_EN_3,
1021 .mask = SSP0_REG2_MASK,
1022 .val = SSP0_REG2_MASK,
1023 },
1024 };
1025
1026 static struct spear_modemux ssp0_modemux[] = {
1027 {
1028 .muxregs = ssp0_muxreg,
1029 .nmuxregs = ARRAY_SIZE(ssp0_muxreg),
1030 },
1031 };
1032
1033 static struct spear_pingroup ssp0_pingroup = {
1034 .name = "ssp0_grp",
1035 .pins = ssp0_pins,
1036 .npins = ARRAY_SIZE(ssp0_pins),
1037 .modemuxs = ssp0_modemux,
1038 .nmodemuxs = ARRAY_SIZE(ssp0_modemux),
1039 };
1040
1041
1042 static const unsigned ssp0_cs1_pins[] = { 24 };
1043 static struct spear_muxreg ssp0_cs1_muxreg[] = {
1044 {
1045 .reg = PAD_SHARED_IP_EN_1,
1046 .mask = SSP0_CS1_MASK,
1047 .val = SSP0_CS1_MASK,
1048 }, {
1049 .reg = PAD_FUNCTION_EN_1,
1050 .mask = PWM0_AND_SSP0_CS1_REG0_MASK,
1051 .val = PWM0_AND_SSP0_CS1_REG0_MASK,
1052 },
1053 };
1054
1055 static struct spear_modemux ssp0_cs1_modemux[] = {
1056 {
1057 .muxregs = ssp0_cs1_muxreg,
1058 .nmuxregs = ARRAY_SIZE(ssp0_cs1_muxreg),
1059 },
1060 };
1061
1062 static struct spear_pingroup ssp0_cs1_pingroup = {
1063 .name = "ssp0_cs1_grp",
1064 .pins = ssp0_cs1_pins,
1065 .npins = ARRAY_SIZE(ssp0_cs1_pins),
1066 .modemuxs = ssp0_cs1_modemux,
1067 .nmodemuxs = ARRAY_SIZE(ssp0_cs1_modemux),
1068 };
1069
1070
1071 static const unsigned ssp0_cs2_pins[] = { 85 };
1072 static struct spear_muxreg ssp0_cs2_muxreg[] = {
1073 {
1074 .reg = PAD_SHARED_IP_EN_1,
1075 .mask = SSP0_CS2_MASK,
1076 .val = SSP0_CS2_MASK,
1077 }, {
1078 .reg = PAD_FUNCTION_EN_3,
1079 .mask = TS_AND_SSP0_CS2_REG2_MASK,
1080 .val = TS_AND_SSP0_CS2_REG2_MASK,
1081 },
1082 };
1083
1084 static struct spear_modemux ssp0_cs2_modemux[] = {
1085 {
1086 .muxregs = ssp0_cs2_muxreg,
1087 .nmuxregs = ARRAY_SIZE(ssp0_cs2_muxreg),
1088 },
1089 };
1090
1091 static struct spear_pingroup ssp0_cs2_pingroup = {
1092 .name = "ssp0_cs2_grp",
1093 .pins = ssp0_cs2_pins,
1094 .npins = ARRAY_SIZE(ssp0_cs2_pins),
1095 .modemuxs = ssp0_cs2_modemux,
1096 .nmodemuxs = ARRAY_SIZE(ssp0_cs2_modemux),
1097 };
1098
1099
1100 static const unsigned ssp0_cs3_pins[] = { 132 };
1101 static struct spear_muxreg ssp0_cs3_muxreg[] = {
1102 {
1103 .reg = PAD_FUNCTION_EN_5,
1104 .mask = SSP0_CS3_REG4_MASK,
1105 .val = SSP0_CS3_REG4_MASK,
1106 },
1107 };
1108
1109 static struct spear_modemux ssp0_cs3_modemux[] = {
1110 {
1111 .muxregs = ssp0_cs3_muxreg,
1112 .nmuxregs = ARRAY_SIZE(ssp0_cs3_muxreg),
1113 },
1114 };
1115
1116 static struct spear_pingroup ssp0_cs3_pingroup = {
1117 .name = "ssp0_cs3_grp",
1118 .pins = ssp0_cs3_pins,
1119 .npins = ARRAY_SIZE(ssp0_cs3_pins),
1120 .modemuxs = ssp0_cs3_modemux,
1121 .nmodemuxs = ARRAY_SIZE(ssp0_cs3_modemux),
1122 };
1123
1124 static const char *const ssp0_grps[] = { "ssp0_grp", "ssp0_cs1_grp",
1125 "ssp0_cs2_grp", "ssp0_cs3_grp" };
1126 static struct spear_function ssp0_function = {
1127 .name = "ssp0",
1128 .groups = ssp0_grps,
1129 .ngroups = ARRAY_SIZE(ssp0_grps),
1130 };
1131
1132
1133 static const unsigned uart0_pins[] = { 86, 87 };
1134 static struct spear_muxreg uart0_muxreg[] = {
1135 {
1136 .reg = PAD_FUNCTION_EN_3,
1137 .mask = UART0_REG2_MASK,
1138 .val = UART0_REG2_MASK,
1139 },
1140 };
1141
1142 static struct spear_modemux uart0_modemux[] = {
1143 {
1144 .muxregs = uart0_muxreg,
1145 .nmuxregs = ARRAY_SIZE(uart0_muxreg),
1146 },
1147 };
1148
1149 static struct spear_pingroup uart0_pingroup = {
1150 .name = "uart0_grp",
1151 .pins = uart0_pins,
1152 .npins = ARRAY_SIZE(uart0_pins),
1153 .modemuxs = uart0_modemux,
1154 .nmodemuxs = ARRAY_SIZE(uart0_modemux),
1155 };
1156
1157
1158 static const unsigned uart0_enh_pins[] = { 11, 12, 13, 14, 15, 16 };
1159 static struct spear_muxreg uart0_enh_muxreg[] = {
1160 {
1161 .reg = PAD_SHARED_IP_EN_1,
1162 .mask = GPT_MASK,
1163 .val = 0,
1164 }, {
1165 .reg = PAD_FUNCTION_EN_1,
1166 .mask = UART0_ENH_AND_GPT_REG0_MASK,
1167 .val = UART0_ENH_AND_GPT_REG0_MASK,
1168 },
1169 };
1170
1171 static struct spear_modemux uart0_enh_modemux[] = {
1172 {
1173 .muxregs = uart0_enh_muxreg,
1174 .nmuxregs = ARRAY_SIZE(uart0_enh_muxreg),
1175 },
1176 };
1177
1178 static struct spear_pingroup uart0_enh_pingroup = {
1179 .name = "uart0_enh_grp",
1180 .pins = uart0_enh_pins,
1181 .npins = ARRAY_SIZE(uart0_enh_pins),
1182 .modemuxs = uart0_enh_modemux,
1183 .nmodemuxs = ARRAY_SIZE(uart0_enh_modemux),
1184 };
1185
1186 static const char *const uart0_grps[] = { "uart0_grp", "uart0_enh_grp" };
1187 static struct spear_function uart0_function = {
1188 .name = "uart0",
1189 .groups = uart0_grps,
1190 .ngroups = ARRAY_SIZE(uart0_grps),
1191 };
1192
1193
1194 static const unsigned uart1_pins[] = { 88, 89 };
1195 static struct spear_muxreg uart1_muxreg[] = {
1196 {
1197 .reg = PAD_FUNCTION_EN_3,
1198 .mask = UART1_REG2_MASK,
1199 .val = UART1_REG2_MASK,
1200 },
1201 };
1202
1203 static struct spear_modemux uart1_modemux[] = {
1204 {
1205 .muxregs = uart1_muxreg,
1206 .nmuxregs = ARRAY_SIZE(uart1_muxreg),
1207 },
1208 };
1209
1210 static struct spear_pingroup uart1_pingroup = {
1211 .name = "uart1_grp",
1212 .pins = uart1_pins,
1213 .npins = ARRAY_SIZE(uart1_pins),
1214 .modemuxs = uart1_modemux,
1215 .nmodemuxs = ARRAY_SIZE(uart1_modemux),
1216 };
1217
1218 static const char *const uart1_grps[] = { "uart1_grp" };
1219 static struct spear_function uart1_function = {
1220 .name = "uart1",
1221 .groups = uart1_grps,
1222 .ngroups = ARRAY_SIZE(uart1_grps),
1223 };
1224
1225
1226 static const unsigned i2s_in_pins[] = { 90, 91, 92, 93, 94, 99 };
1227 static struct spear_muxreg i2s_in_muxreg[] = {
1228 {
1229 .reg = PAD_FUNCTION_EN_3,
1230 .mask = I2S_IN_REG2_MASK,
1231 .val = I2S_IN_REG2_MASK,
1232 }, {
1233 .reg = PAD_FUNCTION_EN_4,
1234 .mask = I2S_IN_REG3_MASK,
1235 .val = I2S_IN_REG3_MASK,
1236 },
1237 };
1238
1239 static struct spear_modemux i2s_in_modemux[] = {
1240 {
1241 .muxregs = i2s_in_muxreg,
1242 .nmuxregs = ARRAY_SIZE(i2s_in_muxreg),
1243 },
1244 };
1245
1246 static struct spear_pingroup i2s_in_pingroup = {
1247 .name = "i2s_in_grp",
1248 .pins = i2s_in_pins,
1249 .npins = ARRAY_SIZE(i2s_in_pins),
1250 .modemuxs = i2s_in_modemux,
1251 .nmodemuxs = ARRAY_SIZE(i2s_in_modemux),
1252 };
1253
1254
1255 static const unsigned i2s_out_pins[] = { 95, 96, 97, 98, 100, 101, 102, 103 };
1256 static struct spear_muxreg i2s_out_muxreg[] = {
1257 {
1258 .reg = PAD_FUNCTION_EN_4,
1259 .mask = I2S_OUT_REG3_MASK,
1260 .val = I2S_OUT_REG3_MASK,
1261 },
1262 };
1263
1264 static struct spear_modemux i2s_out_modemux[] = {
1265 {
1266 .muxregs = i2s_out_muxreg,
1267 .nmuxregs = ARRAY_SIZE(i2s_out_muxreg),
1268 },
1269 };
1270
1271 static struct spear_pingroup i2s_out_pingroup = {
1272 .name = "i2s_out_grp",
1273 .pins = i2s_out_pins,
1274 .npins = ARRAY_SIZE(i2s_out_pins),
1275 .modemuxs = i2s_out_modemux,
1276 .nmodemuxs = ARRAY_SIZE(i2s_out_modemux),
1277 };
1278
1279 static const char *const i2s_grps[] = { "i2s_in_grp", "i2s_out_grp" };
1280 static struct spear_function i2s_function = {
1281 .name = "i2s",
1282 .groups = i2s_grps,
1283 .ngroups = ARRAY_SIZE(i2s_grps),
1284 };
1285
1286
1287 static const unsigned gmac_pins[] = { 104, 105, 106, 107, 108, 109, 110, 111,
1288 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125,
1289 126, 127, 128, 129, 130, 131 };
1290 #define GMAC_MUXREG \
1291 { \
1292 .reg = PAD_FUNCTION_EN_4, \
1293 .mask = GMAC_REG3_MASK, \
1294 .val = GMAC_REG3_MASK, \
1295 }, { \
1296 .reg = PAD_FUNCTION_EN_5, \
1297 .mask = GMAC_REG4_MASK, \
1298 .val = GMAC_REG4_MASK, \
1299 }
1300
1301
1302 static struct spear_muxreg gmii_muxreg[] = {
1303 GMAC_MUXREG,
1304 {
1305 .reg = GMAC_CLK_CFG,
1306 .mask = GMAC_PHY_IF_SEL_MASK,
1307 .val = GMAC_PHY_IF_GMII_VAL,
1308 },
1309 };
1310
1311 static struct spear_modemux gmii_modemux[] = {
1312 {
1313 .muxregs = gmii_muxreg,
1314 .nmuxregs = ARRAY_SIZE(gmii_muxreg),
1315 },
1316 };
1317
1318 static struct spear_pingroup gmii_pingroup = {
1319 .name = "gmii_grp",
1320 .pins = gmac_pins,
1321 .npins = ARRAY_SIZE(gmac_pins),
1322 .modemuxs = gmii_modemux,
1323 .nmodemuxs = ARRAY_SIZE(gmii_modemux),
1324 };
1325
1326
1327 static struct spear_muxreg rgmii_muxreg[] = {
1328 GMAC_MUXREG,
1329 {
1330 .reg = GMAC_CLK_CFG,
1331 .mask = GMAC_PHY_IF_SEL_MASK,
1332 .val = GMAC_PHY_IF_RGMII_VAL,
1333 },
1334 };
1335
1336 static struct spear_modemux rgmii_modemux[] = {
1337 {
1338 .muxregs = rgmii_muxreg,
1339 .nmuxregs = ARRAY_SIZE(rgmii_muxreg),
1340 },
1341 };
1342
1343 static struct spear_pingroup rgmii_pingroup = {
1344 .name = "rgmii_grp",
1345 .pins = gmac_pins,
1346 .npins = ARRAY_SIZE(gmac_pins),
1347 .modemuxs = rgmii_modemux,
1348 .nmodemuxs = ARRAY_SIZE(rgmii_modemux),
1349 };
1350
1351
1352 static struct spear_muxreg rmii_muxreg[] = {
1353 GMAC_MUXREG,
1354 {
1355 .reg = GMAC_CLK_CFG,
1356 .mask = GMAC_PHY_IF_SEL_MASK,
1357 .val = GMAC_PHY_IF_RMII_VAL,
1358 },
1359 };
1360
1361 static struct spear_modemux rmii_modemux[] = {
1362 {
1363 .muxregs = rmii_muxreg,
1364 .nmuxregs = ARRAY_SIZE(rmii_muxreg),
1365 },
1366 };
1367
1368 static struct spear_pingroup rmii_pingroup = {
1369 .name = "rmii_grp",
1370 .pins = gmac_pins,
1371 .npins = ARRAY_SIZE(gmac_pins),
1372 .modemuxs = rmii_modemux,
1373 .nmodemuxs = ARRAY_SIZE(rmii_modemux),
1374 };
1375
1376
1377 static struct spear_muxreg sgmii_muxreg[] = {
1378 GMAC_MUXREG,
1379 {
1380 .reg = GMAC_CLK_CFG,
1381 .mask = GMAC_PHY_IF_SEL_MASK,
1382 .val = GMAC_PHY_IF_SGMII_VAL,
1383 },
1384 };
1385
1386 static struct spear_modemux sgmii_modemux[] = {
1387 {
1388 .muxregs = sgmii_muxreg,
1389 .nmuxregs = ARRAY_SIZE(sgmii_muxreg),
1390 },
1391 };
1392
1393 static struct spear_pingroup sgmii_pingroup = {
1394 .name = "sgmii_grp",
1395 .pins = gmac_pins,
1396 .npins = ARRAY_SIZE(gmac_pins),
1397 .modemuxs = sgmii_modemux,
1398 .nmodemuxs = ARRAY_SIZE(sgmii_modemux),
1399 };
1400
1401 static const char *const gmac_grps[] = { "gmii_grp", "rgmii_grp", "rmii_grp",
1402 "sgmii_grp" };
1403 static struct spear_function gmac_function = {
1404 .name = "gmac",
1405 .groups = gmac_grps,
1406 .ngroups = ARRAY_SIZE(gmac_grps),
1407 };
1408
1409
1410 static const unsigned i2c0_pins[] = { 133, 134 };
1411 static struct spear_muxreg i2c0_muxreg[] = {
1412 {
1413 .reg = PAD_FUNCTION_EN_5,
1414 .mask = I2C0_REG4_MASK,
1415 .val = I2C0_REG4_MASK,
1416 },
1417 };
1418
1419 static struct spear_modemux i2c0_modemux[] = {
1420 {
1421 .muxregs = i2c0_muxreg,
1422 .nmuxregs = ARRAY_SIZE(i2c0_muxreg),
1423 },
1424 };
1425
1426 static struct spear_pingroup i2c0_pingroup = {
1427 .name = "i2c0_grp",
1428 .pins = i2c0_pins,
1429 .npins = ARRAY_SIZE(i2c0_pins),
1430 .modemuxs = i2c0_modemux,
1431 .nmodemuxs = ARRAY_SIZE(i2c0_modemux),
1432 };
1433
1434 static const char *const i2c0_grps[] = { "i2c0_grp" };
1435 static struct spear_function i2c0_function = {
1436 .name = "i2c0",
1437 .groups = i2c0_grps,
1438 .ngroups = ARRAY_SIZE(i2c0_grps),
1439 };
1440
1441
1442 static const unsigned i2c1_pins[] = { 18, 23 };
1443 static struct spear_muxreg i2c1_muxreg[] = {
1444 {
1445 .reg = PAD_FUNCTION_EN_1,
1446 .mask = I2C1_REG0_MASK,
1447 .val = I2C1_REG0_MASK,
1448 },
1449 };
1450
1451 static struct spear_modemux i2c1_modemux[] = {
1452 {
1453 .muxregs = i2c1_muxreg,
1454 .nmuxregs = ARRAY_SIZE(i2c1_muxreg),
1455 },
1456 };
1457
1458 static struct spear_pingroup i2c1_pingroup = {
1459 .name = "i2c1_grp",
1460 .pins = i2c1_pins,
1461 .npins = ARRAY_SIZE(i2c1_pins),
1462 .modemuxs = i2c1_modemux,
1463 .nmodemuxs = ARRAY_SIZE(i2c1_modemux),
1464 };
1465
1466 static const char *const i2c1_grps[] = { "i2c1_grp" };
1467 static struct spear_function i2c1_function = {
1468 .name = "i2c1",
1469 .groups = i2c1_grps,
1470 .ngroups = ARRAY_SIZE(i2c1_grps),
1471 };
1472
1473
1474 static const unsigned cec0_pins[] = { 135 };
1475 static struct spear_muxreg cec0_muxreg[] = {
1476 {
1477 .reg = PAD_FUNCTION_EN_5,
1478 .mask = CEC0_REG4_MASK,
1479 .val = CEC0_REG4_MASK,
1480 },
1481 };
1482
1483 static struct spear_modemux cec0_modemux[] = {
1484 {
1485 .muxregs = cec0_muxreg,
1486 .nmuxregs = ARRAY_SIZE(cec0_muxreg),
1487 },
1488 };
1489
1490 static struct spear_pingroup cec0_pingroup = {
1491 .name = "cec0_grp",
1492 .pins = cec0_pins,
1493 .npins = ARRAY_SIZE(cec0_pins),
1494 .modemuxs = cec0_modemux,
1495 .nmodemuxs = ARRAY_SIZE(cec0_modemux),
1496 };
1497
1498 static const char *const cec0_grps[] = { "cec0_grp" };
1499 static struct spear_function cec0_function = {
1500 .name = "cec0",
1501 .groups = cec0_grps,
1502 .ngroups = ARRAY_SIZE(cec0_grps),
1503 };
1504
1505
1506 static const unsigned cec1_pins[] = { 136 };
1507 static struct spear_muxreg cec1_muxreg[] = {
1508 {
1509 .reg = PAD_FUNCTION_EN_5,
1510 .mask = CEC1_REG4_MASK,
1511 .val = CEC1_REG4_MASK,
1512 },
1513 };
1514
1515 static struct spear_modemux cec1_modemux[] = {
1516 {
1517 .muxregs = cec1_muxreg,
1518 .nmuxregs = ARRAY_SIZE(cec1_muxreg),
1519 },
1520 };
1521
1522 static struct spear_pingroup cec1_pingroup = {
1523 .name = "cec1_grp",
1524 .pins = cec1_pins,
1525 .npins = ARRAY_SIZE(cec1_pins),
1526 .modemuxs = cec1_modemux,
1527 .nmodemuxs = ARRAY_SIZE(cec1_modemux),
1528 };
1529
1530 static const char *const cec1_grps[] = { "cec1_grp" };
1531 static struct spear_function cec1_function = {
1532 .name = "cec1",
1533 .groups = cec1_grps,
1534 .ngroups = ARRAY_SIZE(cec1_grps),
1535 };
1536
1537
1538 static const unsigned mcif_pins[] = { 193, 194, 195, 196, 197, 198, 199, 200,
1539 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214,
1540 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
1541 229, 230, 231, 232, 237 };
1542 #define MCIF_MUXREG \
1543 { \
1544 .reg = PAD_SHARED_IP_EN_1, \
1545 .mask = MCIF_MASK, \
1546 .val = MCIF_MASK, \
1547 }, { \
1548 .reg = PAD_FUNCTION_EN_7, \
1549 .mask = FSMC_PNOR_AND_MCIF_REG6_MASK | MCIF_REG6_MASK, \
1550 .val = FSMC_PNOR_AND_MCIF_REG6_MASK | MCIF_REG6_MASK, \
1551 }, { \
1552 .reg = PAD_FUNCTION_EN_8, \
1553 .mask = MCIF_REG7_MASK, \
1554 .val = MCIF_REG7_MASK, \
1555 }
1556
1557
1558 static struct spear_muxreg sdhci_muxreg[] = {
1559 MCIF_MUXREG,
1560 {
1561 .reg = PERIP_CFG,
1562 .mask = MCIF_SEL_MASK,
1563 .val = MCIF_SEL_SD,
1564 },
1565 };
1566
1567 static struct spear_modemux sdhci_modemux[] = {
1568 {
1569 .muxregs = sdhci_muxreg,
1570 .nmuxregs = ARRAY_SIZE(sdhci_muxreg),
1571 },
1572 };
1573
1574 static struct spear_pingroup sdhci_pingroup = {
1575 .name = "sdhci_grp",
1576 .pins = mcif_pins,
1577 .npins = ARRAY_SIZE(mcif_pins),
1578 .modemuxs = sdhci_modemux,
1579 .nmodemuxs = ARRAY_SIZE(sdhci_modemux),
1580 };
1581
1582 static const char *const sdhci_grps[] = { "sdhci_grp" };
1583 static struct spear_function sdhci_function = {
1584 .name = "sdhci",
1585 .groups = sdhci_grps,
1586 .ngroups = ARRAY_SIZE(sdhci_grps),
1587 };
1588
1589
1590 static struct spear_muxreg cf_muxreg[] = {
1591 MCIF_MUXREG,
1592 {
1593 .reg = PERIP_CFG,
1594 .mask = MCIF_SEL_MASK,
1595 .val = MCIF_SEL_CF,
1596 },
1597 };
1598
1599 static struct spear_modemux cf_modemux[] = {
1600 {
1601 .muxregs = cf_muxreg,
1602 .nmuxregs = ARRAY_SIZE(cf_muxreg),
1603 },
1604 };
1605
1606 static struct spear_pingroup cf_pingroup = {
1607 .name = "cf_grp",
1608 .pins = mcif_pins,
1609 .npins = ARRAY_SIZE(mcif_pins),
1610 .modemuxs = cf_modemux,
1611 .nmodemuxs = ARRAY_SIZE(cf_modemux),
1612 };
1613
1614 static const char *const cf_grps[] = { "cf_grp" };
1615 static struct spear_function cf_function = {
1616 .name = "cf",
1617 .groups = cf_grps,
1618 .ngroups = ARRAY_SIZE(cf_grps),
1619 };
1620
1621
1622 static struct spear_muxreg xd_muxreg[] = {
1623 MCIF_MUXREG,
1624 {
1625 .reg = PERIP_CFG,
1626 .mask = MCIF_SEL_MASK,
1627 .val = MCIF_SEL_XD,
1628 },
1629 };
1630
1631 static struct spear_modemux xd_modemux[] = {
1632 {
1633 .muxregs = xd_muxreg,
1634 .nmuxregs = ARRAY_SIZE(xd_muxreg),
1635 },
1636 };
1637
1638 static struct spear_pingroup xd_pingroup = {
1639 .name = "xd_grp",
1640 .pins = mcif_pins,
1641 .npins = ARRAY_SIZE(mcif_pins),
1642 .modemuxs = xd_modemux,
1643 .nmodemuxs = ARRAY_SIZE(xd_modemux),
1644 };
1645
1646 static const char *const xd_grps[] = { "xd_grp" };
1647 static struct spear_function xd_function = {
1648 .name = "xd",
1649 .groups = xd_grps,
1650 .ngroups = ARRAY_SIZE(xd_grps),
1651 };
1652
1653
1654 static const unsigned clcd_pins[] = { 138, 139, 140, 141, 142, 143, 144, 145,
1655 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
1656 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173,
1657 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187,
1658 188, 189, 190, 191 };
1659 static struct spear_muxreg clcd_muxreg[] = {
1660 {
1661 .reg = PAD_SHARED_IP_EN_1,
1662 .mask = ARM_TRACE_MASK | MIPHY_DBG_MASK,
1663 .val = 0,
1664 }, {
1665 .reg = PAD_FUNCTION_EN_5,
1666 .mask = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
1667 .val = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
1668 }, {
1669 .reg = PAD_FUNCTION_EN_6,
1670 .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
1671 .val = CLCD_AND_ARM_TRACE_REG5_MASK,
1672 }, {
1673 .reg = PAD_FUNCTION_EN_7,
1674 .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
1675 .val = CLCD_AND_ARM_TRACE_REG6_MASK,
1676 },
1677 };
1678
1679 static struct spear_modemux clcd_modemux[] = {
1680 {
1681 .muxregs = clcd_muxreg,
1682 .nmuxregs = ARRAY_SIZE(clcd_muxreg),
1683 },
1684 };
1685
1686 static struct spear_pingroup clcd_pingroup = {
1687 .name = "clcd_grp",
1688 .pins = clcd_pins,
1689 .npins = ARRAY_SIZE(clcd_pins),
1690 .modemuxs = clcd_modemux,
1691 .nmodemuxs = ARRAY_SIZE(clcd_modemux),
1692 };
1693
1694
1695 static struct spear_muxreg clcd_sleep_muxreg[] = {
1696 {
1697 .reg = PAD_SHARED_IP_EN_1,
1698 .mask = ARM_TRACE_MASK | MIPHY_DBG_MASK,
1699 .val = 0,
1700 }, {
1701 .reg = PAD_FUNCTION_EN_5,
1702 .mask = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
1703 .val = 0x0,
1704 }, {
1705 .reg = PAD_FUNCTION_EN_6,
1706 .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
1707 .val = 0x0,
1708 }, {
1709 .reg = PAD_FUNCTION_EN_7,
1710 .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
1711 .val = 0x0,
1712 },
1713 };
1714
1715 static struct spear_modemux clcd_sleep_modemux[] = {
1716 {
1717 .muxregs = clcd_sleep_muxreg,
1718 .nmuxregs = ARRAY_SIZE(clcd_sleep_muxreg),
1719 },
1720 };
1721
1722 static struct spear_pingroup clcd_sleep_pingroup = {
1723 .name = "clcd_sleep_grp",
1724 .pins = clcd_pins,
1725 .npins = ARRAY_SIZE(clcd_pins),
1726 .modemuxs = clcd_sleep_modemux,
1727 .nmodemuxs = ARRAY_SIZE(clcd_sleep_modemux),
1728 };
1729
1730 static const char *const clcd_grps[] = { "clcd_grp", "clcd_sleep_grp" };
1731 static struct spear_function clcd_function = {
1732 .name = "clcd",
1733 .groups = clcd_grps,
1734 .ngroups = ARRAY_SIZE(clcd_grps),
1735 };
1736
1737
1738 static const unsigned arm_trace_pins[] = { 158, 159, 160, 161, 162, 163, 164,
1739 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
1740 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
1741 193, 194, 195, 196, 197, 198, 199, 200 };
1742 static struct spear_muxreg arm_trace_muxreg[] = {
1743 {
1744 .reg = PAD_SHARED_IP_EN_1,
1745 .mask = ARM_TRACE_MASK,
1746 .val = ARM_TRACE_MASK,
1747 }, {
1748 .reg = PAD_FUNCTION_EN_5,
1749 .mask = CLCD_AND_ARM_TRACE_REG4_MASK,
1750 .val = CLCD_AND_ARM_TRACE_REG4_MASK,
1751 }, {
1752 .reg = PAD_FUNCTION_EN_6,
1753 .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
1754 .val = CLCD_AND_ARM_TRACE_REG5_MASK,
1755 }, {
1756 .reg = PAD_FUNCTION_EN_7,
1757 .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
1758 .val = CLCD_AND_ARM_TRACE_REG6_MASK,
1759 },
1760 };
1761
1762 static struct spear_modemux arm_trace_modemux[] = {
1763 {
1764 .muxregs = arm_trace_muxreg,
1765 .nmuxregs = ARRAY_SIZE(arm_trace_muxreg),
1766 },
1767 };
1768
1769 static struct spear_pingroup arm_trace_pingroup = {
1770 .name = "arm_trace_grp",
1771 .pins = arm_trace_pins,
1772 .npins = ARRAY_SIZE(arm_trace_pins),
1773 .modemuxs = arm_trace_modemux,
1774 .nmodemuxs = ARRAY_SIZE(arm_trace_modemux),
1775 };
1776
1777 static const char *const arm_trace_grps[] = { "arm_trace_grp" };
1778 static struct spear_function arm_trace_function = {
1779 .name = "arm_trace",
1780 .groups = arm_trace_grps,
1781 .ngroups = ARRAY_SIZE(arm_trace_grps),
1782 };
1783
1784
1785 static const unsigned miphy_dbg_pins[] = { 96, 97, 98, 99, 100, 101, 102, 103,
1786 132, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147,
1787 148, 149, 150, 151, 152, 153, 154, 155, 156, 157 };
1788 static struct spear_muxreg miphy_dbg_muxreg[] = {
1789 {
1790 .reg = PAD_SHARED_IP_EN_1,
1791 .mask = MIPHY_DBG_MASK,
1792 .val = MIPHY_DBG_MASK,
1793 }, {
1794 .reg = PAD_FUNCTION_EN_5,
1795 .mask = DEVS_GRP_AND_MIPHY_DBG_REG4_MASK,
1796 .val = DEVS_GRP_AND_MIPHY_DBG_REG4_MASK,
1797 },
1798 };
1799
1800 static struct spear_modemux miphy_dbg_modemux[] = {
1801 {
1802 .muxregs = miphy_dbg_muxreg,
1803 .nmuxregs = ARRAY_SIZE(miphy_dbg_muxreg),
1804 },
1805 };
1806
1807 static struct spear_pingroup miphy_dbg_pingroup = {
1808 .name = "miphy_dbg_grp",
1809 .pins = miphy_dbg_pins,
1810 .npins = ARRAY_SIZE(miphy_dbg_pins),
1811 .modemuxs = miphy_dbg_modemux,
1812 .nmodemuxs = ARRAY_SIZE(miphy_dbg_modemux),
1813 };
1814
1815 static const char *const miphy_dbg_grps[] = { "miphy_dbg_grp" };
1816 static struct spear_function miphy_dbg_function = {
1817 .name = "miphy_dbg",
1818 .groups = miphy_dbg_grps,
1819 .ngroups = ARRAY_SIZE(miphy_dbg_grps),
1820 };
1821
1822
1823 static const unsigned pcie_pins[] = { 250 };
1824 static struct spear_muxreg pcie_muxreg[] = {
1825 {
1826 .reg = PCIE_SATA_CFG,
1827 .mask = SATA_PCIE_CFG_MASK,
1828 .val = PCIE_CFG_VAL,
1829 },
1830 };
1831
1832 static struct spear_modemux pcie_modemux[] = {
1833 {
1834 .muxregs = pcie_muxreg,
1835 .nmuxregs = ARRAY_SIZE(pcie_muxreg),
1836 },
1837 };
1838
1839 static struct spear_pingroup pcie_pingroup = {
1840 .name = "pcie_grp",
1841 .pins = pcie_pins,
1842 .npins = ARRAY_SIZE(pcie_pins),
1843 .modemuxs = pcie_modemux,
1844 .nmodemuxs = ARRAY_SIZE(pcie_modemux),
1845 };
1846
1847 static const char *const pcie_grps[] = { "pcie_grp" };
1848 static struct spear_function pcie_function = {
1849 .name = "pcie",
1850 .groups = pcie_grps,
1851 .ngroups = ARRAY_SIZE(pcie_grps),
1852 };
1853
1854
1855 static const unsigned sata_pins[] = { 250 };
1856 static struct spear_muxreg sata_muxreg[] = {
1857 {
1858 .reg = PCIE_SATA_CFG,
1859 .mask = SATA_PCIE_CFG_MASK,
1860 .val = SATA_CFG_VAL,
1861 },
1862 };
1863
1864 static struct spear_modemux sata_modemux[] = {
1865 {
1866 .muxregs = sata_muxreg,
1867 .nmuxregs = ARRAY_SIZE(sata_muxreg),
1868 },
1869 };
1870
1871 static struct spear_pingroup sata_pingroup = {
1872 .name = "sata_grp",
1873 .pins = sata_pins,
1874 .npins = ARRAY_SIZE(sata_pins),
1875 .modemuxs = sata_modemux,
1876 .nmodemuxs = ARRAY_SIZE(sata_modemux),
1877 };
1878
1879 static const char *const sata_grps[] = { "sata_grp" };
1880 static struct spear_function sata_function = {
1881 .name = "sata",
1882 .groups = sata_grps,
1883 .ngroups = ARRAY_SIZE(sata_grps),
1884 };
1885
1886
1887 static struct spear_pingroup *spear1340_pingroups[] = {
1888 &pads_as_gpio_pingroup,
1889 &fsmc_8bit_pingroup,
1890 &fsmc_16bit_pingroup,
1891 &fsmc_pnor_pingroup,
1892 &keyboard_row_col_pingroup,
1893 &keyboard_col5_pingroup,
1894 &spdif_in_pingroup,
1895 &spdif_out_pingroup,
1896 &gpt_0_1_pingroup,
1897 &pwm0_pingroup,
1898 &pwm1_pingroup,
1899 &pwm2_pingroup,
1900 &pwm3_pingroup,
1901 &vip_mux_pingroup,
1902 &vip_mux_cam0_pingroup,
1903 &vip_mux_cam1_pingroup,
1904 &vip_mux_cam2_pingroup,
1905 &vip_mux_cam3_pingroup,
1906 &cam0_pingroup,
1907 &cam1_pingroup,
1908 &cam2_pingroup,
1909 &cam3_pingroup,
1910 &smi_pingroup,
1911 &ssp0_pingroup,
1912 &ssp0_cs1_pingroup,
1913 &ssp0_cs2_pingroup,
1914 &ssp0_cs3_pingroup,
1915 &uart0_pingroup,
1916 &uart0_enh_pingroup,
1917 &uart1_pingroup,
1918 &i2s_in_pingroup,
1919 &i2s_out_pingroup,
1920 &gmii_pingroup,
1921 &rgmii_pingroup,
1922 &rmii_pingroup,
1923 &sgmii_pingroup,
1924 &i2c0_pingroup,
1925 &i2c1_pingroup,
1926 &cec0_pingroup,
1927 &cec1_pingroup,
1928 &sdhci_pingroup,
1929 &cf_pingroup,
1930 &xd_pingroup,
1931 &clcd_sleep_pingroup,
1932 &clcd_pingroup,
1933 &arm_trace_pingroup,
1934 &miphy_dbg_pingroup,
1935 &pcie_pingroup,
1936 &sata_pingroup,
1937 };
1938
1939
1940 static struct spear_function *spear1340_functions[] = {
1941 &pads_as_gpio_function,
1942 &fsmc_function,
1943 &keyboard_function,
1944 &spdif_in_function,
1945 &spdif_out_function,
1946 &gpt_0_1_function,
1947 &pwm_function,
1948 &vip_function,
1949 &cam0_function,
1950 &cam1_function,
1951 &cam2_function,
1952 &cam3_function,
1953 &smi_function,
1954 &ssp0_function,
1955 &uart0_function,
1956 &uart1_function,
1957 &i2s_function,
1958 &gmac_function,
1959 &i2c0_function,
1960 &i2c1_function,
1961 &cec0_function,
1962 &cec1_function,
1963 &sdhci_function,
1964 &cf_function,
1965 &xd_function,
1966 &clcd_function,
1967 &arm_trace_function,
1968 &miphy_dbg_function,
1969 &pcie_function,
1970 &sata_function,
1971 };
1972
1973 static void gpio_request_endisable(struct spear_pmx *pmx, int pin,
1974 bool enable)
1975 {
1976 unsigned int regoffset, regindex, bitoffset;
1977 unsigned int val;
1978
1979
1980 pin++;
1981
1982 regindex = pin / 32;
1983 bitoffset = pin % 32;
1984
1985 if (regindex <= 3)
1986 regoffset = PAD_FUNCTION_EN_1 + regindex * sizeof(int *);
1987 else
1988 regoffset = PAD_FUNCTION_EN_5 + (regindex - 4) * sizeof(int *);
1989
1990 val = pmx_readl(pmx, regoffset);
1991 if (enable)
1992 val &= ~(0x1 << bitoffset);
1993 else
1994 val |= 0x1 << bitoffset;
1995
1996 pmx_writel(pmx, val, regoffset);
1997 }
1998
1999 static struct spear_pinctrl_machdata spear1340_machdata = {
2000 .pins = spear1340_pins,
2001 .npins = ARRAY_SIZE(spear1340_pins),
2002 .groups = spear1340_pingroups,
2003 .ngroups = ARRAY_SIZE(spear1340_pingroups),
2004 .functions = spear1340_functions,
2005 .nfunctions = ARRAY_SIZE(spear1340_functions),
2006 .gpio_request_endisable = gpio_request_endisable,
2007 .modes_supported = false,
2008 };
2009
2010 static const struct of_device_id spear1340_pinctrl_of_match[] = {
2011 {
2012 .compatible = "st,spear1340-pinmux",
2013 },
2014 {},
2015 };
2016
2017 static int spear1340_pinctrl_probe(struct platform_device *pdev)
2018 {
2019 return spear_pinctrl_probe(pdev, &spear1340_machdata);
2020 }
2021
2022 static struct platform_driver spear1340_pinctrl_driver = {
2023 .driver = {
2024 .name = DRIVER_NAME,
2025 .of_match_table = spear1340_pinctrl_of_match,
2026 },
2027 .probe = spear1340_pinctrl_probe,
2028 };
2029
2030 static int __init spear1340_pinctrl_init(void)
2031 {
2032 return platform_driver_register(&spear1340_pinctrl_driver);
2033 }
2034 arch_initcall(spear1340_pinctrl_init);