pinctrl-ipq5332.c 22 KB

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