1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (c) 2019-2021, 2023 The Linux Foundation. All rights reserved.
4 */
5
6 #include <linux/module.h>
7 #include <linux/platform_device.h>
8
9 #include "pinctrl-msm.h"
10
11 #define REG_SIZE 0x1000
12 #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7, f8, f9) \
13 { \
14 .grp = PINCTRL_PINGROUP("gpio" #id, \
15 gpio##id##_pins, \
16 ARRAY_SIZE(gpio##id##_pins)), \
17 .funcs = (int[]){ \
18 msm_mux_gpio, /* gpio mode */ \
19 msm_mux_##f1, \
20 msm_mux_##f2, \
21 msm_mux_##f3, \
22 msm_mux_##f4, \
23 msm_mux_##f5, \
24 msm_mux_##f6, \
25 msm_mux_##f7, \
26 msm_mux_##f8, \
27 msm_mux_##f9 \
28 }, \
29 .nfuncs = 10, \
30 .ctl_reg = REG_SIZE * id, \
31 .io_reg = 0x4 + REG_SIZE * id, \
32 .intr_cfg_reg = 0x8 + REG_SIZE * id, \
33 .intr_status_reg = 0xc + REG_SIZE * id, \
34 .mux_bit = 2, \
35 .pull_bit = 0, \
36 .drv_bit = 6, \
37 .oe_bit = 9, \
38 .in_bit = 0, \
39 .out_bit = 1, \
40 .intr_enable_bit = 0, \
41 .intr_status_bit = 0, \
42 .intr_target_bit = 5, \
43 .intr_target_kpss_val = 3, \
44 .intr_raw_status_bit = 4, \
45 .intr_polarity_bit = 1, \
46 .intr_detection_bit = 2, \
47 .intr_detection_width = 2, \
48 }
49
50 static const struct pinctrl_pin_desc ipq5018_pins[] = {
51 PINCTRL_PIN(0, "GPIO_0"),
52 PINCTRL_PIN(1, "GPIO_1"),
53 PINCTRL_PIN(2, "GPIO_2"),
54 PINCTRL_PIN(3, "GPIO_3"),
55 PINCTRL_PIN(4, "GPIO_4"),
56 PINCTRL_PIN(5, "GPIO_5"),
57 PINCTRL_PIN(6, "GPIO_6"),
58 PINCTRL_PIN(7, "GPIO_7"),
59 PINCTRL_PIN(8, "GPIO_8"),
60 PINCTRL_PIN(9, "GPIO_9"),
61 PINCTRL_PIN(10, "GPIO_10"),
62 PINCTRL_PIN(11, "GPIO_11"),
63 PINCTRL_PIN(12, "GPIO_12"),
64 PINCTRL_PIN(13, "GPIO_13"),
65 PINCTRL_PIN(14, "GPIO_14"),
66 PINCTRL_PIN(15, "GPIO_15"),
67 PINCTRL_PIN(16, "GPIO_16"),
68 PINCTRL_PIN(17, "GPIO_17"),
69 PINCTRL_PIN(18, "GPIO_18"),
70 PINCTRL_PIN(19, "GPIO_19"),
71 PINCTRL_PIN(20, "GPIO_20"),
72 PINCTRL_PIN(21, "GPIO_21"),
73 PINCTRL_PIN(22, "GPIO_22"),
74 PINCTRL_PIN(23, "GPIO_23"),
75 PINCTRL_PIN(24, "GPIO_24"),
76 PINCTRL_PIN(25, "GPIO_25"),
77 PINCTRL_PIN(26, "GPIO_26"),
78 PINCTRL_PIN(27, "GPIO_27"),
79 PINCTRL_PIN(28, "GPIO_28"),
80 PINCTRL_PIN(29, "GPIO_29"),
81 PINCTRL_PIN(30, "GPIO_30"),
82 PINCTRL_PIN(31, "GPIO_31"),
83 PINCTRL_PIN(32, "GPIO_32"),
84 PINCTRL_PIN(33, "GPIO_33"),
85 PINCTRL_PIN(34, "GPIO_34"),
86 PINCTRL_PIN(35, "GPIO_35"),
87 PINCTRL_PIN(36, "GPIO_36"),
88 PINCTRL_PIN(37, "GPIO_37"),
89 PINCTRL_PIN(38, "GPIO_38"),
90 PINCTRL_PIN(39, "GPIO_39"),
91 PINCTRL_PIN(40, "GPIO_40"),
92 PINCTRL_PIN(41, "GPIO_41"),
93 PINCTRL_PIN(42, "GPIO_42"),
94 PINCTRL_PIN(43, "GPIO_43"),
95 PINCTRL_PIN(44, "GPIO_44"),
96 PINCTRL_PIN(45, "GPIO_45"),
97 PINCTRL_PIN(46, "GPIO_46"),
98 };
99
100 #define DECLARE_MSM_GPIO_PINS(pin) \
101 static const unsigned int gpio##pin##_pins[] = { pin }
102 DECLARE_MSM_GPIO_PINS(0);
103 DECLARE_MSM_GPIO_PINS(1);
104 DECLARE_MSM_GPIO_PINS(2);
105 DECLARE_MSM_GPIO_PINS(3);
106 DECLARE_MSM_GPIO_PINS(4);
107 DECLARE_MSM_GPIO_PINS(5);
108 DECLARE_MSM_GPIO_PINS(6);
109 DECLARE_MSM_GPIO_PINS(7);
110 DECLARE_MSM_GPIO_PINS(8);
111 DECLARE_MSM_GPIO_PINS(9);
112 DECLARE_MSM_GPIO_PINS(10);
113 DECLARE_MSM_GPIO_PINS(11);
114 DECLARE_MSM_GPIO_PINS(12);
115 DECLARE_MSM_GPIO_PINS(13);
116 DECLARE_MSM_GPIO_PINS(14);
117 DECLARE_MSM_GPIO_PINS(15);
118 DECLARE_MSM_GPIO_PINS(16);
119 DECLARE_MSM_GPIO_PINS(17);
120 DECLARE_MSM_GPIO_PINS(18);
121 DECLARE_MSM_GPIO_PINS(19);
122 DECLARE_MSM_GPIO_PINS(20);
123 DECLARE_MSM_GPIO_PINS(21);
124 DECLARE_MSM_GPIO_PINS(22);
125 DECLARE_MSM_GPIO_PINS(23);
126 DECLARE_MSM_GPIO_PINS(24);
127 DECLARE_MSM_GPIO_PINS(25);
128 DECLARE_MSM_GPIO_PINS(26);
129 DECLARE_MSM_GPIO_PINS(27);
130 DECLARE_MSM_GPIO_PINS(28);
131 DECLARE_MSM_GPIO_PINS(29);
132 DECLARE_MSM_GPIO_PINS(30);
133 DECLARE_MSM_GPIO_PINS(31);
134 DECLARE_MSM_GPIO_PINS(32);
135 DECLARE_MSM_GPIO_PINS(33);
136 DECLARE_MSM_GPIO_PINS(34);
137 DECLARE_MSM_GPIO_PINS(35);
138 DECLARE_MSM_GPIO_PINS(36);
139 DECLARE_MSM_GPIO_PINS(37);
140 DECLARE_MSM_GPIO_PINS(38);
141 DECLARE_MSM_GPIO_PINS(39);
142 DECLARE_MSM_GPIO_PINS(40);
143 DECLARE_MSM_GPIO_PINS(41);
144 DECLARE_MSM_GPIO_PINS(42);
145 DECLARE_MSM_GPIO_PINS(43);
146 DECLARE_MSM_GPIO_PINS(44);
147 DECLARE_MSM_GPIO_PINS(45);
148 DECLARE_MSM_GPIO_PINS(46);
149
150 enum ipq5018_functions {
151 msm_mux_atest_char,
152 msm_mux_audio_pdm0,
153 msm_mux_audio_pdm1,
154 msm_mux_audio_rxbclk,
155 msm_mux_audio_rxd,
156 msm_mux_audio_rxfsync,
157 msm_mux_audio_rxmclk,
158 msm_mux_audio_txbclk,
159 msm_mux_audio_txd,
160 msm_mux_audio_txfsync,
161 msm_mux_audio_txmclk,
162 msm_mux_blsp0_i2c,
163 msm_mux_blsp0_spi,
164 msm_mux_blsp0_uart0,
165 msm_mux_blsp0_uart1,
166 msm_mux_blsp1_i2c0,
167 msm_mux_blsp1_i2c1,
168 msm_mux_blsp1_spi0,
169 msm_mux_blsp1_spi1,
170 msm_mux_blsp1_uart0,
171 msm_mux_blsp1_uart1,
172 msm_mux_blsp1_uart2,
173 msm_mux_blsp2_i2c0,
174 msm_mux_blsp2_i2c1,
175 msm_mux_blsp2_spi,
176 msm_mux_blsp2_spi0,
177 msm_mux_blsp2_spi1,
178 msm_mux_btss,
179 msm_mux_burn0,
180 msm_mux_burn1,
181 msm_mux_cri_trng,
182 msm_mux_cri_trng0,
183 msm_mux_cri_trng1,
184 msm_mux_cxc_clk,
185 msm_mux_cxc_data,
186 msm_mux_dbg_out,
187 msm_mux_eud_gpio,
188 msm_mux_gcc_plltest,
189 msm_mux_gcc_tlmm,
190 msm_mux_gpio,
191 msm_mux_led0,
192 msm_mux_led2,
193 msm_mux_mac0,
194 msm_mux_mac1,
195 msm_mux_mdc,
196 msm_mux_mdio,
197 msm_mux_pcie0_clk,
198 msm_mux_pcie0_wake,
199 msm_mux_pcie1_clk,
200 msm_mux_pcie1_wake,
201 msm_mux_pll_test,
202 msm_mux_prng_rosc,
203 msm_mux_pwm0,
204 msm_mux_pwm1,
205 msm_mux_pwm2,
206 msm_mux_pwm3,
207 msm_mux_qdss_cti_trig_in_a0,
208 msm_mux_qdss_cti_trig_in_a1,
209 msm_mux_qdss_cti_trig_in_b0,
210 msm_mux_qdss_cti_trig_in_b1,
211 msm_mux_qdss_cti_trig_out_a0,
212 msm_mux_qdss_cti_trig_out_a1,
213 msm_mux_qdss_cti_trig_out_b0,
214 msm_mux_qdss_cti_trig_out_b1,
215 msm_mux_qdss_traceclk_a,
216 msm_mux_qdss_traceclk_b,
217 msm_mux_qdss_tracectl_a,
218 msm_mux_qdss_tracectl_b,
219 msm_mux_qdss_tracedata_a,
220 msm_mux_qdss_tracedata_b,
221 msm_mux_qspi_clk,
222 msm_mux_qspi_cs,
223 msm_mux_qspi_data,
224 msm_mux_reset_out,
225 msm_mux_sdc1_clk,
226 msm_mux_sdc1_cmd,
227 msm_mux_sdc1_data,
228 msm_mux_wci_txd,
229 msm_mux_wci_rxd,
230 msm_mux_wsa_swrm,
231 msm_mux_wsi_clk3,
232 msm_mux_wsi_data3,
233 msm_mux_wsis_reset,
234 msm_mux_xfem,
235 msm_mux__,
236 };
237
238 static const char * const atest_char_groups[] = {
239 "gpio0", "gpio1", "gpio2", "gpio3", "gpio37",
240 };
241
242 static const char * const wci_txd_groups[] = {
243 "gpio0", "gpio1", "gpio2", "gpio3",
244 "gpio42", "gpio43", "gpio44", "gpio45",
245 };
246
247 static const char * const wci_rxd_groups[] = {
248 "gpio0", "gpio1", "gpio2", "gpio3",
249 "gpio42", "gpio43", "gpio44", "gpio45",
250 };
251
252 static const char * const xfem_groups[] = {
253 "gpio0", "gpio1", "gpio2", "gpio3",
254 "gpio42", "gpio43", "gpio44", "gpio45",
255 };
256
257 static const char * const qdss_cti_trig_out_a0_groups[] = {
258 "gpio0",
259 };
260
261 static const char * const qdss_cti_trig_in_a0_groups[] = {
262 "gpio1",
263 };
264
265 static const char * const qdss_cti_trig_out_a1_groups[] = {
266 "gpio2",
267 };
268
269 static const char * const qdss_cti_trig_in_a1_groups[] = {
270 "gpio3",
271 };
272
273 static const char * const sdc1_data_groups[] = {
274 "gpio4", "gpio5", "gpio6", "gpio7",
275 };
276
277 static const char * const qspi_data_groups[] = {
278 "gpio4",
279 "gpio5",
280 "gpio6",
281 "gpio7",
282 };
283
284 static const char * const blsp1_spi1_groups[] = {
285 "gpio4", "gpio5", "gpio6", "gpio7",
286 };
287
288 static const char * const btss_groups[] = {
289 "gpio4", "gpio5", "gpio6", "gpio7", "gpio8", "gpio17", "gpio18",
290 "gpio19", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
291 };
292
293 static const char * const dbg_out_groups[] = {
294 "gpio4",
295 };
296
297 static const char * const qdss_traceclk_a_groups[] = {
298 "gpio4",
299 };
300
301 static const char * const burn0_groups[] = {
302 "gpio4",
303 };
304
305 static const char * const cxc_clk_groups[] = {
306 "gpio5",
307 };
308
309 static const char * const blsp1_i2c1_groups[] = {
310 "gpio5", "gpio6",
311 };
312
313 static const char * const qdss_tracectl_a_groups[] = {
314 "gpio5",
315 };
316
317 static const char * const burn1_groups[] = {
318 "gpio5",
319 };
320
321 static const char * const cxc_data_groups[] = {
322 "gpio6",
323 };
324
325 static const char * const qdss_tracedata_a_groups[] = {
326 "gpio6", "gpio7", "gpio8", "gpio9", "gpio10", "gpio11", "gpio12",
327 "gpio13", "gpio14", "gpio15", "gpio16", "gpio17", "gpio18", "gpio19",
328 "gpio20", "gpio21",
329 };
330
331 static const char * const mac0_groups[] = {
332 "gpio7",
333 };
334
335 static const char * const sdc1_cmd_groups[] = {
336 "gpio8",
337 };
338
339 static const char * const qspi_cs_groups[] = {
340 "gpio8",
341 };
342
343 static const char * const mac1_groups[] = {
344 "gpio8",
345 };
346
347 static const char * const sdc1_clk_groups[] = {
348 "gpio9",
349 };
350
351 static const char * const qspi_clk_groups[] = {
352 "gpio9",
353 };
354
355 static const char * const blsp0_spi_groups[] = {
356 "gpio10", "gpio11", "gpio12", "gpio13",
357 };
358
359 static const char * const blsp1_uart0_groups[] = {
360 "gpio10", "gpio11", "gpio12", "gpio13",
361 };
362
363 static const char * const gcc_plltest_groups[] = {
364 "gpio10", "gpio12",
365 };
366
367 static const char * const gcc_tlmm_groups[] = {
368 "gpio11",
369 };
370
371 static const char * const blsp0_i2c_groups[] = {
372 "gpio12", "gpio13",
373 };
374
375 static const char * const pcie0_clk_groups[] = {
376 "gpio14",
377 };
378
379 static const char * const cri_trng0_groups[] = {
380 "gpio14",
381 };
382
383 static const char * const cri_trng1_groups[] = {
384 "gpio15",
385 };
386
387 static const char * const pcie0_wake_groups[] = {
388 "gpio16",
389 };
390
391 static const char * const cri_trng_groups[] = {
392 "gpio16",
393 };
394
395 static const char * const pcie1_clk_groups[] = {
396 "gpio17",
397 };
398
399 static const char * const prng_rosc_groups[] = {
400 "gpio17",
401 };
402
403 static const char * const blsp1_spi0_groups[] = {
404 "gpio18", "gpio19", "gpio20", "gpio21",
405 };
406
407 static const char * const pcie1_wake_groups[] = {
408 "gpio19",
409 };
410
411 static const char * const blsp1_i2c0_groups[] = {
412 "gpio19", "gpio20",
413 };
414
415 static const char * const blsp0_uart0_groups[] = {
416 "gpio20", "gpio21",
417 };
418
419 static const char * const pll_test_groups[] = {
420 "gpio22",
421 };
422
423 static const char * const eud_gpio_groups[] = {
424 "gpio22", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
425 };
426
427 static const char * const audio_rxmclk_groups[] = {
428 "gpio23", "gpio23",
429 };
430
431 static const char * const audio_pdm0_groups[] = {
432 "gpio23", "gpio24",
433 };
434
435 static const char * const blsp2_spi1_groups[] = {
436 "gpio23", "gpio24", "gpio25", "gpio26",
437 };
438
439 static const char * const blsp1_uart2_groups[] = {
440 "gpio23", "gpio24", "gpio25", "gpio26",
441 };
442
443 static const char * const qdss_tracedata_b_groups[] = {
444 "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28", "gpio29",
445 "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35", "gpio36",
446 "gpio37", "gpio38",
447 };
448
449 static const char * const audio_rxbclk_groups[] = {
450 "gpio24",
451 };
452
453 static const char * const audio_rxfsync_groups[] = {
454 "gpio25",
455 };
456
457 static const char * const audio_pdm1_groups[] = {
458 "gpio25", "gpio26",
459 };
460
461 static const char * const blsp2_i2c1_groups[] = {
462 "gpio25", "gpio26",
463 };
464
465 static const char * const audio_rxd_groups[] = {
466 "gpio26",
467 };
468
469 static const char * const audio_txmclk_groups[] = {
470 "gpio27", "gpio27",
471 };
472
473 static const char * const wsa_swrm_groups[] = {
474 "gpio27", "gpio28",
475 };
476
477 static const char * const blsp2_spi_groups[] = {
478 "gpio27",
479 };
480
481 static const char * const audio_txbclk_groups[] = {
482 "gpio28",
483 };
484
485 static const char * const blsp0_uart1_groups[] = {
486 "gpio28", "gpio29",
487 };
488
489 static const char * const audio_txfsync_groups[] = {
490 "gpio29",
491 };
492
493 static const char * const audio_txd_groups[] = {
494 "gpio30",
495 };
496
497 static const char * const wsis_reset_groups[] = {
498 "gpio30",
499 };
500
501 static const char * const blsp2_spi0_groups[] = {
502 "gpio31", "gpio32", "gpio33", "gpio34",
503 };
504
505 static const char * const blsp1_uart1_groups[] = {
506 "gpio31", "gpio32", "gpio33", "gpio34",
507 };
508
509 static const char * const blsp2_i2c0_groups[] = {
510 "gpio33", "gpio34",
511 };
512
513 static const char * const mdc_groups[] = {
514 "gpio36",
515 };
516
517 static const char * const wsi_clk3_groups[] = {
518 "gpio36",
519 };
520
521 static const char * const mdio_groups[] = {
522 "gpio37",
523 };
524
525 static const char * const wsi_data3_groups[] = {
526 "gpio37",
527 };
528
529 static const char * const qdss_traceclk_b_groups[] = {
530 "gpio39",
531 };
532
533 static const char * const reset_out_groups[] = {
534 "gpio40",
535 };
536
537 static const char * const qdss_tracectl_b_groups[] = {
538 "gpio40",
539 };
540
541 static const char * const pwm0_groups[] = {
542 "gpio42",
543 };
544
545 static const char * const qdss_cti_trig_out_b0_groups[] = {
546 "gpio42",
547 };
548
549 static const char * const pwm1_groups[] = {
550 "gpio43",
551 };
552
553 static const char * const qdss_cti_trig_in_b0_groups[] = {
554 "gpio43",
555 };
556
557 static const char * const pwm2_groups[] = {
558 "gpio44",
559 };
560
561 static const char * const qdss_cti_trig_out_b1_groups[] = {
562 "gpio44",
563 };
564
565 static const char * const pwm3_groups[] = {
566 "gpio45",
567 };
568
569 static const char * const qdss_cti_trig_in_b1_groups[] = {
570 "gpio45",
571 };
572
573 static const char * const led0_groups[] = {
574 "gpio46", "gpio30", "gpio10",
575 };
576
577 static const char * const led2_groups[] = {
578 "gpio30",
579 };
580
581 static const char * const gpio_groups[] = {
582 "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
583 "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
584 "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
585 "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
586 "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
587 "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
588 "gpio43", "gpio44", "gpio45", "gpio46",
589 };
590
591 static const struct pinfunction ipq5018_functions[] = {
592 MSM_PIN_FUNCTION(atest_char),
593 MSM_PIN_FUNCTION(audio_pdm0),
594 MSM_PIN_FUNCTION(audio_pdm1),
595 MSM_PIN_FUNCTION(audio_rxbclk),
596 MSM_PIN_FUNCTION(audio_rxd),
597 MSM_PIN_FUNCTION(audio_rxfsync),
598 MSM_PIN_FUNCTION(audio_rxmclk),
599 MSM_PIN_FUNCTION(audio_txbclk),
600 MSM_PIN_FUNCTION(audio_txd),
601 MSM_PIN_FUNCTION(audio_txfsync),
602 MSM_PIN_FUNCTION(audio_txmclk),
603 MSM_PIN_FUNCTION(blsp0_i2c),
604 MSM_PIN_FUNCTION(blsp0_spi),
605 MSM_PIN_FUNCTION(blsp0_uart0),
606 MSM_PIN_FUNCTION(blsp0_uart1),
607 MSM_PIN_FUNCTION(blsp1_i2c0),
608 MSM_PIN_FUNCTION(blsp1_i2c1),
609 MSM_PIN_FUNCTION(blsp1_spi0),
610 MSM_PIN_FUNCTION(blsp1_spi1),
611 MSM_PIN_FUNCTION(blsp1_uart0),
612 MSM_PIN_FUNCTION(blsp1_uart1),
613 MSM_PIN_FUNCTION(blsp1_uart2),
614 MSM_PIN_FUNCTION(blsp2_i2c0),
615 MSM_PIN_FUNCTION(blsp2_i2c1),
616 MSM_PIN_FUNCTION(blsp2_spi),
617 MSM_PIN_FUNCTION(blsp2_spi0),
618 MSM_PIN_FUNCTION(blsp2_spi1),
619 MSM_PIN_FUNCTION(btss),
620 MSM_PIN_FUNCTION(burn0),
621 MSM_PIN_FUNCTION(burn1),
622 MSM_PIN_FUNCTION(cri_trng),
623 MSM_PIN_FUNCTION(cri_trng0),
624 MSM_PIN_FUNCTION(cri_trng1),
625 MSM_PIN_FUNCTION(cxc_clk),
626 MSM_PIN_FUNCTION(cxc_data),
627 MSM_PIN_FUNCTION(dbg_out),
628 MSM_PIN_FUNCTION(eud_gpio),
629 MSM_PIN_FUNCTION(gcc_plltest),
630 MSM_PIN_FUNCTION(gcc_tlmm),
631 MSM_GPIO_PIN_FUNCTION(gpio),
632 MSM_PIN_FUNCTION(led0),
633 MSM_PIN_FUNCTION(led2),
634 MSM_PIN_FUNCTION(mac0),
635 MSM_PIN_FUNCTION(mac1),
636 MSM_PIN_FUNCTION(mdc),
637 MSM_PIN_FUNCTION(mdio),
638 MSM_PIN_FUNCTION(pcie0_clk),
639 MSM_PIN_FUNCTION(pcie0_wake),
640 MSM_PIN_FUNCTION(pcie1_clk),
641 MSM_PIN_FUNCTION(pcie1_wake),
642 MSM_PIN_FUNCTION(pll_test),
643 MSM_PIN_FUNCTION(prng_rosc),
644 MSM_PIN_FUNCTION(pwm0),
645 MSM_PIN_FUNCTION(pwm1),
646 MSM_PIN_FUNCTION(pwm2),
647 MSM_PIN_FUNCTION(pwm3),
648 MSM_PIN_FUNCTION(qdss_cti_trig_in_a0),
649 MSM_PIN_FUNCTION(qdss_cti_trig_in_a1),
650 MSM_PIN_FUNCTION(qdss_cti_trig_in_b0),
651 MSM_PIN_FUNCTION(qdss_cti_trig_in_b1),
652 MSM_PIN_FUNCTION(qdss_cti_trig_out_a0),
653 MSM_PIN_FUNCTION(qdss_cti_trig_out_a1),
654 MSM_PIN_FUNCTION(qdss_cti_trig_out_b0),
655 MSM_PIN_FUNCTION(qdss_cti_trig_out_b1),
656 MSM_PIN_FUNCTION(qdss_traceclk_a),
657 MSM_PIN_FUNCTION(qdss_traceclk_b),
658 MSM_PIN_FUNCTION(qdss_tracectl_a),
659 MSM_PIN_FUNCTION(qdss_tracectl_b),
660 MSM_PIN_FUNCTION(qdss_tracedata_a),
661 MSM_PIN_FUNCTION(qdss_tracedata_b),
662 MSM_PIN_FUNCTION(qspi_clk),
663 MSM_PIN_FUNCTION(qspi_cs),
664 MSM_PIN_FUNCTION(qspi_data),
665 MSM_PIN_FUNCTION(reset_out),
666 MSM_PIN_FUNCTION(sdc1_clk),
667 MSM_PIN_FUNCTION(sdc1_cmd),
668 MSM_PIN_FUNCTION(sdc1_data),
669 MSM_PIN_FUNCTION(wci_txd),
670 MSM_PIN_FUNCTION(wci_rxd),
671 MSM_PIN_FUNCTION(wsa_swrm),
672 MSM_PIN_FUNCTION(wsi_clk3),
673 MSM_PIN_FUNCTION(wsi_data3),
674 MSM_PIN_FUNCTION(wsis_reset),
675 MSM_PIN_FUNCTION(xfem),
676 };
677
678 static const struct msm_pingroup ipq5018_groups[] = {
679 PINGROUP(0, atest_char, _, qdss_cti_trig_out_a0, wci_txd, wci_rxd, xfem, _, _, _),
680 PINGROUP(1, atest_char, _, qdss_cti_trig_in_a0, wci_txd, wci_rxd, xfem, _, _, _),
681 PINGROUP(2, atest_char, _, qdss_cti_trig_out_a1, wci_txd, wci_rxd, xfem, _, _, _),
682 PINGROUP(3, atest_char, _, qdss_cti_trig_in_a1, wci_txd, wci_rxd, xfem, _, _, _),
683 PINGROUP(4, sdc1_data, qspi_data, blsp1_spi1, btss, dbg_out, qdss_traceclk_a, _, burn0, _),
684 PINGROUP(5, sdc1_data, qspi_data, cxc_clk, blsp1_spi1, blsp1_i2c1, btss, _, qdss_tracectl_a, _),
685 PINGROUP(6, sdc1_data, qspi_data, cxc_data, blsp1_spi1, blsp1_i2c1, btss, _, qdss_tracedata_a, _),
686 PINGROUP(7, sdc1_data, qspi_data, mac0, blsp1_spi1, btss, _, qdss_tracedata_a, _, _),
687 PINGROUP(8, sdc1_cmd, qspi_cs, mac1, btss, _, qdss_tracedata_a, _, _, _),
688 PINGROUP(9, sdc1_clk, qspi_clk, _, qdss_tracedata_a, _, _, _, _, _),
689 PINGROUP(10, blsp0_spi, blsp1_uart0, led0, gcc_plltest, qdss_tracedata_a, _, _, _, _),
690 PINGROUP(11, blsp0_spi, blsp1_uart0, _, gcc_tlmm, qdss_tracedata_a, _, _, _, _),
691 PINGROUP(12, blsp0_spi, blsp0_i2c, blsp1_uart0, _, gcc_plltest, qdss_tracedata_a, _, _, _),
692 PINGROUP(13, blsp0_spi, blsp0_i2c, blsp1_uart0, _, qdss_tracedata_a, _, _, _, _),
693 PINGROUP(14, pcie0_clk, _, _, cri_trng0, qdss_tracedata_a, _, _, _, _),
694 PINGROUP(15, _, _, cri_trng1, qdss_tracedata_a, _, _, _, _, _),
695 PINGROUP(16, pcie0_wake, _, _, cri_trng, qdss_tracedata_a, _, _, _, _),
696 PINGROUP(17, pcie1_clk, btss, _, prng_rosc, qdss_tracedata_a, _, _, _, _),
697 PINGROUP(18, blsp1_spi0, btss, _, qdss_tracedata_a, _, _, _, _, _),
698 PINGROUP(19, pcie1_wake, blsp1_spi0, blsp1_i2c0, btss, _, qdss_tracedata_a, _, _, _),
699 PINGROUP(20, blsp0_uart0, blsp1_spi0, blsp1_i2c0, _, qdss_tracedata_a, _, _, _, _),
700 PINGROUP(21, blsp0_uart0, blsp1_spi0, _, qdss_tracedata_a, _, _, _, _, _),
701 PINGROUP(22, _, pll_test, eud_gpio, _, _, _, _, _, _),
702 PINGROUP(23, audio_rxmclk, audio_pdm0, audio_rxmclk, blsp2_spi1, blsp1_uart2, btss, _, qdss_tracedata_b, _),
703 PINGROUP(24, audio_rxbclk, audio_pdm0, blsp2_spi1, blsp1_uart2, btss, _, qdss_tracedata_b, _, _),
704 PINGROUP(25, audio_rxfsync, audio_pdm1, blsp2_i2c1, blsp2_spi1, blsp1_uart2, btss, _, qdss_tracedata_b, _),
705 PINGROUP(26, audio_rxd, audio_pdm1, blsp2_i2c1, blsp2_spi1, blsp1_uart2, btss, _, qdss_tracedata_b, _),
706 PINGROUP(27, audio_txmclk, wsa_swrm, audio_txmclk, blsp2_spi, btss, _, qdss_tracedata_b, _, _),
707 PINGROUP(28, audio_txbclk, wsa_swrm, blsp0_uart1, btss, qdss_tracedata_b, _, _, _, _),
708 PINGROUP(29, audio_txfsync, _, blsp0_uart1, _, qdss_tracedata_b, _, _, _, _),
709 PINGROUP(30, audio_txd, led2, led0, _, _, _, _, _, _),
710 PINGROUP(31, blsp2_spi0, blsp1_uart1, _, qdss_tracedata_b, eud_gpio, _, _, _, _),
711 PINGROUP(32, blsp2_spi0, blsp1_uart1, _, qdss_tracedata_b, eud_gpio, _, _, _, _),
712 PINGROUP(33, blsp2_i2c0, blsp2_spi0, blsp1_uart1, _, qdss_tracedata_b, eud_gpio, _, _, _),
713 PINGROUP(34, blsp2_i2c0, blsp2_spi0, blsp1_uart1, _, qdss_tracedata_b, eud_gpio, _, _, _),
714 PINGROUP(35, _, qdss_tracedata_b, eud_gpio, _, _, _, _, _, _),
715 PINGROUP(36, mdc, qdss_tracedata_b, _, wsi_clk3, _, _, _, _, _),
716 PINGROUP(37, mdio, atest_char, qdss_tracedata_b, _, wsi_data3, _, _, _, _),
717 PINGROUP(38, qdss_tracedata_b, _, _, _, _, _, _, _, _),
718 PINGROUP(39, qdss_traceclk_b, _, _, _, _, _, _, _, _),
719 PINGROUP(40, reset_out, qdss_tracectl_b, _, _, _, _, _, _, _),
720 PINGROUP(41, _, _, _, _, _, _, _, _, _),
721 PINGROUP(42, pwm0, qdss_cti_trig_out_b0, wci_txd, wci_rxd, xfem, _, _, _, _),
722 PINGROUP(43, pwm1, qdss_cti_trig_in_b0, wci_txd, wci_rxd, xfem, _, _, _, _),
723 PINGROUP(44, pwm2, qdss_cti_trig_out_b1, wci_txd, wci_rxd, xfem, _, _, _, _),
724 PINGROUP(45, pwm3, qdss_cti_trig_in_b1, wci_txd, wci_rxd, xfem, _, _, _, _),
725 PINGROUP(46, led0, _, _, _, _, _, _, _, _),
726 };
727
728 static const struct msm_pinctrl_soc_data ipq5018_pinctrl = {
729 .pins = ipq5018_pins,
730 .npins = ARRAY_SIZE(ipq5018_pins),
731 .functions = ipq5018_functions,
732 .nfunctions = ARRAY_SIZE(ipq5018_functions),
733 .groups = ipq5018_groups,
734 .ngroups = ARRAY_SIZE(ipq5018_groups),
735 .ngpios = 47,
736 };
737
ipq5018_pinctrl_probe(struct platform_device * pdev)738 static int ipq5018_pinctrl_probe(struct platform_device *pdev)
739 {
740 return msm_pinctrl_probe(pdev, &ipq5018_pinctrl);
741 }
742
743 static const struct of_device_id ipq5018_pinctrl_of_match[] = {
744 { .compatible = "qcom,ipq5018-tlmm", },
745 { }
746 };
747 MODULE_DEVICE_TABLE(of, ipq5018_pinctrl_of_match);
748
749 static struct platform_driver ipq5018_pinctrl_driver = {
750 .driver = {
751 .name = "ipq5018-tlmm",
752 .of_match_table = ipq5018_pinctrl_of_match,
753 },
754 .probe = ipq5018_pinctrl_probe,
755 };
756
ipq5018_pinctrl_init(void)757 static int __init ipq5018_pinctrl_init(void)
758 {
759 return platform_driver_register(&ipq5018_pinctrl_driver);
760 }
761 arch_initcall(ipq5018_pinctrl_init);
762
ipq5018_pinctrl_exit(void)763 static void __exit ipq5018_pinctrl_exit(void)
764 {
765 platform_driver_unregister(&ipq5018_pinctrl_driver);
766 }
767 module_exit(ipq5018_pinctrl_exit);
768
769 MODULE_DESCRIPTION("Qualcomm Technologies Inc ipq5018 pinctrl driver");
770 MODULE_LICENSE("GPL");
771