Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Copyright (c) 2017, The Linux Foundation. All rights reserved.
0004  */
0005 
0006 #include <linux/module.h>
0007 #include <linux/of.h>
0008 #include <linux/platform_device.h>
0009 #include <linux/pinctrl/pinctrl.h>
0010 
0011 #include "pinctrl-msm.h"
0012 
0013 #define FUNCTION(fname)                         \
0014     [msm_mux_##fname] = {                       \
0015         .name = #fname,             \
0016         .groups = fname##_groups,               \
0017         .ngroups = ARRAY_SIZE(fname##_groups),  \
0018     }
0019 
0020 #define REG_SIZE 0x1000
0021 #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7, f8, f9)    \
0022     {                           \
0023         .name = "gpio" #id,         \
0024         .pins = gpio##id##_pins,        \
0025         .npins = (unsigned int)ARRAY_SIZE(gpio##id##_pins), \
0026         .funcs = (int[]){           \
0027             msm_mux_gpio, /* gpio mode */   \
0028             msm_mux_##f1,           \
0029             msm_mux_##f2,           \
0030             msm_mux_##f3,           \
0031             msm_mux_##f4,           \
0032             msm_mux_##f5,           \
0033             msm_mux_##f6,           \
0034             msm_mux_##f7,           \
0035             msm_mux_##f8,           \
0036             msm_mux_##f9            \
0037         },                      \
0038         .nfuncs = 10,               \
0039         .ctl_reg = REG_SIZE * id,       \
0040         .io_reg = 0x4 + REG_SIZE * id,      \
0041         .intr_cfg_reg = 0x8 + REG_SIZE * id,        \
0042         .intr_status_reg = 0xc + REG_SIZE * id, \
0043         .intr_target_reg = 0x8 + REG_SIZE * id, \
0044         .mux_bit = 2,           \
0045         .pull_bit = 0,          \
0046         .drv_bit = 6,           \
0047         .oe_bit = 9,            \
0048         .in_bit = 0,            \
0049         .out_bit = 1,           \
0050         .intr_enable_bit = 0,       \
0051         .intr_status_bit = 0,       \
0052         .intr_target_bit = 5,       \
0053         .intr_target_kpss_val = 3,  \
0054         .intr_raw_status_bit = 4,   \
0055         .intr_polarity_bit = 1,     \
0056         .intr_detection_bit = 2,    \
0057         .intr_detection_width = 2,  \
0058     }
0059 
0060 static const struct pinctrl_pin_desc ipq8074_pins[] = {
0061     PINCTRL_PIN(0, "GPIO_0"),
0062     PINCTRL_PIN(1, "GPIO_1"),
0063     PINCTRL_PIN(2, "GPIO_2"),
0064     PINCTRL_PIN(3, "GPIO_3"),
0065     PINCTRL_PIN(4, "GPIO_4"),
0066     PINCTRL_PIN(5, "GPIO_5"),
0067     PINCTRL_PIN(6, "GPIO_6"),
0068     PINCTRL_PIN(7, "GPIO_7"),
0069     PINCTRL_PIN(8, "GPIO_8"),
0070     PINCTRL_PIN(9, "GPIO_9"),
0071     PINCTRL_PIN(10, "GPIO_10"),
0072     PINCTRL_PIN(11, "GPIO_11"),
0073     PINCTRL_PIN(12, "GPIO_12"),
0074     PINCTRL_PIN(13, "GPIO_13"),
0075     PINCTRL_PIN(14, "GPIO_14"),
0076     PINCTRL_PIN(15, "GPIO_15"),
0077     PINCTRL_PIN(16, "GPIO_16"),
0078     PINCTRL_PIN(17, "GPIO_17"),
0079     PINCTRL_PIN(18, "GPIO_18"),
0080     PINCTRL_PIN(19, "GPIO_19"),
0081     PINCTRL_PIN(20, "GPIO_20"),
0082     PINCTRL_PIN(21, "GPIO_21"),
0083     PINCTRL_PIN(22, "GPIO_22"),
0084     PINCTRL_PIN(23, "GPIO_23"),
0085     PINCTRL_PIN(24, "GPIO_24"),
0086     PINCTRL_PIN(25, "GPIO_25"),
0087     PINCTRL_PIN(26, "GPIO_26"),
0088     PINCTRL_PIN(27, "GPIO_27"),
0089     PINCTRL_PIN(28, "GPIO_28"),
0090     PINCTRL_PIN(29, "GPIO_29"),
0091     PINCTRL_PIN(30, "GPIO_30"),
0092     PINCTRL_PIN(31, "GPIO_31"),
0093     PINCTRL_PIN(32, "GPIO_32"),
0094     PINCTRL_PIN(33, "GPIO_33"),
0095     PINCTRL_PIN(34, "GPIO_34"),
0096     PINCTRL_PIN(35, "GPIO_35"),
0097     PINCTRL_PIN(36, "GPIO_36"),
0098     PINCTRL_PIN(37, "GPIO_37"),
0099     PINCTRL_PIN(38, "GPIO_38"),
0100     PINCTRL_PIN(39, "GPIO_39"),
0101     PINCTRL_PIN(40, "GPIO_40"),
0102     PINCTRL_PIN(41, "GPIO_41"),
0103     PINCTRL_PIN(42, "GPIO_42"),
0104     PINCTRL_PIN(43, "GPIO_43"),
0105     PINCTRL_PIN(44, "GPIO_44"),
0106     PINCTRL_PIN(45, "GPIO_45"),
0107     PINCTRL_PIN(46, "GPIO_46"),
0108     PINCTRL_PIN(47, "GPIO_47"),
0109     PINCTRL_PIN(48, "GPIO_48"),
0110     PINCTRL_PIN(49, "GPIO_49"),
0111     PINCTRL_PIN(50, "GPIO_50"),
0112     PINCTRL_PIN(51, "GPIO_51"),
0113     PINCTRL_PIN(52, "GPIO_52"),
0114     PINCTRL_PIN(53, "GPIO_53"),
0115     PINCTRL_PIN(54, "GPIO_54"),
0116     PINCTRL_PIN(55, "GPIO_55"),
0117     PINCTRL_PIN(56, "GPIO_56"),
0118     PINCTRL_PIN(57, "GPIO_57"),
0119     PINCTRL_PIN(58, "GPIO_58"),
0120     PINCTRL_PIN(59, "GPIO_59"),
0121     PINCTRL_PIN(60, "GPIO_60"),
0122     PINCTRL_PIN(61, "GPIO_61"),
0123     PINCTRL_PIN(62, "GPIO_62"),
0124     PINCTRL_PIN(63, "GPIO_63"),
0125     PINCTRL_PIN(64, "GPIO_64"),
0126     PINCTRL_PIN(65, "GPIO_65"),
0127     PINCTRL_PIN(66, "GPIO_66"),
0128     PINCTRL_PIN(67, "GPIO_67"),
0129     PINCTRL_PIN(68, "GPIO_68"),
0130     PINCTRL_PIN(69, "GPIO_69"),
0131 };
0132 
0133 #define DECLARE_MSM_GPIO_PINS(pin) \
0134     static const unsigned int gpio##pin##_pins[] = { pin }
0135 DECLARE_MSM_GPIO_PINS(0);
0136 DECLARE_MSM_GPIO_PINS(1);
0137 DECLARE_MSM_GPIO_PINS(2);
0138 DECLARE_MSM_GPIO_PINS(3);
0139 DECLARE_MSM_GPIO_PINS(4);
0140 DECLARE_MSM_GPIO_PINS(5);
0141 DECLARE_MSM_GPIO_PINS(6);
0142 DECLARE_MSM_GPIO_PINS(7);
0143 DECLARE_MSM_GPIO_PINS(8);
0144 DECLARE_MSM_GPIO_PINS(9);
0145 DECLARE_MSM_GPIO_PINS(10);
0146 DECLARE_MSM_GPIO_PINS(11);
0147 DECLARE_MSM_GPIO_PINS(12);
0148 DECLARE_MSM_GPIO_PINS(13);
0149 DECLARE_MSM_GPIO_PINS(14);
0150 DECLARE_MSM_GPIO_PINS(15);
0151 DECLARE_MSM_GPIO_PINS(16);
0152 DECLARE_MSM_GPIO_PINS(17);
0153 DECLARE_MSM_GPIO_PINS(18);
0154 DECLARE_MSM_GPIO_PINS(19);
0155 DECLARE_MSM_GPIO_PINS(20);
0156 DECLARE_MSM_GPIO_PINS(21);
0157 DECLARE_MSM_GPIO_PINS(22);
0158 DECLARE_MSM_GPIO_PINS(23);
0159 DECLARE_MSM_GPIO_PINS(24);
0160 DECLARE_MSM_GPIO_PINS(25);
0161 DECLARE_MSM_GPIO_PINS(26);
0162 DECLARE_MSM_GPIO_PINS(27);
0163 DECLARE_MSM_GPIO_PINS(28);
0164 DECLARE_MSM_GPIO_PINS(29);
0165 DECLARE_MSM_GPIO_PINS(30);
0166 DECLARE_MSM_GPIO_PINS(31);
0167 DECLARE_MSM_GPIO_PINS(32);
0168 DECLARE_MSM_GPIO_PINS(33);
0169 DECLARE_MSM_GPIO_PINS(34);
0170 DECLARE_MSM_GPIO_PINS(35);
0171 DECLARE_MSM_GPIO_PINS(36);
0172 DECLARE_MSM_GPIO_PINS(37);
0173 DECLARE_MSM_GPIO_PINS(38);
0174 DECLARE_MSM_GPIO_PINS(39);
0175 DECLARE_MSM_GPIO_PINS(40);
0176 DECLARE_MSM_GPIO_PINS(41);
0177 DECLARE_MSM_GPIO_PINS(42);
0178 DECLARE_MSM_GPIO_PINS(43);
0179 DECLARE_MSM_GPIO_PINS(44);
0180 DECLARE_MSM_GPIO_PINS(45);
0181 DECLARE_MSM_GPIO_PINS(46);
0182 DECLARE_MSM_GPIO_PINS(47);
0183 DECLARE_MSM_GPIO_PINS(48);
0184 DECLARE_MSM_GPIO_PINS(49);
0185 DECLARE_MSM_GPIO_PINS(50);
0186 DECLARE_MSM_GPIO_PINS(51);
0187 DECLARE_MSM_GPIO_PINS(52);
0188 DECLARE_MSM_GPIO_PINS(53);
0189 DECLARE_MSM_GPIO_PINS(54);
0190 DECLARE_MSM_GPIO_PINS(55);
0191 DECLARE_MSM_GPIO_PINS(56);
0192 DECLARE_MSM_GPIO_PINS(57);
0193 DECLARE_MSM_GPIO_PINS(58);
0194 DECLARE_MSM_GPIO_PINS(59);
0195 DECLARE_MSM_GPIO_PINS(60);
0196 DECLARE_MSM_GPIO_PINS(61);
0197 DECLARE_MSM_GPIO_PINS(62);
0198 DECLARE_MSM_GPIO_PINS(63);
0199 DECLARE_MSM_GPIO_PINS(64);
0200 DECLARE_MSM_GPIO_PINS(65);
0201 DECLARE_MSM_GPIO_PINS(66);
0202 DECLARE_MSM_GPIO_PINS(67);
0203 DECLARE_MSM_GPIO_PINS(68);
0204 DECLARE_MSM_GPIO_PINS(69);
0205 
0206 enum ipq8074_functions {
0207     msm_mux_atest_char,
0208     msm_mux_atest_char0,
0209     msm_mux_atest_char1,
0210     msm_mux_atest_char2,
0211     msm_mux_atest_char3,
0212     msm_mux_audio_rxbclk,
0213     msm_mux_audio_rxd,
0214     msm_mux_audio_rxfsync,
0215     msm_mux_audio_rxmclk,
0216     msm_mux_audio_txbclk,
0217     msm_mux_audio_txd,
0218     msm_mux_audio_txfsync,
0219     msm_mux_audio_txmclk,
0220     msm_mux_blsp0_i2c,
0221     msm_mux_blsp0_spi,
0222     msm_mux_blsp0_uart,
0223     msm_mux_blsp1_i2c,
0224     msm_mux_blsp1_spi,
0225     msm_mux_blsp1_uart,
0226     msm_mux_blsp2_i2c,
0227     msm_mux_blsp2_spi,
0228     msm_mux_blsp2_uart,
0229     msm_mux_blsp3_i2c,
0230     msm_mux_blsp3_spi,
0231     msm_mux_blsp3_spi0,
0232     msm_mux_blsp3_spi1,
0233     msm_mux_blsp3_spi2,
0234     msm_mux_blsp3_spi3,
0235     msm_mux_blsp3_uart,
0236     msm_mux_blsp4_i2c0,
0237     msm_mux_blsp4_i2c1,
0238     msm_mux_blsp4_spi0,
0239     msm_mux_blsp4_spi1,
0240     msm_mux_blsp4_uart0,
0241     msm_mux_blsp4_uart1,
0242     msm_mux_blsp5_i2c,
0243     msm_mux_blsp5_spi,
0244     msm_mux_blsp5_uart,
0245     msm_mux_burn0,
0246     msm_mux_burn1,
0247     msm_mux_cri_trng,
0248     msm_mux_cri_trng0,
0249     msm_mux_cri_trng1,
0250     msm_mux_cxc0,
0251     msm_mux_cxc1,
0252     msm_mux_dbg_out,
0253     msm_mux_gcc_plltest,
0254     msm_mux_gcc_tlmm,
0255     msm_mux_gpio,
0256     msm_mux_ldo_en,
0257     msm_mux_ldo_update,
0258     msm_mux_led0,
0259     msm_mux_led1,
0260     msm_mux_led2,
0261     msm_mux_mac0_sa0,
0262     msm_mux_mac0_sa1,
0263     msm_mux_mac1_sa0,
0264     msm_mux_mac1_sa1,
0265     msm_mux_mac1_sa2,
0266     msm_mux_mac1_sa3,
0267     msm_mux_mac2_sa0,
0268     msm_mux_mac2_sa1,
0269     msm_mux_mdc,
0270     msm_mux_mdio,
0271     msm_mux_pcie0_clk,
0272     msm_mux_pcie0_rst,
0273     msm_mux_pcie0_wake,
0274     msm_mux_pcie1_clk,
0275     msm_mux_pcie1_rst,
0276     msm_mux_pcie1_wake,
0277     msm_mux_pcm_drx,
0278     msm_mux_pcm_dtx,
0279     msm_mux_pcm_fsync,
0280     msm_mux_pcm_pclk,
0281     msm_mux_pcm_zsi0,
0282     msm_mux_pcm_zsi1,
0283     msm_mux_prng_rosc,
0284     msm_mux_pta1_0,
0285     msm_mux_pta1_1,
0286     msm_mux_pta1_2,
0287     msm_mux_pta2_0,
0288     msm_mux_pta2_1,
0289     msm_mux_pta2_2,
0290     msm_mux_pwm0,
0291     msm_mux_pwm1,
0292     msm_mux_pwm2,
0293     msm_mux_pwm3,
0294     msm_mux_qdss_cti_trig_in_a0,
0295     msm_mux_qdss_cti_trig_in_a1,
0296     msm_mux_qdss_cti_trig_in_b0,
0297     msm_mux_qdss_cti_trig_in_b1,
0298     msm_mux_qdss_cti_trig_out_a0,
0299     msm_mux_qdss_cti_trig_out_a1,
0300     msm_mux_qdss_cti_trig_out_b0,
0301     msm_mux_qdss_cti_trig_out_b1,
0302     msm_mux_qdss_traceclk_a,
0303     msm_mux_qdss_traceclk_b,
0304     msm_mux_qdss_tracectl_a,
0305     msm_mux_qdss_tracectl_b,
0306     msm_mux_qdss_tracedata_a,
0307     msm_mux_qdss_tracedata_b,
0308     msm_mux_qpic,
0309     msm_mux_rx0,
0310     msm_mux_rx1,
0311     msm_mux_rx2,
0312     msm_mux_sd_card,
0313     msm_mux_sd_write,
0314     msm_mux_tsens_max,
0315     msm_mux_wci2a,
0316     msm_mux_wci2b,
0317     msm_mux_wci2c,
0318     msm_mux_wci2d,
0319     msm_mux_NA,
0320 };
0321 
0322 static const char * const qpic_groups[] = {
0323     "gpio0",    /* LCD_TE */
0324     "gpio1",    /* BUSY_N */
0325     "gpio2",    /* LCD_RS_N */
0326     "gpio3",    /* WE_N */
0327     "gpio4",    /* OE_N */
0328     "gpio5",    /* DATA[0] */
0329     "gpio6",    /* DATA[1] */
0330     "gpio7",    /* DATA[2] */
0331     "gpio8",    /* DATA[3] */
0332     "gpio9",    /* CS_CSR_LCD */
0333     "gpio10",   /* CLE */
0334     "gpio11",   /* NAND_CS_N */
0335     "gpio12",   /* DATA[4] */
0336     "gpio13",   /* DATA[5] */
0337     "gpio14",   /* DATA[6] */
0338     "gpio15",   /* DATA[7] */
0339     "gpio16",   /* DATA[8] */
0340     "gpio17",   /* ALE */
0341 };
0342 
0343 static const char * const blsp5_i2c_groups[] = {
0344     "gpio0", "gpio2",
0345 };
0346 
0347 static const char * const blsp5_spi_groups[] = {
0348     "gpio0", "gpio2", "gpio9", "gpio16",
0349 };
0350 
0351 static const char * const wci2a_groups[] = {
0352     "gpio0", "gpio2",
0353 };
0354 
0355 static const char * const blsp3_spi3_groups[] = {
0356     "gpio0", "gpio2", "gpio9",
0357 };
0358 
0359 static const char * const burn0_groups[] = {
0360     "gpio0",
0361 };
0362 
0363 static const char * const pcm_zsi0_groups[] = {
0364     "gpio1",
0365 };
0366 
0367 static const char * const blsp5_uart_groups[] = {
0368     "gpio0", "gpio2", "gpio9", "gpio16",
0369 };
0370 
0371 static const char * const mac1_sa2_groups[] = {
0372     "gpio1", "gpio11",
0373 };
0374 
0375 static const char * const blsp3_spi0_groups[] = {
0376     "gpio1", "gpio3", "gpio4",
0377 };
0378 
0379 static const char * const burn1_groups[] = {
0380     "gpio1",
0381 };
0382 
0383 static const char * const mac0_sa1_groups[] = {
0384     "gpio3", "gpio4",
0385 };
0386 
0387 static const char * const qdss_cti_trig_out_b0_groups[] = {
0388     "gpio3",
0389 };
0390 
0391 static const char * const qdss_cti_trig_in_b0_groups[] = {
0392     "gpio4",
0393 };
0394 
0395 static const char * const blsp4_uart0_groups[] = {
0396     "gpio5", "gpio6", "gpio7", "gpio8",
0397 };
0398 
0399 static const char * const blsp4_i2c0_groups[] = {
0400     "gpio5", "gpio6",
0401 };
0402 
0403 static const char * const blsp4_spi0_groups[] = {
0404     "gpio5", "gpio6", "gpio7", "gpio8",
0405 };
0406 
0407 static const char * const mac2_sa1_groups[] = {
0408     "gpio5", "gpio6",
0409 };
0410 
0411 static const char * const qdss_cti_trig_out_b1_groups[] = {
0412     "gpio5",
0413 };
0414 
0415 static const char * const qdss_cti_trig_in_b1_groups[] = {
0416     "gpio6",
0417 };
0418 
0419 static const char * const cxc0_groups[] = {
0420     "gpio9", "gpio16",
0421 };
0422 
0423 static const char * const mac1_sa3_groups[] = {
0424     "gpio9", "gpio16",
0425 };
0426 
0427 static const char * const qdss_cti_trig_in_a1_groups[] = {
0428     "gpio9",
0429 };
0430 
0431 static const char * const qdss_cti_trig_out_a1_groups[] = {
0432     "gpio10",
0433 };
0434 
0435 static const char * const wci2c_groups[] = {
0436     "gpio11", "gpio17",
0437 };
0438 
0439 static const char * const qdss_cti_trig_in_a0_groups[] = {
0440     "gpio11",
0441 };
0442 
0443 static const char * const qdss_cti_trig_out_a0_groups[] = {
0444     "gpio12",
0445 };
0446 
0447 static const char * const qdss_traceclk_b_groups[] = {
0448     "gpio14",
0449 };
0450 
0451 static const char * const qdss_tracectl_b_groups[] = {
0452     "gpio15",
0453 };
0454 
0455 static const char * const pcm_zsi1_groups[] = {
0456     "gpio16",
0457 };
0458 
0459 static const char * const qdss_tracedata_b_groups[] = {
0460     "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21", "gpio22",
0461     "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28", "gpio29",
0462     "gpio30", "gpio31",
0463 };
0464 
0465 static const char * const led0_groups[] = {
0466     "gpio18",
0467 };
0468 
0469 static const char * const pwm0_groups[] = {
0470     "gpio18", "gpio21", "gpio25", "gpio29", "gpio63",
0471 };
0472 
0473 static const char * const led1_groups[] = {
0474     "gpio19",
0475 };
0476 
0477 static const char * const pwm1_groups[] = {
0478     "gpio19", "gpio22", "gpio26", "gpio30", "gpio64",
0479 };
0480 
0481 static const char * const led2_groups[] = {
0482     "gpio20",
0483 };
0484 
0485 static const char * const pwm2_groups[] = {
0486     "gpio20", "gpio23", "gpio27", "gpio31", "gpio66",
0487 };
0488 
0489 static const char * const blsp4_uart1_groups[] = {
0490     "gpio21", "gpio22", "gpio23", "gpio24",
0491 };
0492 
0493 static const char * const blsp4_i2c1_groups[] = {
0494     "gpio21", "gpio22",
0495 };
0496 
0497 static const char * const blsp4_spi1_groups[] = {
0498     "gpio21", "gpio22", "gpio23", "gpio24",
0499 };
0500 
0501 static const char * const wci2d_groups[] = {
0502     "gpio21", "gpio22",
0503 };
0504 
0505 static const char * const mac1_sa1_groups[] = {
0506     "gpio21", "gpio22",
0507 };
0508 
0509 static const char * const blsp3_spi2_groups[] = {
0510     "gpio21", "gpio22", "gpio23",
0511 };
0512 
0513 static const char * const pwm3_groups[] = {
0514     "gpio24", "gpio28", "gpio32", "gpio67",
0515 };
0516 
0517 static const char * const audio_txmclk_groups[] = {
0518     "gpio25",
0519 };
0520 
0521 static const char * const audio_txbclk_groups[] = {
0522     "gpio26",
0523 };
0524 
0525 static const char * const audio_txfsync_groups[] = {
0526     "gpio27",
0527 };
0528 
0529 static const char * const audio_txd_groups[] = {
0530     "gpio28",
0531 };
0532 
0533 static const char * const audio_rxmclk_groups[] = {
0534     "gpio29",
0535 };
0536 
0537 static const char * const atest_char0_groups[] = {
0538     "gpio29",
0539 };
0540 
0541 static const char * const audio_rxbclk_groups[] = {
0542     "gpio30",
0543 };
0544 
0545 static const char * const atest_char1_groups[] = {
0546     "gpio30",
0547 };
0548 
0549 static const char * const audio_rxfsync_groups[] = {
0550     "gpio31",
0551 };
0552 
0553 static const char * const atest_char2_groups[] = {
0554     "gpio31",
0555 };
0556 
0557 static const char * const audio_rxd_groups[] = {
0558     "gpio32",
0559 };
0560 
0561 static const char * const atest_char3_groups[] = {
0562     "gpio32",
0563 };
0564 
0565 static const char * const pcm_drx_groups[] = {
0566     "gpio33",
0567 };
0568 
0569 static const char * const mac1_sa0_groups[] = {
0570     "gpio33", "gpio34",
0571 };
0572 
0573 static const char * const mac0_sa0_groups[] = {
0574     "gpio33", "gpio34",
0575 };
0576 
0577 static const char * const pcm_dtx_groups[] = {
0578     "gpio34",
0579 };
0580 
0581 static const char * const pcm_fsync_groups[] = {
0582     "gpio35",
0583 };
0584 
0585 static const char * const mac2_sa0_groups[] = {
0586     "gpio35", "gpio36",
0587 };
0588 
0589 static const char * const qdss_traceclk_a_groups[] = {
0590     "gpio35",
0591 };
0592 
0593 static const char * const pcm_pclk_groups[] = {
0594     "gpio36",
0595 };
0596 
0597 static const char * const qdss_tracectl_a_groups[] = {
0598     "gpio36",
0599 };
0600 
0601 static const char * const atest_char_groups[] = {
0602     "gpio37",
0603 };
0604 
0605 static const char * const qdss_tracedata_a_groups[] = {
0606     "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42", "gpio43",
0607     "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49", "gpio50",
0608     "gpio51", "gpio52",
0609 };
0610 
0611 static const char * const blsp0_uart_groups[] = {
0612     "gpio38", "gpio39", "gpio40", "gpio41",
0613 };
0614 
0615 static const char * const blsp0_i2c_groups[] = {
0616     "gpio38", "gpio39",
0617 };
0618 
0619 static const char * const blsp0_spi_groups[] = {
0620     "gpio38", "gpio39", "gpio40", "gpio41",
0621 };
0622 
0623 static const char * const blsp1_uart_groups[] = {
0624     "gpio42", "gpio43", "gpio44", "gpio45",
0625 };
0626 
0627 static const char * const blsp1_i2c_groups[] = {
0628     "gpio42", "gpio43",
0629 };
0630 
0631 static const char * const blsp1_spi_groups[] = {
0632     "gpio42", "gpio43", "gpio44", "gpio45",
0633 };
0634 
0635 static const char * const blsp2_uart_groups[] = {
0636     "gpio46", "gpio47", "gpio48", "gpio49",
0637 };
0638 
0639 static const char * const blsp2_i2c_groups[] = {
0640     "gpio46", "gpio47",
0641 };
0642 
0643 static const char * const blsp2_spi_groups[] = {
0644     "gpio46", "gpio47", "gpio48", "gpio49",
0645 };
0646 
0647 static const char * const blsp3_uart_groups[] = {
0648     "gpio50", "gpio51", "gpio52", "gpio53",
0649 };
0650 
0651 static const char * const blsp3_i2c_groups[] = {
0652     "gpio50", "gpio51",
0653 };
0654 
0655 static const char * const blsp3_spi_groups[] = {
0656     "gpio50", "gpio51", "gpio52", "gpio53",
0657 };
0658 
0659 static const char * const pta2_0_groups[] = {
0660     "gpio54",
0661 };
0662 
0663 static const char * const wci2b_groups[] = {
0664     "gpio54", "gpio56",
0665 };
0666 
0667 static const char * const cxc1_groups[] = {
0668     "gpio54", "gpio56",
0669 };
0670 
0671 static const char * const blsp3_spi1_groups[] = {
0672     "gpio54", "gpio55", "gpio56",
0673 };
0674 
0675 static const char * const pta2_1_groups[] = {
0676     "gpio55",
0677 };
0678 
0679 static const char * const pta2_2_groups[] = {
0680     "gpio56",
0681 };
0682 
0683 static const char * const pcie0_clk_groups[] = {
0684     "gpio57",
0685 };
0686 
0687 static const char * const dbg_out_groups[] = {
0688     "gpio57",
0689 };
0690 
0691 static const char * const cri_trng0_groups[] = {
0692     "gpio57",
0693 };
0694 
0695 static const char * const pcie0_rst_groups[] = {
0696     "gpio58",
0697 };
0698 
0699 static const char * const cri_trng1_groups[] = {
0700     "gpio58",
0701 };
0702 
0703 static const char * const pcie0_wake_groups[] = {
0704     "gpio59",
0705 };
0706 
0707 static const char * const cri_trng_groups[] = {
0708     "gpio59",
0709 };
0710 
0711 static const char * const pcie1_clk_groups[] = {
0712     "gpio60",
0713 };
0714 
0715 static const char * const rx2_groups[] = {
0716     "gpio60",
0717 };
0718 
0719 static const char * const ldo_update_groups[] = {
0720     "gpio60",
0721 };
0722 
0723 static const char * const pcie1_rst_groups[] = {
0724     "gpio61",
0725 };
0726 
0727 static const char * const ldo_en_groups[] = {
0728     "gpio61",
0729 };
0730 
0731 static const char * const pcie1_wake_groups[] = {
0732     "gpio62",
0733 };
0734 
0735 static const char * const gcc_plltest_groups[] = {
0736     "gpio62", "gpio63",
0737 };
0738 
0739 static const char * const sd_card_groups[] = {
0740     "gpio63",
0741 };
0742 
0743 static const char * const pta1_1_groups[] = {
0744     "gpio64",
0745 };
0746 
0747 static const char * const rx1_groups[] = {
0748     "gpio64",
0749 };
0750 
0751 static const char * const pta1_2_groups[] = {
0752     "gpio65",
0753 };
0754 
0755 static const char * const gcc_tlmm_groups[] = {
0756     "gpio65",
0757 };
0758 
0759 static const char * const pta1_0_groups[] = {
0760     "gpio66",
0761 };
0762 
0763 static const char * const prng_rosc_groups[] = {
0764     "gpio66",
0765 };
0766 
0767 static const char * const sd_write_groups[] = {
0768     "gpio67",
0769 };
0770 
0771 static const char * const rx0_groups[] = {
0772     "gpio67",
0773 };
0774 
0775 static const char * const tsens_max_groups[] = {
0776     "gpio67",
0777 };
0778 
0779 static const char * const mdc_groups[] = {
0780     "gpio68",
0781 };
0782 
0783 static const char * const mdio_groups[] = {
0784     "gpio69",
0785 };
0786 
0787 static const char * const gpio_groups[] = {
0788     "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
0789     "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
0790     "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
0791     "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
0792     "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
0793     "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
0794     "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
0795     "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
0796     "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
0797     "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69",
0798 };
0799 
0800 static const struct msm_function ipq8074_functions[] = {
0801     FUNCTION(atest_char),
0802     FUNCTION(atest_char0),
0803     FUNCTION(atest_char1),
0804     FUNCTION(atest_char2),
0805     FUNCTION(atest_char3),
0806     FUNCTION(audio_rxbclk),
0807     FUNCTION(audio_rxd),
0808     FUNCTION(audio_rxfsync),
0809     FUNCTION(audio_rxmclk),
0810     FUNCTION(audio_txbclk),
0811     FUNCTION(audio_txd),
0812     FUNCTION(audio_txfsync),
0813     FUNCTION(audio_txmclk),
0814     FUNCTION(blsp0_i2c),
0815     FUNCTION(blsp0_spi),
0816     FUNCTION(blsp0_uart),
0817     FUNCTION(blsp1_i2c),
0818     FUNCTION(blsp1_spi),
0819     FUNCTION(blsp1_uart),
0820     FUNCTION(blsp2_i2c),
0821     FUNCTION(blsp2_spi),
0822     FUNCTION(blsp2_uart),
0823     FUNCTION(blsp3_i2c),
0824     FUNCTION(blsp3_spi),
0825     FUNCTION(blsp3_spi0),
0826     FUNCTION(blsp3_spi1),
0827     FUNCTION(blsp3_spi2),
0828     FUNCTION(blsp3_spi3),
0829     FUNCTION(blsp3_uart),
0830     FUNCTION(blsp4_i2c0),
0831     FUNCTION(blsp4_i2c1),
0832     FUNCTION(blsp4_spi0),
0833     FUNCTION(blsp4_spi1),
0834     FUNCTION(blsp4_uart0),
0835     FUNCTION(blsp4_uart1),
0836     FUNCTION(blsp5_i2c),
0837     FUNCTION(blsp5_spi),
0838     FUNCTION(blsp5_uart),
0839     FUNCTION(burn0),
0840     FUNCTION(burn1),
0841     FUNCTION(cri_trng),
0842     FUNCTION(cri_trng0),
0843     FUNCTION(cri_trng1),
0844     FUNCTION(cxc0),
0845     FUNCTION(cxc1),
0846     FUNCTION(dbg_out),
0847     FUNCTION(gcc_plltest),
0848     FUNCTION(gcc_tlmm),
0849     FUNCTION(gpio),
0850     FUNCTION(ldo_en),
0851     FUNCTION(ldo_update),
0852     FUNCTION(led0),
0853     FUNCTION(led1),
0854     FUNCTION(led2),
0855     FUNCTION(mac0_sa0),
0856     FUNCTION(mac0_sa1),
0857     FUNCTION(mac1_sa0),
0858     FUNCTION(mac1_sa1),
0859     FUNCTION(mac1_sa2),
0860     FUNCTION(mac1_sa3),
0861     FUNCTION(mac2_sa0),
0862     FUNCTION(mac2_sa1),
0863     FUNCTION(mdc),
0864     FUNCTION(mdio),
0865     FUNCTION(pcie0_clk),
0866     FUNCTION(pcie0_rst),
0867     FUNCTION(pcie0_wake),
0868     FUNCTION(pcie1_clk),
0869     FUNCTION(pcie1_rst),
0870     FUNCTION(pcie1_wake),
0871     FUNCTION(pcm_drx),
0872     FUNCTION(pcm_dtx),
0873     FUNCTION(pcm_fsync),
0874     FUNCTION(pcm_pclk),
0875     FUNCTION(pcm_zsi0),
0876     FUNCTION(pcm_zsi1),
0877     FUNCTION(prng_rosc),
0878     FUNCTION(pta1_0),
0879     FUNCTION(pta1_1),
0880     FUNCTION(pta1_2),
0881     FUNCTION(pta2_0),
0882     FUNCTION(pta2_1),
0883     FUNCTION(pta2_2),
0884     FUNCTION(pwm0),
0885     FUNCTION(pwm1),
0886     FUNCTION(pwm2),
0887     FUNCTION(pwm3),
0888     FUNCTION(qdss_cti_trig_in_a0),
0889     FUNCTION(qdss_cti_trig_in_a1),
0890     FUNCTION(qdss_cti_trig_in_b0),
0891     FUNCTION(qdss_cti_trig_in_b1),
0892     FUNCTION(qdss_cti_trig_out_a0),
0893     FUNCTION(qdss_cti_trig_out_a1),
0894     FUNCTION(qdss_cti_trig_out_b0),
0895     FUNCTION(qdss_cti_trig_out_b1),
0896     FUNCTION(qdss_traceclk_a),
0897     FUNCTION(qdss_traceclk_b),
0898     FUNCTION(qdss_tracectl_a),
0899     FUNCTION(qdss_tracectl_b),
0900     FUNCTION(qdss_tracedata_a),
0901     FUNCTION(qdss_tracedata_b),
0902     FUNCTION(qpic),
0903     FUNCTION(rx0),
0904     FUNCTION(rx1),
0905     FUNCTION(rx2),
0906     FUNCTION(sd_card),
0907     FUNCTION(sd_write),
0908     FUNCTION(tsens_max),
0909     FUNCTION(wci2a),
0910     FUNCTION(wci2b),
0911     FUNCTION(wci2c),
0912     FUNCTION(wci2d),
0913 };
0914 
0915 static const struct msm_pingroup ipq8074_groups[] = {
0916     PINGROUP(0, qpic, blsp5_uart, blsp5_i2c, blsp5_spi, wci2a,
0917          blsp3_spi3, NA, burn0, NA),
0918     PINGROUP(1, qpic, pcm_zsi0, mac1_sa2, blsp3_spi0, NA, burn1, NA, NA,
0919          NA),
0920     PINGROUP(2, qpic, blsp5_uart, blsp5_i2c, blsp5_spi, wci2a,
0921          blsp3_spi3, NA, NA, NA),
0922     PINGROUP(3, qpic, mac0_sa1, blsp3_spi0, qdss_cti_trig_out_b0, NA, NA,
0923          NA, NA, NA),
0924     PINGROUP(4, qpic, mac0_sa1, blsp3_spi0, qdss_cti_trig_in_b0, NA, NA,
0925          NA, NA, NA),
0926     PINGROUP(5, qpic, blsp4_uart0, blsp4_i2c0, blsp4_spi0, mac2_sa1,
0927          qdss_cti_trig_out_b1, NA, NA, NA),
0928     PINGROUP(6, qpic, blsp4_uart0, blsp4_i2c0, blsp4_spi0, mac2_sa1,
0929          qdss_cti_trig_in_b1, NA, NA, NA),
0930     PINGROUP(7, qpic, blsp4_uart0, blsp4_spi0, NA, NA, NA, NA, NA, NA),
0931     PINGROUP(8, qpic, blsp4_uart0, blsp4_spi0, NA, NA, NA, NA, NA, NA),
0932     PINGROUP(9, qpic, blsp5_uart, blsp5_spi, cxc0, mac1_sa3, blsp3_spi3,
0933          qdss_cti_trig_in_a1, NA, NA),
0934     PINGROUP(10, qpic, qdss_cti_trig_out_a1, NA, NA, NA, NA, NA, NA,
0935          NA),
0936     PINGROUP(11, qpic, wci2c, mac1_sa2, qdss_cti_trig_in_a0, NA, NA, NA,
0937          NA, NA),
0938     PINGROUP(12, qpic, qdss_cti_trig_out_a0, NA, NA, NA, NA, NA, NA,
0939          NA),
0940     PINGROUP(13, qpic, NA, NA, NA, NA, NA, NA, NA, NA),
0941     PINGROUP(14, qpic, qdss_traceclk_b, NA, NA, NA, NA, NA, NA, NA),
0942     PINGROUP(15, qpic, qdss_tracectl_b, NA, NA, NA, NA, NA, NA, NA),
0943     PINGROUP(16, qpic, blsp5_uart, pcm_zsi1, blsp5_spi, cxc0, mac1_sa3,
0944          qdss_tracedata_b, NA, NA),
0945     PINGROUP(17, qpic, wci2c, qdss_tracedata_b, NA, NA, NA, NA, NA, NA),
0946     PINGROUP(18, led0, pwm0, qdss_tracedata_b, NA, NA, NA, NA, NA, NA),
0947     PINGROUP(19, led1, pwm1, NA, qdss_tracedata_b, NA, NA, NA, NA, NA),
0948     PINGROUP(20, led2, pwm2, NA, qdss_tracedata_b, NA, NA, NA, NA, NA),
0949     PINGROUP(21, pwm0, blsp4_uart1, blsp4_i2c1, blsp4_spi1, wci2d, mac1_sa1,
0950          blsp3_spi2, NA, qdss_tracedata_b),
0951     PINGROUP(22, pwm1, blsp4_uart1, blsp4_i2c1, blsp4_spi1, wci2d, mac1_sa1,
0952          blsp3_spi2, NA, qdss_tracedata_b),
0953     PINGROUP(23, pwm2, blsp4_uart1, blsp4_spi1, blsp3_spi2, NA,
0954          qdss_tracedata_b, NA, NA, NA),
0955     PINGROUP(24, pwm3, blsp4_uart1, blsp4_spi1, NA, qdss_tracedata_b, NA,
0956          NA, NA, NA),
0957     PINGROUP(25, audio_txmclk, pwm0, NA, qdss_tracedata_b, NA, NA, NA, NA,
0958          NA),
0959     PINGROUP(26, audio_txbclk, pwm1, NA, qdss_tracedata_b, NA, NA, NA, NA,
0960          NA),
0961     PINGROUP(27, audio_txfsync, pwm2, NA, qdss_tracedata_b, NA, NA, NA,
0962          NA, NA),
0963     PINGROUP(28, audio_txd, pwm3, NA, qdss_tracedata_b, NA, NA, NA, NA,
0964          NA),
0965     PINGROUP(29, audio_rxmclk, pwm0, atest_char0, NA, qdss_tracedata_b,
0966          NA, NA, NA, NA),
0967     PINGROUP(30, audio_rxbclk, pwm1, atest_char1, NA, qdss_tracedata_b,
0968          NA, NA, NA, NA),
0969     PINGROUP(31, audio_rxfsync, pwm2, atest_char2, NA, qdss_tracedata_b,
0970          NA, NA, NA, NA),
0971     PINGROUP(32, audio_rxd, pwm3, atest_char3, NA, NA, NA, NA, NA, NA),
0972     PINGROUP(33, pcm_drx, mac1_sa0, mac0_sa0, NA, NA, NA, NA, NA, NA),
0973     PINGROUP(34, pcm_dtx, mac1_sa0, mac0_sa0, NA, NA, NA, NA, NA, NA),
0974     PINGROUP(35, pcm_fsync, mac2_sa0, qdss_traceclk_a, NA, NA, NA, NA, NA, NA),
0975     PINGROUP(36, pcm_pclk, mac2_sa0, NA, qdss_tracectl_a, NA, NA, NA, NA, NA),
0976     PINGROUP(37, atest_char, NA, qdss_tracedata_a, NA, NA, NA, NA, NA, NA),
0977     PINGROUP(38, blsp0_uart, blsp0_i2c, blsp0_spi, NA, qdss_tracedata_a,
0978          NA, NA, NA, NA),
0979     PINGROUP(39, blsp0_uart, blsp0_i2c, blsp0_spi, NA, qdss_tracedata_a,
0980          NA, NA, NA, NA),
0981     PINGROUP(40, blsp0_uart, blsp0_spi, NA, qdss_tracedata_a, NA, NA, NA,
0982          NA, NA),
0983     PINGROUP(41, blsp0_uart, blsp0_spi, NA, qdss_tracedata_a, NA, NA, NA,
0984          NA, NA),
0985     PINGROUP(42, blsp1_uart, blsp1_i2c, blsp1_spi, NA, qdss_tracedata_a,
0986          NA, NA, NA, NA),
0987     PINGROUP(43, blsp1_uart, blsp1_i2c, blsp1_spi, NA, qdss_tracedata_a,
0988          NA, NA, NA, NA),
0989     PINGROUP(44, blsp1_uart, blsp1_spi, NA, qdss_tracedata_a, NA, NA, NA,
0990          NA, NA),
0991     PINGROUP(45, blsp1_uart, blsp1_spi, qdss_tracedata_a, NA, NA, NA, NA,
0992          NA, NA),
0993     PINGROUP(46, blsp2_uart, blsp2_i2c, blsp2_spi, qdss_tracedata_a, NA,
0994          NA, NA, NA, NA),
0995     PINGROUP(47, blsp2_uart, blsp2_i2c, blsp2_spi, NA, qdss_tracedata_a,
0996          NA, NA, NA, NA),
0997     PINGROUP(48, blsp2_uart, blsp2_spi, NA, qdss_tracedata_a, NA, NA, NA,
0998          NA, NA),
0999     PINGROUP(49, blsp2_uart, blsp2_spi, NA, qdss_tracedata_a, NA, NA, NA,
1000          NA, NA),
1001     PINGROUP(50, blsp3_uart, blsp3_i2c, blsp3_spi, NA, qdss_tracedata_a,
1002          NA, NA, NA, NA),
1003     PINGROUP(51, blsp3_uart, blsp3_i2c, blsp3_spi, NA, qdss_tracedata_a,
1004          NA, NA, NA, NA),
1005     PINGROUP(52, blsp3_uart, blsp3_spi, NA, qdss_tracedata_a, NA, NA, NA,
1006          NA, NA),
1007     PINGROUP(53, blsp3_uart, blsp3_spi, NA, NA, NA, NA, NA, NA, NA),
1008     PINGROUP(54, pta2_0, wci2b, cxc1, blsp3_spi1, NA, NA, NA, NA, NA),
1009     PINGROUP(55, pta2_1, blsp3_spi1, NA, NA, NA, NA, NA, NA, NA),
1010     PINGROUP(56, pta2_2, wci2b, cxc1, blsp3_spi1, NA, NA, NA, NA, NA),
1011     PINGROUP(57, pcie0_clk, NA, dbg_out, cri_trng0, NA, NA, NA, NA, NA),
1012     PINGROUP(58, pcie0_rst, NA, cri_trng1, NA, NA, NA, NA, NA, NA),
1013     PINGROUP(59, pcie0_wake, NA, cri_trng, NA, NA, NA, NA, NA, NA),
1014     PINGROUP(60, pcie1_clk, rx2, ldo_update, NA, NA, NA, NA, NA, NA),
1015     PINGROUP(61, pcie1_rst, ldo_en, NA, NA, NA, NA, NA, NA, NA),
1016     PINGROUP(62, pcie1_wake, gcc_plltest, NA, NA, NA, NA, NA, NA, NA),
1017     PINGROUP(63, sd_card, pwm0, NA, gcc_plltest, NA, NA, NA, NA, NA),
1018     PINGROUP(64, pta1_1, pwm1, NA, rx1, NA, NA, NA, NA, NA),
1019     PINGROUP(65, pta1_2, NA, gcc_tlmm, NA, NA, NA, NA, NA, NA),
1020     PINGROUP(66, pta1_0, pwm2, prng_rosc, NA, NA, NA, NA, NA, NA),
1021     PINGROUP(67, sd_write, pwm3, rx0, tsens_max, NA, NA, NA, NA, NA),
1022     PINGROUP(68, mdc, NA, NA, NA, NA, NA, NA, NA, NA),
1023     PINGROUP(69, mdio, NA, NA, NA, NA, NA, NA, NA, NA),
1024 };
1025 
1026 static const struct msm_pinctrl_soc_data ipq8074_pinctrl = {
1027     .pins = ipq8074_pins,
1028     .npins = ARRAY_SIZE(ipq8074_pins),
1029     .functions = ipq8074_functions,
1030     .nfunctions = ARRAY_SIZE(ipq8074_functions),
1031     .groups = ipq8074_groups,
1032     .ngroups = ARRAY_SIZE(ipq8074_groups),
1033     .ngpios = 70,
1034 };
1035 
1036 static int ipq8074_pinctrl_probe(struct platform_device *pdev)
1037 {
1038     return msm_pinctrl_probe(pdev, &ipq8074_pinctrl);
1039 }
1040 
1041 static const struct of_device_id ipq8074_pinctrl_of_match[] = {
1042     { .compatible = "qcom,ipq8074-pinctrl", },
1043     { },
1044 };
1045 
1046 static struct platform_driver ipq8074_pinctrl_driver = {
1047     .driver = {
1048         .name = "ipq8074-pinctrl",
1049         .of_match_table = ipq8074_pinctrl_of_match,
1050     },
1051     .probe = ipq8074_pinctrl_probe,
1052     .remove = msm_pinctrl_remove,
1053 };
1054 
1055 static int __init ipq8074_pinctrl_init(void)
1056 {
1057     return platform_driver_register(&ipq8074_pinctrl_driver);
1058 }
1059 arch_initcall(ipq8074_pinctrl_init);
1060 
1061 static void __exit ipq8074_pinctrl_exit(void)
1062 {
1063     platform_driver_unregister(&ipq8074_pinctrl_driver);
1064 }
1065 module_exit(ipq8074_pinctrl_exit);
1066 
1067 MODULE_DESCRIPTION("Qualcomm ipq8074 pinctrl driver");
1068 MODULE_LICENSE("GPL v2");
1069 MODULE_DEVICE_TABLE(of, ipq8074_pinctrl_of_match);