Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (c) 2016-2018, 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 ipq6018_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     PINCTRL_PIN(70, "GPIO_70"),
0132     PINCTRL_PIN(71, "GPIO_71"),
0133     PINCTRL_PIN(72, "GPIO_72"),
0134     PINCTRL_PIN(73, "GPIO_73"),
0135     PINCTRL_PIN(74, "GPIO_74"),
0136     PINCTRL_PIN(75, "GPIO_75"),
0137     PINCTRL_PIN(76, "GPIO_76"),
0138     PINCTRL_PIN(77, "GPIO_77"),
0139     PINCTRL_PIN(78, "GPIO_78"),
0140     PINCTRL_PIN(79, "GPIO_79"),
0141 };
0142 
0143 #define DECLARE_MSM_GPIO_PINS(pin) \
0144     static const unsigned int gpio##pin##_pins[] = { pin }
0145 DECLARE_MSM_GPIO_PINS(0);
0146 DECLARE_MSM_GPIO_PINS(1);
0147 DECLARE_MSM_GPIO_PINS(2);
0148 DECLARE_MSM_GPIO_PINS(3);
0149 DECLARE_MSM_GPIO_PINS(4);
0150 DECLARE_MSM_GPIO_PINS(5);
0151 DECLARE_MSM_GPIO_PINS(6);
0152 DECLARE_MSM_GPIO_PINS(7);
0153 DECLARE_MSM_GPIO_PINS(8);
0154 DECLARE_MSM_GPIO_PINS(9);
0155 DECLARE_MSM_GPIO_PINS(10);
0156 DECLARE_MSM_GPIO_PINS(11);
0157 DECLARE_MSM_GPIO_PINS(12);
0158 DECLARE_MSM_GPIO_PINS(13);
0159 DECLARE_MSM_GPIO_PINS(14);
0160 DECLARE_MSM_GPIO_PINS(15);
0161 DECLARE_MSM_GPIO_PINS(16);
0162 DECLARE_MSM_GPIO_PINS(17);
0163 DECLARE_MSM_GPIO_PINS(18);
0164 DECLARE_MSM_GPIO_PINS(19);
0165 DECLARE_MSM_GPIO_PINS(20);
0166 DECLARE_MSM_GPIO_PINS(21);
0167 DECLARE_MSM_GPIO_PINS(22);
0168 DECLARE_MSM_GPIO_PINS(23);
0169 DECLARE_MSM_GPIO_PINS(24);
0170 DECLARE_MSM_GPIO_PINS(25);
0171 DECLARE_MSM_GPIO_PINS(26);
0172 DECLARE_MSM_GPIO_PINS(27);
0173 DECLARE_MSM_GPIO_PINS(28);
0174 DECLARE_MSM_GPIO_PINS(29);
0175 DECLARE_MSM_GPIO_PINS(30);
0176 DECLARE_MSM_GPIO_PINS(31);
0177 DECLARE_MSM_GPIO_PINS(32);
0178 DECLARE_MSM_GPIO_PINS(33);
0179 DECLARE_MSM_GPIO_PINS(34);
0180 DECLARE_MSM_GPIO_PINS(35);
0181 DECLARE_MSM_GPIO_PINS(36);
0182 DECLARE_MSM_GPIO_PINS(37);
0183 DECLARE_MSM_GPIO_PINS(38);
0184 DECLARE_MSM_GPIO_PINS(39);
0185 DECLARE_MSM_GPIO_PINS(40);
0186 DECLARE_MSM_GPIO_PINS(41);
0187 DECLARE_MSM_GPIO_PINS(42);
0188 DECLARE_MSM_GPIO_PINS(43);
0189 DECLARE_MSM_GPIO_PINS(44);
0190 DECLARE_MSM_GPIO_PINS(45);
0191 DECLARE_MSM_GPIO_PINS(46);
0192 DECLARE_MSM_GPIO_PINS(47);
0193 DECLARE_MSM_GPIO_PINS(48);
0194 DECLARE_MSM_GPIO_PINS(49);
0195 DECLARE_MSM_GPIO_PINS(50);
0196 DECLARE_MSM_GPIO_PINS(51);
0197 DECLARE_MSM_GPIO_PINS(52);
0198 DECLARE_MSM_GPIO_PINS(53);
0199 DECLARE_MSM_GPIO_PINS(54);
0200 DECLARE_MSM_GPIO_PINS(55);
0201 DECLARE_MSM_GPIO_PINS(56);
0202 DECLARE_MSM_GPIO_PINS(57);
0203 DECLARE_MSM_GPIO_PINS(58);
0204 DECLARE_MSM_GPIO_PINS(59);
0205 DECLARE_MSM_GPIO_PINS(60);
0206 DECLARE_MSM_GPIO_PINS(61);
0207 DECLARE_MSM_GPIO_PINS(62);
0208 DECLARE_MSM_GPIO_PINS(63);
0209 DECLARE_MSM_GPIO_PINS(64);
0210 DECLARE_MSM_GPIO_PINS(65);
0211 DECLARE_MSM_GPIO_PINS(66);
0212 DECLARE_MSM_GPIO_PINS(67);
0213 DECLARE_MSM_GPIO_PINS(68);
0214 DECLARE_MSM_GPIO_PINS(69);
0215 DECLARE_MSM_GPIO_PINS(70);
0216 DECLARE_MSM_GPIO_PINS(71);
0217 DECLARE_MSM_GPIO_PINS(72);
0218 DECLARE_MSM_GPIO_PINS(73);
0219 DECLARE_MSM_GPIO_PINS(74);
0220 DECLARE_MSM_GPIO_PINS(75);
0221 DECLARE_MSM_GPIO_PINS(76);
0222 DECLARE_MSM_GPIO_PINS(77);
0223 DECLARE_MSM_GPIO_PINS(78);
0224 DECLARE_MSM_GPIO_PINS(79);
0225 
0226 enum ipq6018_functions {
0227     msm_mux_atest_char,
0228     msm_mux_atest_char0,
0229     msm_mux_atest_char1,
0230     msm_mux_atest_char2,
0231     msm_mux_atest_char3,
0232     msm_mux_audio0,
0233     msm_mux_audio1,
0234     msm_mux_audio2,
0235     msm_mux_audio3,
0236     msm_mux_audio_rxbclk,
0237     msm_mux_audio_rxfsync,
0238     msm_mux_audio_rxmclk,
0239     msm_mux_audio_rxmclkin,
0240     msm_mux_audio_txbclk,
0241     msm_mux_audio_txfsync,
0242     msm_mux_audio_txmclk,
0243     msm_mux_audio_txmclkin,
0244     msm_mux_blsp0_i2c,
0245     msm_mux_blsp0_spi,
0246     msm_mux_blsp0_uart,
0247     msm_mux_blsp1_i2c,
0248     msm_mux_blsp1_spi,
0249     msm_mux_blsp1_uart,
0250     msm_mux_blsp2_i2c,
0251     msm_mux_blsp2_spi,
0252     msm_mux_blsp2_uart,
0253     msm_mux_blsp3_i2c,
0254     msm_mux_blsp3_spi,
0255     msm_mux_blsp3_uart,
0256     msm_mux_blsp4_i2c,
0257     msm_mux_blsp4_spi,
0258     msm_mux_blsp4_uart,
0259     msm_mux_blsp5_i2c,
0260     msm_mux_blsp5_uart,
0261     msm_mux_burn0,
0262     msm_mux_burn1,
0263     msm_mux_cri_trng,
0264     msm_mux_cri_trng0,
0265     msm_mux_cri_trng1,
0266     msm_mux_cxc0,
0267     msm_mux_cxc1,
0268     msm_mux_dbg_out,
0269     msm_mux_gcc_plltest,
0270     msm_mux_gcc_tlmm,
0271     msm_mux_gpio,
0272     msm_mux_lpass_aud,
0273     msm_mux_lpass_aud0,
0274     msm_mux_lpass_aud1,
0275     msm_mux_lpass_aud2,
0276     msm_mux_lpass_pcm,
0277     msm_mux_lpass_pdm,
0278     msm_mux_mac00,
0279     msm_mux_mac01,
0280     msm_mux_mac10,
0281     msm_mux_mac11,
0282     msm_mux_mac12,
0283     msm_mux_mac13,
0284     msm_mux_mac20,
0285     msm_mux_mac21,
0286     msm_mux_mdc,
0287     msm_mux_mdio,
0288     msm_mux_pcie0_clk,
0289     msm_mux_pcie0_rst,
0290     msm_mux_pcie0_wake,
0291     msm_mux_prng_rosc,
0292     msm_mux_pta1_0,
0293     msm_mux_pta1_1,
0294     msm_mux_pta1_2,
0295     msm_mux_pta2_0,
0296     msm_mux_pta2_1,
0297     msm_mux_pta2_2,
0298     msm_mux_pwm00,
0299     msm_mux_pwm01,
0300     msm_mux_pwm02,
0301     msm_mux_pwm03,
0302     msm_mux_pwm04,
0303     msm_mux_pwm10,
0304     msm_mux_pwm11,
0305     msm_mux_pwm12,
0306     msm_mux_pwm13,
0307     msm_mux_pwm14,
0308     msm_mux_pwm20,
0309     msm_mux_pwm21,
0310     msm_mux_pwm22,
0311     msm_mux_pwm23,
0312     msm_mux_pwm24,
0313     msm_mux_pwm30,
0314     msm_mux_pwm31,
0315     msm_mux_pwm32,
0316     msm_mux_pwm33,
0317     msm_mux_qdss_cti_trig_in_a0,
0318     msm_mux_qdss_cti_trig_in_a1,
0319     msm_mux_qdss_cti_trig_out_a0,
0320     msm_mux_qdss_cti_trig_out_a1,
0321     msm_mux_qdss_cti_trig_in_b0,
0322     msm_mux_qdss_cti_trig_in_b1,
0323     msm_mux_qdss_cti_trig_out_b0,
0324     msm_mux_qdss_cti_trig_out_b1,
0325     msm_mux_qdss_traceclk_a,
0326     msm_mux_qdss_tracectl_a,
0327     msm_mux_qdss_tracedata_a,
0328     msm_mux_qdss_traceclk_b,
0329     msm_mux_qdss_tracectl_b,
0330     msm_mux_qdss_tracedata_b,
0331     msm_mux_qpic_pad,
0332     msm_mux_rx0,
0333     msm_mux_rx1,
0334     msm_mux_rx_swrm,
0335     msm_mux_rx_swrm0,
0336     msm_mux_rx_swrm1,
0337     msm_mux_sd_card,
0338     msm_mux_sd_write,
0339     msm_mux_tsens_max,
0340     msm_mux_tx_swrm,
0341     msm_mux_tx_swrm0,
0342     msm_mux_tx_swrm1,
0343     msm_mux_tx_swrm2,
0344     msm_mux_wci20,
0345     msm_mux_wci21,
0346     msm_mux_wci22,
0347     msm_mux_wci23,
0348     msm_mux_wsa_swrm,
0349     msm_mux__,
0350 };
0351 
0352 static const char * const blsp3_uart_groups[] = {
0353     "gpio73", "gpio74", "gpio75", "gpio76",
0354 };
0355 
0356 static const char * const blsp3_i2c_groups[] = {
0357     "gpio73", "gpio74",
0358 };
0359 
0360 static const char * const blsp3_spi_groups[] = {
0361     "gpio73", "gpio74", "gpio75", "gpio76", "gpio77", "gpio78", "gpio79",
0362 };
0363 
0364 static const char * const wci20_groups[] = {
0365     "gpio0", "gpio2",
0366 };
0367 
0368 static const char * const qpic_pad_groups[] = {
0369     "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio9", "gpio10",
0370     "gpio11", "gpio17", "gpio15", "gpio12", "gpio13", "gpio14", "gpio5",
0371     "gpio6", "gpio7", "gpio8",
0372 };
0373 
0374 static const char * const burn0_groups[] = {
0375     "gpio0",
0376 };
0377 
0378 static const char * const mac12_groups[] = {
0379     "gpio1", "gpio11",
0380 };
0381 
0382 static const char * const qdss_tracectl_b_groups[] = {
0383     "gpio1",
0384 };
0385 
0386 static const char * const burn1_groups[] = {
0387     "gpio1",
0388 };
0389 
0390 static const char * const qdss_traceclk_b_groups[] = {
0391     "gpio0",
0392 };
0393 
0394 static const char * const qdss_tracedata_b_groups[] = {
0395     "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7", "gpio8", "gpio9",
0396     "gpio10", "gpio11", "gpio12", "gpio13", "gpio14", "gpio15", "gpio16",
0397     "gpio17",
0398 };
0399 
0400 static const char * const mac01_groups[] = {
0401     "gpio3", "gpio4",
0402 };
0403 
0404 static const char * const mac21_groups[] = {
0405     "gpio5", "gpio6",
0406 };
0407 
0408 static const char * const atest_char_groups[] = {
0409     "gpio9",
0410 };
0411 
0412 static const char * const cxc0_groups[] = {
0413     "gpio9", "gpio16",
0414 };
0415 
0416 static const char * const mac13_groups[] = {
0417     "gpio9", "gpio16",
0418 };
0419 
0420 static const char * const dbg_out_groups[] = {
0421     "gpio9",
0422 };
0423 
0424 static const char * const wci22_groups[] = {
0425     "gpio11", "gpio17",
0426 };
0427 
0428 static const char * const pwm00_groups[] = {
0429     "gpio18",
0430 };
0431 
0432 static const char * const atest_char0_groups[] = {
0433     "gpio18",
0434 };
0435 
0436 static const char * const wci23_groups[] = {
0437     "gpio18", "gpio19",
0438 };
0439 
0440 static const char * const mac11_groups[] = {
0441     "gpio18", "gpio19",
0442 };
0443 
0444 static const char * const pwm10_groups[] = {
0445     "gpio19",
0446 };
0447 
0448 static const char * const atest_char1_groups[] = {
0449     "gpio19",
0450 };
0451 
0452 static const char * const pwm20_groups[] = {
0453     "gpio20",
0454 };
0455 
0456 static const char * const atest_char2_groups[] = {
0457     "gpio20",
0458 };
0459 
0460 static const char * const pwm30_groups[] = {
0461     "gpio21",
0462 };
0463 
0464 static const char * const atest_char3_groups[] = {
0465     "gpio21",
0466 };
0467 
0468 static const char * const audio_txmclk_groups[] = {
0469     "gpio22",
0470 };
0471 
0472 static const char * const audio_txmclkin_groups[] = {
0473     "gpio22",
0474 };
0475 
0476 static const char * const pwm02_groups[] = {
0477     "gpio22",
0478 };
0479 
0480 static const char * const tx_swrm0_groups[] = {
0481     "gpio22",
0482 };
0483 
0484 static const char * const qdss_cti_trig_out_b0_groups[] = {
0485     "gpio22",
0486 };
0487 
0488 static const char * const audio_txbclk_groups[] = {
0489     "gpio23",
0490 };
0491 
0492 static const char * const pwm12_groups[] = {
0493     "gpio23",
0494 };
0495 
0496 static const char * const wsa_swrm_groups[] = {
0497     "gpio23", "gpio24",
0498 };
0499 
0500 static const char * const tx_swrm1_groups[] = {
0501     "gpio23",
0502 };
0503 
0504 static const char * const qdss_cti_trig_in_b0_groups[] = {
0505     "gpio23",
0506 };
0507 
0508 static const char * const audio_txfsync_groups[] = {
0509     "gpio24",
0510 };
0511 
0512 static const char * const pwm22_groups[] = {
0513     "gpio24",
0514 };
0515 
0516 static const char * const tx_swrm2_groups[] = {
0517     "gpio24",
0518 };
0519 
0520 static const char * const qdss_cti_trig_out_b1_groups[] = {
0521     "gpio24",
0522 };
0523 
0524 static const char * const audio0_groups[] = {
0525     "gpio25", "gpio32",
0526 };
0527 
0528 static const char * const pwm32_groups[] = {
0529     "gpio25",
0530 };
0531 
0532 static const char * const tx_swrm_groups[] = {
0533     "gpio25",
0534 };
0535 
0536 static const char * const qdss_cti_trig_in_b1_groups[] = {
0537     "gpio25",
0538 };
0539 
0540 static const char * const audio1_groups[] = {
0541     "gpio26", "gpio33",
0542 };
0543 
0544 static const char * const pwm04_groups[] = {
0545     "gpio26",
0546 };
0547 
0548 static const char * const audio2_groups[] = {
0549     "gpio27",
0550 };
0551 
0552 static const char * const pwm14_groups[] = {
0553     "gpio27",
0554 };
0555 
0556 static const char * const audio3_groups[] = {
0557     "gpio28",
0558 };
0559 
0560 static const char * const pwm24_groups[] = {
0561     "gpio28",
0562 };
0563 
0564 static const char * const audio_rxmclk_groups[] = {
0565     "gpio29",
0566 };
0567 
0568 static const char * const audio_rxmclkin_groups[] = {
0569     "gpio29",
0570 };
0571 
0572 static const char * const pwm03_groups[] = {
0573     "gpio29",
0574 };
0575 
0576 static const char * const lpass_pdm_groups[] = {
0577     "gpio29", "gpio30", "gpio31", "gpio32",
0578 };
0579 
0580 static const char * const lpass_aud_groups[] = {
0581     "gpio29",
0582 };
0583 
0584 static const char * const qdss_cti_trig_in_a1_groups[] = {
0585     "gpio29",
0586 };
0587 
0588 static const char * const audio_rxbclk_groups[] = {
0589     "gpio30",
0590 };
0591 
0592 static const char * const pwm13_groups[] = {
0593     "gpio30",
0594 };
0595 
0596 static const char * const lpass_aud0_groups[] = {
0597     "gpio30",
0598 };
0599 
0600 static const char * const rx_swrm_groups[] = {
0601     "gpio30",
0602 };
0603 
0604 static const char * const qdss_cti_trig_out_a1_groups[] = {
0605     "gpio30",
0606 };
0607 
0608 static const char * const audio_rxfsync_groups[] = {
0609     "gpio31",
0610 };
0611 
0612 static const char * const pwm23_groups[] = {
0613     "gpio31",
0614 };
0615 
0616 static const char * const lpass_aud1_groups[] = {
0617     "gpio31",
0618 };
0619 
0620 static const char * const rx_swrm0_groups[] = {
0621     "gpio31",
0622 };
0623 
0624 static const char * const qdss_cti_trig_in_a0_groups[] = {
0625     "gpio31",
0626 };
0627 
0628 static const char * const pwm33_groups[] = {
0629     "gpio32",
0630 };
0631 
0632 static const char * const lpass_aud2_groups[] = {
0633     "gpio32",
0634 };
0635 
0636 static const char * const rx_swrm1_groups[] = {
0637     "gpio32",
0638 };
0639 
0640 static const char * const qdss_cti_trig_out_a0_groups[] = {
0641     "gpio32",
0642 };
0643 
0644 static const char * const lpass_pcm_groups[] = {
0645     "gpio34", "gpio35", "gpio36", "gpio37",
0646 };
0647 
0648 static const char * const mac10_groups[] = {
0649     "gpio34", "gpio35",
0650 };
0651 
0652 static const char * const mac00_groups[] = {
0653     "gpio34", "gpio35",
0654 };
0655 
0656 static const char * const mac20_groups[] = {
0657     "gpio36", "gpio37",
0658 };
0659 
0660 static const char * const blsp0_uart_groups[] = {
0661     "gpio38", "gpio39", "gpio40", "gpio41",
0662 };
0663 
0664 static const char * const blsp0_i2c_groups[] = {
0665     "gpio38", "gpio39",
0666 };
0667 
0668 static const char * const blsp0_spi_groups[] = {
0669     "gpio38", "gpio39", "gpio40", "gpio41",
0670 };
0671 
0672 static const char * const blsp2_uart_groups[] = {
0673     "gpio42", "gpio43", "gpio44", "gpio45",
0674 };
0675 
0676 static const char * const blsp2_i2c_groups[] = {
0677     "gpio42", "gpio43",
0678 };
0679 
0680 static const char * const blsp2_spi_groups[] = {
0681     "gpio42", "gpio43", "gpio44", "gpio45",
0682 };
0683 
0684 static const char * const blsp5_i2c_groups[] = {
0685     "gpio46", "gpio47",
0686 };
0687 
0688 static const char * const blsp5_uart_groups[] = {
0689     "gpio48", "gpio49",
0690 };
0691 
0692 static const char * const qdss_traceclk_a_groups[] = {
0693     "gpio48",
0694 };
0695 
0696 static const char * const qdss_tracectl_a_groups[] = {
0697     "gpio49",
0698 };
0699 
0700 static const char * const pwm01_groups[] = {
0701     "gpio50",
0702 };
0703 
0704 static const char * const pta1_1_groups[] = {
0705     "gpio51",
0706 };
0707 
0708 static const char * const pwm11_groups[] = {
0709     "gpio51",
0710 };
0711 
0712 static const char * const rx1_groups[] = {
0713     "gpio51",
0714 };
0715 
0716 static const char * const pta1_2_groups[] = {
0717     "gpio52",
0718 };
0719 
0720 static const char * const pwm21_groups[] = {
0721     "gpio52",
0722 };
0723 
0724 static const char * const pta1_0_groups[] = {
0725     "gpio53",
0726 };
0727 
0728 static const char * const pwm31_groups[] = {
0729     "gpio53",
0730 };
0731 
0732 static const char * const prng_rosc_groups[] = {
0733     "gpio53",
0734 };
0735 
0736 static const char * const blsp4_uart_groups[] = {
0737     "gpio55", "gpio56", "gpio57", "gpio58",
0738 };
0739 
0740 static const char * const blsp4_i2c_groups[] = {
0741     "gpio55", "gpio56",
0742 };
0743 
0744 static const char * const blsp4_spi_groups[] = {
0745     "gpio55", "gpio56", "gpio57", "gpio58",
0746 };
0747 
0748 static const char * const pcie0_clk_groups[] = {
0749     "gpio59",
0750 };
0751 
0752 static const char * const cri_trng0_groups[] = {
0753     "gpio59",
0754 };
0755 
0756 static const char * const pcie0_rst_groups[] = {
0757     "gpio60",
0758 };
0759 
0760 static const char * const cri_trng1_groups[] = {
0761     "gpio60",
0762 };
0763 
0764 static const char * const pcie0_wake_groups[] = {
0765     "gpio61",
0766 };
0767 
0768 static const char * const cri_trng_groups[] = {
0769     "gpio61",
0770 };
0771 
0772 static const char * const sd_card_groups[] = {
0773     "gpio62",
0774 };
0775 
0776 static const char * const sd_write_groups[] = {
0777     "gpio63",
0778 };
0779 
0780 static const char * const rx0_groups[] = {
0781     "gpio63",
0782 };
0783 
0784 static const char * const tsens_max_groups[] = {
0785     "gpio63",
0786 };
0787 
0788 static const char * const mdc_groups[] = {
0789     "gpio64",
0790 };
0791 
0792 static const char * const qdss_tracedata_a_groups[] = {
0793     "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
0794     "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
0795     "gpio78", "gpio79",
0796 };
0797 
0798 static const char * const mdio_groups[] = {
0799     "gpio65",
0800 };
0801 
0802 static const char * const pta2_0_groups[] = {
0803     "gpio66",
0804 };
0805 
0806 static const char * const wci21_groups[] = {
0807     "gpio66", "gpio68",
0808 };
0809 
0810 static const char * const cxc1_groups[] = {
0811     "gpio66", "gpio68",
0812 };
0813 
0814 static const char * const pta2_1_groups[] = {
0815     "gpio67",
0816 };
0817 
0818 static const char * const pta2_2_groups[] = {
0819     "gpio68",
0820 };
0821 
0822 static const char * const blsp1_uart_groups[] = {
0823     "gpio69", "gpio70", "gpio71", "gpio72",
0824 };
0825 
0826 static const char * const blsp1_i2c_groups[] = {
0827     "gpio69", "gpio70",
0828 };
0829 
0830 static const char * const blsp1_spi_groups[] = {
0831     "gpio69", "gpio70", "gpio71", "gpio72",
0832 };
0833 
0834 static const char * const gcc_plltest_groups[] = {
0835     "gpio69", "gpio71",
0836 };
0837 
0838 static const char * const gcc_tlmm_groups[] = {
0839     "gpio70",
0840 };
0841 
0842 static const char * const gpio_groups[] = {
0843     "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
0844     "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
0845     "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
0846     "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
0847     "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
0848     "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
0849     "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
0850     "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
0851     "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
0852     "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
0853     "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
0854     "gpio78", "gpio79",
0855 };
0856 
0857 static const struct msm_function ipq6018_functions[] = {
0858     FUNCTION(atest_char),
0859     FUNCTION(atest_char0),
0860     FUNCTION(atest_char1),
0861     FUNCTION(atest_char2),
0862     FUNCTION(atest_char3),
0863     FUNCTION(audio0),
0864     FUNCTION(audio1),
0865     FUNCTION(audio2),
0866     FUNCTION(audio3),
0867     FUNCTION(audio_rxbclk),
0868     FUNCTION(audio_rxfsync),
0869     FUNCTION(audio_rxmclk),
0870     FUNCTION(audio_rxmclkin),
0871     FUNCTION(audio_txbclk),
0872     FUNCTION(audio_txfsync),
0873     FUNCTION(audio_txmclk),
0874     FUNCTION(audio_txmclkin),
0875     FUNCTION(blsp0_i2c),
0876     FUNCTION(blsp0_spi),
0877     FUNCTION(blsp0_uart),
0878     FUNCTION(blsp1_i2c),
0879     FUNCTION(blsp1_spi),
0880     FUNCTION(blsp1_uart),
0881     FUNCTION(blsp2_i2c),
0882     FUNCTION(blsp2_spi),
0883     FUNCTION(blsp2_uart),
0884     FUNCTION(blsp3_i2c),
0885     FUNCTION(blsp3_spi),
0886     FUNCTION(blsp3_uart),
0887     FUNCTION(blsp4_i2c),
0888     FUNCTION(blsp4_spi),
0889     FUNCTION(blsp4_uart),
0890     FUNCTION(blsp5_i2c),
0891     FUNCTION(blsp5_uart),
0892     FUNCTION(burn0),
0893     FUNCTION(burn1),
0894     FUNCTION(cri_trng),
0895     FUNCTION(cri_trng0),
0896     FUNCTION(cri_trng1),
0897     FUNCTION(cxc0),
0898     FUNCTION(cxc1),
0899     FUNCTION(dbg_out),
0900     FUNCTION(gcc_plltest),
0901     FUNCTION(gcc_tlmm),
0902     FUNCTION(gpio),
0903     FUNCTION(lpass_aud),
0904     FUNCTION(lpass_aud0),
0905     FUNCTION(lpass_aud1),
0906     FUNCTION(lpass_aud2),
0907     FUNCTION(lpass_pcm),
0908     FUNCTION(lpass_pdm),
0909     FUNCTION(mac00),
0910     FUNCTION(mac01),
0911     FUNCTION(mac10),
0912     FUNCTION(mac11),
0913     FUNCTION(mac12),
0914     FUNCTION(mac13),
0915     FUNCTION(mac20),
0916     FUNCTION(mac21),
0917     FUNCTION(mdc),
0918     FUNCTION(mdio),
0919     FUNCTION(pcie0_clk),
0920     FUNCTION(pcie0_rst),
0921     FUNCTION(pcie0_wake),
0922     FUNCTION(prng_rosc),
0923     FUNCTION(pta1_0),
0924     FUNCTION(pta1_1),
0925     FUNCTION(pta1_2),
0926     FUNCTION(pta2_0),
0927     FUNCTION(pta2_1),
0928     FUNCTION(pta2_2),
0929     FUNCTION(pwm00),
0930     FUNCTION(pwm01),
0931     FUNCTION(pwm02),
0932     FUNCTION(pwm03),
0933     FUNCTION(pwm04),
0934     FUNCTION(pwm10),
0935     FUNCTION(pwm11),
0936     FUNCTION(pwm12),
0937     FUNCTION(pwm13),
0938     FUNCTION(pwm14),
0939     FUNCTION(pwm20),
0940     FUNCTION(pwm21),
0941     FUNCTION(pwm22),
0942     FUNCTION(pwm23),
0943     FUNCTION(pwm24),
0944     FUNCTION(pwm30),
0945     FUNCTION(pwm31),
0946     FUNCTION(pwm32),
0947     FUNCTION(pwm33),
0948     FUNCTION(qdss_cti_trig_in_a0),
0949     FUNCTION(qdss_cti_trig_in_a1),
0950     FUNCTION(qdss_cti_trig_out_a0),
0951     FUNCTION(qdss_cti_trig_out_a1),
0952     FUNCTION(qdss_cti_trig_in_b0),
0953     FUNCTION(qdss_cti_trig_in_b1),
0954     FUNCTION(qdss_cti_trig_out_b0),
0955     FUNCTION(qdss_cti_trig_out_b1),
0956     FUNCTION(qdss_traceclk_a),
0957     FUNCTION(qdss_tracectl_a),
0958     FUNCTION(qdss_tracedata_a),
0959     FUNCTION(qdss_traceclk_b),
0960     FUNCTION(qdss_tracectl_b),
0961     FUNCTION(qdss_tracedata_b),
0962     FUNCTION(qpic_pad),
0963     FUNCTION(rx0),
0964     FUNCTION(rx1),
0965     FUNCTION(rx_swrm),
0966     FUNCTION(rx_swrm0),
0967     FUNCTION(rx_swrm1),
0968     FUNCTION(sd_card),
0969     FUNCTION(sd_write),
0970     FUNCTION(tsens_max),
0971     FUNCTION(tx_swrm),
0972     FUNCTION(tx_swrm0),
0973     FUNCTION(tx_swrm1),
0974     FUNCTION(tx_swrm2),
0975     FUNCTION(wci20),
0976     FUNCTION(wci21),
0977     FUNCTION(wci22),
0978     FUNCTION(wci23),
0979     FUNCTION(wsa_swrm),
0980 };
0981 
0982 static const struct msm_pingroup ipq6018_groups[] = {
0983     PINGROUP(0, qpic_pad, wci20, qdss_traceclk_b, _, burn0, _, _, _, _),
0984     PINGROUP(1, qpic_pad, mac12, qdss_tracectl_b, _, burn1, _, _, _, _),
0985     PINGROUP(2, qpic_pad, wci20, qdss_tracedata_b, _, _, _, _, _, _),
0986     PINGROUP(3, qpic_pad, mac01, qdss_tracedata_b, _, _, _, _, _, _),
0987     PINGROUP(4, qpic_pad, mac01, qdss_tracedata_b, _, _, _, _, _, _),
0988     PINGROUP(5, qpic_pad, mac21, qdss_tracedata_b, _, _, _, _, _, _),
0989     PINGROUP(6, qpic_pad, mac21, qdss_tracedata_b, _, _, _, _, _, _),
0990     PINGROUP(7, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _),
0991     PINGROUP(8, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _),
0992     PINGROUP(9, qpic_pad, atest_char, cxc0, mac13, dbg_out, qdss_tracedata_b, _, _, _),
0993     PINGROUP(10, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _),
0994     PINGROUP(11, qpic_pad, wci22, mac12, qdss_tracedata_b, _, _, _, _, _),
0995     PINGROUP(12, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _),
0996     PINGROUP(13, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _),
0997     PINGROUP(14, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _),
0998     PINGROUP(15, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _),
0999     PINGROUP(16, qpic_pad, cxc0, mac13, qdss_tracedata_b, _, _, _, _, _),
1000     PINGROUP(17, qpic_pad, qdss_tracedata_b, wci22, _, _, _, _, _, _),
1001     PINGROUP(18, pwm00, atest_char0, wci23, mac11, _, _, _, _, _),
1002     PINGROUP(19, pwm10, atest_char1, wci23, mac11, _, _, _, _, _),
1003     PINGROUP(20, pwm20, atest_char2, _, _, _, _, _, _, _),
1004     PINGROUP(21, pwm30, atest_char3, _, _, _, _, _, _, _),
1005     PINGROUP(22, audio_txmclk, audio_txmclkin, pwm02, tx_swrm0, _, qdss_cti_trig_out_b0, _, _, _),
1006     PINGROUP(23, audio_txbclk, pwm12, wsa_swrm, tx_swrm1, _, qdss_cti_trig_in_b0, _, _, _),
1007     PINGROUP(24, audio_txfsync, pwm22, wsa_swrm, tx_swrm2, _, qdss_cti_trig_out_b1, _, _, _),
1008     PINGROUP(25, audio0, pwm32, tx_swrm, _, qdss_cti_trig_in_b1, _, _, _, _),
1009     PINGROUP(26, audio1, pwm04, _, _, _, _, _, _, _),
1010     PINGROUP(27, audio2, pwm14, _, _, _, _, _, _, _),
1011     PINGROUP(28, audio3, pwm24, _, _, _, _, _, _, _),
1012     PINGROUP(29, audio_rxmclk, audio_rxmclkin, pwm03, lpass_pdm, lpass_aud, qdss_cti_trig_in_a1, _, _, _),
1013     PINGROUP(30, audio_rxbclk, pwm13, lpass_pdm, lpass_aud0, rx_swrm, _, qdss_cti_trig_out_a1, _, _),
1014     PINGROUP(31, audio_rxfsync, pwm23, lpass_pdm, lpass_aud1, rx_swrm0, _, qdss_cti_trig_in_a0, _, _),
1015     PINGROUP(32, audio0, pwm33, lpass_pdm, lpass_aud2, rx_swrm1, _, qdss_cti_trig_out_a0, _, _),
1016     PINGROUP(33, audio1, _, _, _, _, _, _, _, _),
1017     PINGROUP(34, lpass_pcm, mac10, mac00, _, _, _, _, _, _),
1018     PINGROUP(35, lpass_pcm, mac10, mac00, _, _, _, _, _, _),
1019     PINGROUP(36, lpass_pcm, mac20, _, _, _, _, _, _, _),
1020     PINGROUP(37, lpass_pcm, mac20, _, _, _, _, _, _, _),
1021     PINGROUP(38, blsp0_uart, blsp0_i2c, blsp0_spi, _, _, _, _, _, _),
1022     PINGROUP(39, blsp0_uart, blsp0_i2c, blsp0_spi, _, _, _, _, _, _),
1023     PINGROUP(40, blsp0_uart, blsp0_spi, _, _, _, _, _, _, _),
1024     PINGROUP(41, blsp0_uart, blsp0_spi, _, _, _, _, _, _, _),
1025     PINGROUP(42, blsp2_uart, blsp2_i2c, blsp2_spi, _, _, _, _, _, _),
1026     PINGROUP(43, blsp2_uart, blsp2_i2c, blsp2_spi, _, _, _, _, _, _),
1027     PINGROUP(44, blsp2_uart, blsp2_spi, _, _, _, _, _, _, _),
1028     PINGROUP(45, blsp2_uart, blsp2_spi, _, _, _, _, _, _, _),
1029     PINGROUP(46, blsp5_i2c, _, _, _, _, _, _, _, _),
1030     PINGROUP(47, blsp5_i2c, _, _, _, _, _, _, _, _),
1031     PINGROUP(48, blsp5_uart, _, qdss_traceclk_a, _, _, _, _, _, _),
1032     PINGROUP(49, blsp5_uart, _, qdss_tracectl_a, _, _, _, _, _, _),
1033     PINGROUP(50, pwm01, _, _, _, _, _, _, _, _),
1034     PINGROUP(51, pta1_1, pwm11, _, rx1, _, _, _, _, _),
1035     PINGROUP(52, pta1_2, pwm21, _, _, _, _, _, _, _),
1036     PINGROUP(53, pta1_0, pwm31, prng_rosc, _, _, _, _, _, _),
1037     PINGROUP(54, _, _, _, _, _, _, _, _, _),
1038     PINGROUP(55, blsp4_uart, blsp4_i2c, blsp4_spi, _, _, _, _, _, _),
1039     PINGROUP(56, blsp4_uart, blsp4_i2c, blsp4_spi, _, _, _, _, _, _),
1040     PINGROUP(57, blsp4_uart, blsp4_spi, _, _, _, _, _, _, _),
1041     PINGROUP(58, blsp4_uart, blsp4_spi, _, _, _, _, _, _, _),
1042     PINGROUP(59, pcie0_clk, _, _, cri_trng0, _, _, _, _, _),
1043     PINGROUP(60, pcie0_rst, _, _, cri_trng1, _, _, _, _, _),
1044     PINGROUP(61, pcie0_wake, _, _, cri_trng, _, _, _, _, _),
1045     PINGROUP(62, sd_card, _, _, _, _, _, _, _, _),
1046     PINGROUP(63, sd_write, rx0, _, tsens_max, _, _, _, _, _),
1047     PINGROUP(64, mdc, _, qdss_tracedata_a, _, _, _, _, _, _),
1048     PINGROUP(65, mdio, _, qdss_tracedata_a, _, _, _, _, _, _),
1049     PINGROUP(66, pta2_0, wci21, cxc1, qdss_tracedata_a, _, _, _, _, _),
1050     PINGROUP(67, pta2_1, qdss_tracedata_a, _, _, _, _, _, _, _),
1051     PINGROUP(68, pta2_2, wci21, cxc1, qdss_tracedata_a, _, _, _, _, _),
1052     PINGROUP(69, blsp1_uart, blsp1_i2c, blsp1_spi, gcc_plltest, qdss_tracedata_a, _, _, _, _),
1053     PINGROUP(70, blsp1_uart, blsp1_i2c, blsp1_spi, gcc_tlmm, qdss_tracedata_a, _, _, _, _),
1054     PINGROUP(71, blsp1_uart, blsp1_spi, gcc_plltest, qdss_tracedata_a, _, _, _, _, _),
1055     PINGROUP(72, blsp1_uart, blsp1_spi, qdss_tracedata_a, _, _, _, _, _, _),
1056     PINGROUP(73, blsp3_uart, blsp3_i2c, blsp3_spi, _, qdss_tracedata_a, _, _, _, _),
1057     PINGROUP(74, blsp3_uart, blsp3_i2c, blsp3_spi, _, qdss_tracedata_a, _, _, _, _),
1058     PINGROUP(75, blsp3_uart, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _),
1059     PINGROUP(76, blsp3_uart, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _),
1060     PINGROUP(77, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _, _),
1061     PINGROUP(78, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _, _),
1062     PINGROUP(79, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _, _),
1063 };
1064 
1065 static const struct msm_pinctrl_soc_data ipq6018_pinctrl = {
1066     .pins = ipq6018_pins,
1067     .npins = ARRAY_SIZE(ipq6018_pins),
1068     .functions = ipq6018_functions,
1069     .nfunctions = ARRAY_SIZE(ipq6018_functions),
1070     .groups = ipq6018_groups,
1071     .ngroups = ARRAY_SIZE(ipq6018_groups),
1072     .ngpios = 80,
1073 };
1074 
1075 static int ipq6018_pinctrl_probe(struct platform_device *pdev)
1076 {
1077     return msm_pinctrl_probe(pdev, &ipq6018_pinctrl);
1078 }
1079 
1080 static const struct of_device_id ipq6018_pinctrl_of_match[] = {
1081     { .compatible = "qcom,ipq6018-pinctrl", },
1082     { },
1083 };
1084 
1085 static struct platform_driver ipq6018_pinctrl_driver = {
1086     .driver = {
1087         .name = "ipq6018-pinctrl",
1088         .of_match_table = ipq6018_pinctrl_of_match,
1089     },
1090     .probe = ipq6018_pinctrl_probe,
1091     .remove = msm_pinctrl_remove,
1092 };
1093 
1094 static int __init ipq6018_pinctrl_init(void)
1095 {
1096     return platform_driver_register(&ipq6018_pinctrl_driver);
1097 }
1098 arch_initcall(ipq6018_pinctrl_init);
1099 
1100 static void __exit ipq6018_pinctrl_exit(void)
1101 {
1102     platform_driver_unregister(&ipq6018_pinctrl_driver);
1103 }
1104 module_exit(ipq6018_pinctrl_exit);
1105 
1106 MODULE_DESCRIPTION("QTI ipq6018 pinctrl driver");
1107 MODULE_LICENSE("GPL v2");
1108 MODULE_DEVICE_TABLE(of, ipq6018_pinctrl_of_match);