pinctrl-ipq9574.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2. /*
  3. * Copyright (c) 2023 The Linux Foundation. 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 ipq9574_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. PINCTRL_PIN(53, "GPIO_53"),
  103. PINCTRL_PIN(54, "GPIO_54"),
  104. PINCTRL_PIN(55, "GPIO_55"),
  105. PINCTRL_PIN(56, "GPIO_56"),
  106. PINCTRL_PIN(57, "GPIO_57"),
  107. PINCTRL_PIN(58, "GPIO_58"),
  108. PINCTRL_PIN(59, "GPIO_59"),
  109. PINCTRL_PIN(60, "GPIO_60"),
  110. PINCTRL_PIN(61, "GPIO_61"),
  111. PINCTRL_PIN(62, "GPIO_62"),
  112. PINCTRL_PIN(63, "GPIO_63"),
  113. PINCTRL_PIN(64, "GPIO_64"),
  114. };
  115. #define DECLARE_MSM_GPIO_PINS(pin) \
  116. static const unsigned int gpio##pin##_pins[] = { pin }
  117. DECLARE_MSM_GPIO_PINS(0);
  118. DECLARE_MSM_GPIO_PINS(1);
  119. DECLARE_MSM_GPIO_PINS(2);
  120. DECLARE_MSM_GPIO_PINS(3);
  121. DECLARE_MSM_GPIO_PINS(4);
  122. DECLARE_MSM_GPIO_PINS(5);
  123. DECLARE_MSM_GPIO_PINS(6);
  124. DECLARE_MSM_GPIO_PINS(7);
  125. DECLARE_MSM_GPIO_PINS(8);
  126. DECLARE_MSM_GPIO_PINS(9);
  127. DECLARE_MSM_GPIO_PINS(10);
  128. DECLARE_MSM_GPIO_PINS(11);
  129. DECLARE_MSM_GPIO_PINS(12);
  130. DECLARE_MSM_GPIO_PINS(13);
  131. DECLARE_MSM_GPIO_PINS(14);
  132. DECLARE_MSM_GPIO_PINS(15);
  133. DECLARE_MSM_GPIO_PINS(16);
  134. DECLARE_MSM_GPIO_PINS(17);
  135. DECLARE_MSM_GPIO_PINS(18);
  136. DECLARE_MSM_GPIO_PINS(19);
  137. DECLARE_MSM_GPIO_PINS(20);
  138. DECLARE_MSM_GPIO_PINS(21);
  139. DECLARE_MSM_GPIO_PINS(22);
  140. DECLARE_MSM_GPIO_PINS(23);
  141. DECLARE_MSM_GPIO_PINS(24);
  142. DECLARE_MSM_GPIO_PINS(25);
  143. DECLARE_MSM_GPIO_PINS(26);
  144. DECLARE_MSM_GPIO_PINS(27);
  145. DECLARE_MSM_GPIO_PINS(28);
  146. DECLARE_MSM_GPIO_PINS(29);
  147. DECLARE_MSM_GPIO_PINS(30);
  148. DECLARE_MSM_GPIO_PINS(31);
  149. DECLARE_MSM_GPIO_PINS(32);
  150. DECLARE_MSM_GPIO_PINS(33);
  151. DECLARE_MSM_GPIO_PINS(34);
  152. DECLARE_MSM_GPIO_PINS(35);
  153. DECLARE_MSM_GPIO_PINS(36);
  154. DECLARE_MSM_GPIO_PINS(37);
  155. DECLARE_MSM_GPIO_PINS(38);
  156. DECLARE_MSM_GPIO_PINS(39);
  157. DECLARE_MSM_GPIO_PINS(40);
  158. DECLARE_MSM_GPIO_PINS(41);
  159. DECLARE_MSM_GPIO_PINS(42);
  160. DECLARE_MSM_GPIO_PINS(43);
  161. DECLARE_MSM_GPIO_PINS(44);
  162. DECLARE_MSM_GPIO_PINS(45);
  163. DECLARE_MSM_GPIO_PINS(46);
  164. DECLARE_MSM_GPIO_PINS(47);
  165. DECLARE_MSM_GPIO_PINS(48);
  166. DECLARE_MSM_GPIO_PINS(49);
  167. DECLARE_MSM_GPIO_PINS(50);
  168. DECLARE_MSM_GPIO_PINS(51);
  169. DECLARE_MSM_GPIO_PINS(52);
  170. DECLARE_MSM_GPIO_PINS(53);
  171. DECLARE_MSM_GPIO_PINS(54);
  172. DECLARE_MSM_GPIO_PINS(55);
  173. DECLARE_MSM_GPIO_PINS(56);
  174. DECLARE_MSM_GPIO_PINS(57);
  175. DECLARE_MSM_GPIO_PINS(58);
  176. DECLARE_MSM_GPIO_PINS(59);
  177. DECLARE_MSM_GPIO_PINS(60);
  178. DECLARE_MSM_GPIO_PINS(61);
  179. DECLARE_MSM_GPIO_PINS(62);
  180. DECLARE_MSM_GPIO_PINS(63);
  181. DECLARE_MSM_GPIO_PINS(64);
  182. enum ipq9574_functions {
  183. msm_mux_atest_char,
  184. msm_mux_atest_char0,
  185. msm_mux_atest_char1,
  186. msm_mux_atest_char2,
  187. msm_mux_atest_char3,
  188. msm_mux_audio_pdm0,
  189. msm_mux_audio_pdm1,
  190. msm_mux_audio_pri,
  191. msm_mux_audio_sec,
  192. msm_mux_blsp0_spi,
  193. msm_mux_blsp0_uart,
  194. msm_mux_blsp1_i2c,
  195. msm_mux_blsp1_spi,
  196. msm_mux_blsp1_uart,
  197. msm_mux_blsp2_i2c,
  198. msm_mux_blsp2_spi,
  199. msm_mux_blsp2_uart,
  200. msm_mux_blsp3_i2c,
  201. msm_mux_blsp3_spi,
  202. msm_mux_blsp3_uart,
  203. msm_mux_blsp4_i2c,
  204. msm_mux_blsp4_spi,
  205. msm_mux_blsp4_uart,
  206. msm_mux_blsp5_i2c,
  207. msm_mux_blsp5_uart,
  208. msm_mux_cri_trng0,
  209. msm_mux_cri_trng1,
  210. msm_mux_cri_trng2,
  211. msm_mux_cri_trng3,
  212. msm_mux_cxc0,
  213. msm_mux_cxc1,
  214. msm_mux_dbg_out,
  215. msm_mux_dwc_ddrphy,
  216. msm_mux_gcc_plltest,
  217. msm_mux_gcc_tlmm,
  218. msm_mux_gpio,
  219. msm_mux_mac,
  220. msm_mux_mdc,
  221. msm_mux_mdio,
  222. msm_mux_pcie0_clk,
  223. msm_mux_pcie0_wake,
  224. msm_mux_pcie1_clk,
  225. msm_mux_pcie1_wake,
  226. msm_mux_pcie2_clk,
  227. msm_mux_pcie2_wake,
  228. msm_mux_pcie3_clk,
  229. msm_mux_pcie3_wake,
  230. msm_mux_prng_rosc0,
  231. msm_mux_prng_rosc1,
  232. msm_mux_prng_rosc2,
  233. msm_mux_prng_rosc3,
  234. msm_mux_pta,
  235. msm_mux_pwm,
  236. msm_mux_qdss_cti_trig_in_a0,
  237. msm_mux_qdss_cti_trig_in_a1,
  238. msm_mux_qdss_cti_trig_in_b0,
  239. msm_mux_qdss_cti_trig_in_b1,
  240. msm_mux_qdss_cti_trig_out_a0,
  241. msm_mux_qdss_cti_trig_out_a1,
  242. msm_mux_qdss_cti_trig_out_b0,
  243. msm_mux_qdss_cti_trig_out_b1,
  244. msm_mux_qdss_traceclk_a,
  245. msm_mux_qdss_traceclk_b,
  246. msm_mux_qdss_tracectl_a,
  247. msm_mux_qdss_tracectl_b,
  248. msm_mux_qdss_tracedata_a,
  249. msm_mux_qdss_tracedata_b,
  250. msm_mux_qspi_data,
  251. msm_mux_qspi_clk,
  252. msm_mux_qspi_cs,
  253. msm_mux_rx0,
  254. msm_mux_rx1,
  255. msm_mux_sdc_data,
  256. msm_mux_sdc_clk,
  257. msm_mux_sdc_cmd,
  258. msm_mux_sdc_rclk,
  259. msm_mux_tsens_max,
  260. msm_mux_wci20,
  261. msm_mux_wci21,
  262. msm_mux_wsa_swrm,
  263. msm_mux__,
  264. };
  265. static const char * const gpio_groups[] = {
  266. "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
  267. "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
  268. "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
  269. "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
  270. "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
  271. "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
  272. "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
  273. "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
  274. "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
  275. "gpio64",
  276. };
  277. static const char * const sdc_data_groups[] = {
  278. "gpio0",
  279. "gpio1",
  280. "gpio2",
  281. "gpio3",
  282. "gpio6",
  283. "gpio7",
  284. "gpio8",
  285. "gpio9",
  286. };
  287. static const char * const qspi_data_groups[] = {
  288. "gpio0",
  289. "gpio1",
  290. "gpio2",
  291. "gpio3",
  292. };
  293. static const char * const qdss_traceclk_b_groups[] = {
  294. "gpio0",
  295. };
  296. static const char * const qdss_tracectl_b_groups[] = {
  297. "gpio1",
  298. };
  299. static const char * const qdss_tracedata_b_groups[] = {
  300. "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7", "gpio8", "gpio9",
  301. "gpio10", "gpio11", "gpio12", "gpio13", "gpio14", "gpio15", "gpio16",
  302. "gpio17",
  303. };
  304. static const char * const sdc_cmd_groups[] = {
  305. "gpio4",
  306. };
  307. static const char * const qspi_cs_groups[] = {
  308. "gpio4",
  309. };
  310. static const char * const sdc_clk_groups[] = {
  311. "gpio5",
  312. };
  313. static const char * const qspi_clk_groups[] = {
  314. "gpio5",
  315. };
  316. static const char * const sdc_rclk_groups[] = {
  317. "gpio10",
  318. };
  319. static const char * const blsp0_spi_groups[] = {
  320. "gpio11", "gpio12", "gpio13", "gpio14",
  321. };
  322. static const char * const blsp0_uart_groups[] = {
  323. "gpio11", "gpio12", "gpio13", "gpio14",
  324. };
  325. static const char * const blsp3_spi_groups[] = {
  326. "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
  327. };
  328. static const char * const blsp3_i2c_groups[] = {
  329. "gpio15", "gpio16",
  330. };
  331. static const char * const blsp3_uart_groups[] = {
  332. "gpio15", "gpio16", "gpio17", "gpio18",
  333. };
  334. static const char * const dbg_out_groups[] = {
  335. "gpio17",
  336. };
  337. static const char * const cri_trng0_groups[] = {
  338. "gpio20", "gpio38",
  339. };
  340. static const char * const cri_trng1_groups[] = {
  341. "gpio21", "gpio34",
  342. };
  343. static const char * const pcie0_clk_groups[] = {
  344. "gpio22",
  345. };
  346. static const char * const pta_groups[] = {
  347. "gpio22", "gpio23", "gpio24", "gpio54", "gpio55", "gpio56", "gpio61",
  348. "gpio62", "gpio63",
  349. };
  350. static const char * const wci21_groups[] = {
  351. "gpio23", "gpio24",
  352. };
  353. static const char * const cxc0_groups[] = {
  354. "gpio23", "gpio24",
  355. };
  356. static const char * const pcie0_wake_groups[] = {
  357. "gpio24",
  358. };
  359. static const char * const qdss_cti_trig_out_b0_groups[] = {
  360. "gpio24",
  361. };
  362. static const char * const pcie1_clk_groups[] = {
  363. "gpio25",
  364. };
  365. static const char * const qdss_cti_trig_in_b0_groups[] = {
  366. "gpio25",
  367. };
  368. static const char * const atest_char0_groups[] = {
  369. "gpio26",
  370. };
  371. static const char * const qdss_cti_trig_out_b1_groups[] = {
  372. "gpio26",
  373. };
  374. static const char * const pcie1_wake_groups[] = {
  375. "gpio27",
  376. };
  377. static const char * const atest_char1_groups[] = {
  378. "gpio27",
  379. };
  380. static const char * const qdss_cti_trig_in_b1_groups[] = {
  381. "gpio27",
  382. };
  383. static const char * const pcie2_clk_groups[] = {
  384. "gpio28",
  385. };
  386. static const char * const atest_char2_groups[] = {
  387. "gpio28",
  388. };
  389. static const char * const atest_char3_groups[] = {
  390. "gpio29",
  391. };
  392. static const char * const pcie2_wake_groups[] = {
  393. "gpio30",
  394. };
  395. static const char * const pwm_groups[] = {
  396. "gpio30", "gpio31", "gpio32", "gpio33", "gpio44", "gpio45", "gpio46",
  397. "gpio47", "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55",
  398. "gpio56", "gpio57", "gpio58", "gpio59", "gpio60",
  399. };
  400. static const char * const atest_char_groups[] = {
  401. "gpio30",
  402. };
  403. static const char * const pcie3_clk_groups[] = {
  404. "gpio31",
  405. };
  406. static const char * const qdss_cti_trig_in_a1_groups[] = {
  407. "gpio31",
  408. };
  409. static const char * const qdss_cti_trig_out_a1_groups[] = {
  410. "gpio32",
  411. };
  412. static const char * const pcie3_wake_groups[] = {
  413. "gpio33",
  414. };
  415. static const char * const qdss_cti_trig_in_a0_groups[] = {
  416. "gpio33",
  417. };
  418. static const char * const blsp2_uart_groups[] = {
  419. "gpio34", "gpio35",
  420. };
  421. static const char * const blsp2_i2c_groups[] = {
  422. "gpio34", "gpio35",
  423. };
  424. static const char * const blsp2_spi_groups[] = {
  425. "gpio34", "gpio35", "gpio36", "gpio37",
  426. };
  427. static const char * const blsp1_uart_groups[] = {
  428. "gpio34", "gpio35", "gpio36", "gpio37",
  429. };
  430. static const char * const qdss_cti_trig_out_a0_groups[] = {
  431. "gpio34",
  432. };
  433. static const char * const cri_trng2_groups[] = {
  434. "gpio35",
  435. };
  436. static const char * const blsp1_i2c_groups[] = {
  437. "gpio36", "gpio37",
  438. };
  439. static const char * const cri_trng3_groups[] = {
  440. "gpio36",
  441. };
  442. static const char * const dwc_ddrphy_groups[] = {
  443. "gpio37",
  444. };
  445. static const char * const mdc_groups[] = {
  446. "gpio38",
  447. };
  448. static const char * const mdio_groups[] = {
  449. "gpio39",
  450. };
  451. static const char * const audio_pri_groups[] = {
  452. "gpio40", "gpio41", "gpio42", "gpio43", "gpio61", "gpio61",
  453. };
  454. static const char * const audio_pdm0_groups[] = {
  455. "gpio40", "gpio41", "gpio42", "gpio43",
  456. };
  457. static const char * const qdss_traceclk_a_groups[] = {
  458. "gpio43",
  459. };
  460. static const char * const audio_sec_groups[] = {
  461. "gpio44", "gpio45", "gpio46", "gpio47", "gpio62", "gpio62",
  462. };
  463. static const char * const wsa_swrm_groups[] = {
  464. "gpio44", "gpio45",
  465. };
  466. static const char * const qdss_tracectl_a_groups[] = {
  467. "gpio44",
  468. };
  469. static const char * const qdss_tracedata_a_groups[] = {
  470. "gpio45", "gpio46", "gpio47", "gpio48", "gpio49", "gpio50", "gpio51",
  471. "gpio52", "gpio53", "gpio54", "gpio55", "gpio56", "gpio57", "gpio58",
  472. "gpio59", "gpio60",
  473. };
  474. static const char * const rx1_groups[] = {
  475. "gpio46",
  476. };
  477. static const char * const mac_groups[] = {
  478. "gpio46", "gpio47", "gpio57", "gpio58",
  479. };
  480. static const char * const blsp5_i2c_groups[] = {
  481. "gpio48", "gpio49",
  482. };
  483. static const char * const blsp5_uart_groups[] = {
  484. "gpio48", "gpio49",
  485. };
  486. static const char * const blsp4_uart_groups[] = {
  487. "gpio50", "gpio51", "gpio52", "gpio53",
  488. };
  489. static const char * const blsp4_i2c_groups[] = {
  490. "gpio50", "gpio51",
  491. };
  492. static const char * const blsp4_spi_groups[] = {
  493. "gpio50", "gpio51", "gpio52", "gpio53",
  494. };
  495. static const char * const wci20_groups[] = {
  496. "gpio57", "gpio58",
  497. };
  498. static const char * const cxc1_groups[] = {
  499. "gpio57", "gpio58",
  500. };
  501. static const char * const rx0_groups[] = {
  502. "gpio59",
  503. };
  504. static const char * const prng_rosc0_groups[] = {
  505. "gpio60",
  506. };
  507. static const char * const gcc_plltest_groups[] = {
  508. "gpio60", "gpio62",
  509. };
  510. static const char * const blsp1_spi_groups[] = {
  511. "gpio61", "gpio62", "gpio63", "gpio64",
  512. };
  513. static const char * const audio_pdm1_groups[] = {
  514. "gpio61", "gpio62", "gpio63", "gpio64",
  515. };
  516. static const char * const prng_rosc1_groups[] = {
  517. "gpio61",
  518. };
  519. static const char * const gcc_tlmm_groups[] = {
  520. "gpio61",
  521. };
  522. static const char * const prng_rosc2_groups[] = {
  523. "gpio62",
  524. };
  525. static const char * const prng_rosc3_groups[] = {
  526. "gpio63",
  527. };
  528. static const char * const tsens_max_groups[] = {
  529. "gpio64",
  530. };
  531. static const struct pinfunction ipq9574_functions[] = {
  532. MSM_PIN_FUNCTION(atest_char),
  533. MSM_PIN_FUNCTION(atest_char0),
  534. MSM_PIN_FUNCTION(atest_char1),
  535. MSM_PIN_FUNCTION(atest_char2),
  536. MSM_PIN_FUNCTION(atest_char3),
  537. MSM_PIN_FUNCTION(audio_pdm0),
  538. MSM_PIN_FUNCTION(audio_pdm1),
  539. MSM_PIN_FUNCTION(audio_pri),
  540. MSM_PIN_FUNCTION(audio_sec),
  541. MSM_PIN_FUNCTION(blsp0_spi),
  542. MSM_PIN_FUNCTION(blsp0_uart),
  543. MSM_PIN_FUNCTION(blsp1_i2c),
  544. MSM_PIN_FUNCTION(blsp1_spi),
  545. MSM_PIN_FUNCTION(blsp1_uart),
  546. MSM_PIN_FUNCTION(blsp2_i2c),
  547. MSM_PIN_FUNCTION(blsp2_spi),
  548. MSM_PIN_FUNCTION(blsp2_uart),
  549. MSM_PIN_FUNCTION(blsp3_i2c),
  550. MSM_PIN_FUNCTION(blsp3_spi),
  551. MSM_PIN_FUNCTION(blsp3_uart),
  552. MSM_PIN_FUNCTION(blsp4_i2c),
  553. MSM_PIN_FUNCTION(blsp4_spi),
  554. MSM_PIN_FUNCTION(blsp4_uart),
  555. MSM_PIN_FUNCTION(blsp5_i2c),
  556. MSM_PIN_FUNCTION(blsp5_uart),
  557. MSM_PIN_FUNCTION(cri_trng0),
  558. MSM_PIN_FUNCTION(cri_trng1),
  559. MSM_PIN_FUNCTION(cri_trng2),
  560. MSM_PIN_FUNCTION(cri_trng3),
  561. MSM_PIN_FUNCTION(cxc0),
  562. MSM_PIN_FUNCTION(cxc1),
  563. MSM_PIN_FUNCTION(dbg_out),
  564. MSM_PIN_FUNCTION(dwc_ddrphy),
  565. MSM_PIN_FUNCTION(gcc_plltest),
  566. MSM_PIN_FUNCTION(gcc_tlmm),
  567. MSM_PIN_FUNCTION(gpio),
  568. MSM_PIN_FUNCTION(mac),
  569. MSM_PIN_FUNCTION(mdc),
  570. MSM_PIN_FUNCTION(mdio),
  571. MSM_PIN_FUNCTION(pcie0_clk),
  572. MSM_PIN_FUNCTION(pcie0_wake),
  573. MSM_PIN_FUNCTION(pcie1_clk),
  574. MSM_PIN_FUNCTION(pcie1_wake),
  575. MSM_PIN_FUNCTION(pcie2_clk),
  576. MSM_PIN_FUNCTION(pcie2_wake),
  577. MSM_PIN_FUNCTION(pcie3_clk),
  578. MSM_PIN_FUNCTION(pcie3_wake),
  579. MSM_PIN_FUNCTION(prng_rosc0),
  580. MSM_PIN_FUNCTION(prng_rosc1),
  581. MSM_PIN_FUNCTION(prng_rosc2),
  582. MSM_PIN_FUNCTION(prng_rosc3),
  583. MSM_PIN_FUNCTION(pta),
  584. MSM_PIN_FUNCTION(pwm),
  585. MSM_PIN_FUNCTION(qdss_cti_trig_in_a0),
  586. MSM_PIN_FUNCTION(qdss_cti_trig_in_a1),
  587. MSM_PIN_FUNCTION(qdss_cti_trig_in_b0),
  588. MSM_PIN_FUNCTION(qdss_cti_trig_in_b1),
  589. MSM_PIN_FUNCTION(qdss_cti_trig_out_a0),
  590. MSM_PIN_FUNCTION(qdss_cti_trig_out_a1),
  591. MSM_PIN_FUNCTION(qdss_cti_trig_out_b0),
  592. MSM_PIN_FUNCTION(qdss_cti_trig_out_b1),
  593. MSM_PIN_FUNCTION(qdss_traceclk_a),
  594. MSM_PIN_FUNCTION(qdss_traceclk_b),
  595. MSM_PIN_FUNCTION(qdss_tracectl_a),
  596. MSM_PIN_FUNCTION(qdss_tracectl_b),
  597. MSM_PIN_FUNCTION(qdss_tracedata_a),
  598. MSM_PIN_FUNCTION(qdss_tracedata_b),
  599. MSM_PIN_FUNCTION(qspi_data),
  600. MSM_PIN_FUNCTION(qspi_clk),
  601. MSM_PIN_FUNCTION(qspi_cs),
  602. MSM_PIN_FUNCTION(rx0),
  603. MSM_PIN_FUNCTION(rx1),
  604. MSM_PIN_FUNCTION(sdc_data),
  605. MSM_PIN_FUNCTION(sdc_clk),
  606. MSM_PIN_FUNCTION(sdc_cmd),
  607. MSM_PIN_FUNCTION(sdc_rclk),
  608. MSM_PIN_FUNCTION(tsens_max),
  609. MSM_PIN_FUNCTION(wci20),
  610. MSM_PIN_FUNCTION(wci21),
  611. MSM_PIN_FUNCTION(wsa_swrm),
  612. };
  613. static const struct msm_pingroup ipq9574_groups[] = {
  614. PINGROUP(0, sdc_data, qspi_data, qdss_traceclk_b, _, _, _, _, _, _),
  615. PINGROUP(1, sdc_data, qspi_data, qdss_tracectl_b, _, _, _, _, _, _),
  616. PINGROUP(2, sdc_data, qspi_data, qdss_tracedata_b, _, _, _, _, _, _),
  617. PINGROUP(3, sdc_data, qspi_data, qdss_tracedata_b, _, _, _, _, _, _),
  618. PINGROUP(4, sdc_cmd, qspi_cs, qdss_tracedata_b, _, _, _, _, _, _),
  619. PINGROUP(5, sdc_clk, qspi_clk, qdss_tracedata_b, _, _, _, _, _, _),
  620. PINGROUP(6, sdc_data, qdss_tracedata_b, _, _, _, _, _, _, _),
  621. PINGROUP(7, sdc_data, qdss_tracedata_b, _, _, _, _, _, _, _),
  622. PINGROUP(8, sdc_data, qdss_tracedata_b, _, _, _, _, _, _, _),
  623. PINGROUP(9, sdc_data, qdss_tracedata_b, _, _, _, _, _, _, _),
  624. PINGROUP(10, sdc_rclk, qdss_tracedata_b, _, _, _, _, _, _, _),
  625. PINGROUP(11, blsp0_spi, blsp0_uart, qdss_tracedata_b, _, _, _, _, _, _),
  626. PINGROUP(12, blsp0_spi, blsp0_uart, qdss_tracedata_b, _, _, _, _, _, _),
  627. PINGROUP(13, blsp0_spi, blsp0_uart, qdss_tracedata_b, _, _, _, _, _, _),
  628. PINGROUP(14, blsp0_spi, blsp0_uart, qdss_tracedata_b, _, _, _, _, _, _),
  629. PINGROUP(15, blsp3_spi, blsp3_i2c, blsp3_uart, qdss_tracedata_b, _, _, _, _, _),
  630. PINGROUP(16, blsp3_spi, blsp3_i2c, blsp3_uart, qdss_tracedata_b, _, _, _, _, _),
  631. PINGROUP(17, blsp3_spi, blsp3_uart, dbg_out, qdss_tracedata_b, _, _, _, _, _),
  632. PINGROUP(18, blsp3_spi, blsp3_uart, _, _, _, _, _, _, _),
  633. PINGROUP(19, blsp3_spi, _, _, _, _, _, _, _, _),
  634. PINGROUP(20, blsp3_spi, _, cri_trng0, _, _, _, _, _, _),
  635. PINGROUP(21, blsp3_spi, _, cri_trng1, _, _, _, _, _, _),
  636. PINGROUP(22, pcie0_clk, _, pta, _, _, _, _, _, _),
  637. PINGROUP(23, _, pta, wci21, cxc0, _, _, _, _, _),
  638. PINGROUP(24, pcie0_wake, _, pta, wci21, cxc0, _, qdss_cti_trig_out_b0, _, _),
  639. PINGROUP(25, pcie1_clk, _, _, qdss_cti_trig_in_b0, _, _, _, _, _),
  640. PINGROUP(26, _, atest_char0, _, qdss_cti_trig_out_b1, _, _, _, _, _),
  641. PINGROUP(27, pcie1_wake, _, atest_char1, qdss_cti_trig_in_b1, _, _, _, _, _),
  642. PINGROUP(28, pcie2_clk, atest_char2, _, _, _, _, _, _, _),
  643. PINGROUP(29, atest_char3, _, _, _, _, _, _, _, _),
  644. PINGROUP(30, pcie2_wake, pwm, atest_char, _, _, _, _, _, _),
  645. PINGROUP(31, pcie3_clk, pwm, _, qdss_cti_trig_in_a1, _, _, _, _, _),
  646. PINGROUP(32, pwm, _, qdss_cti_trig_out_a1, _, _, _, _, _, _),
  647. PINGROUP(33, pcie3_wake, pwm, _, qdss_cti_trig_in_a0, _, _, _, _, _),
  648. PINGROUP(34, blsp2_uart, blsp2_i2c, blsp2_spi, blsp1_uart, _, cri_trng1, qdss_cti_trig_out_a0, _, _),
  649. PINGROUP(35, blsp2_uart, blsp2_i2c, blsp2_spi, blsp1_uart, _, cri_trng2, _, _, _),
  650. PINGROUP(36, blsp1_uart, blsp1_i2c, blsp2_spi, _, cri_trng3, _, _, _, _),
  651. PINGROUP(37, blsp1_uart, blsp1_i2c, blsp2_spi, _, dwc_ddrphy, _, _, _, _),
  652. PINGROUP(38, mdc, _, cri_trng0, _, _, _, _, _, _),
  653. PINGROUP(39, mdio, _, _, _, _, _, _, _, _),
  654. PINGROUP(40, audio_pri, audio_pdm0, _, _, _, _, _, _, _),
  655. PINGROUP(41, audio_pri, audio_pdm0, _, _, _, _, _, _, _),
  656. PINGROUP(42, audio_pri, audio_pdm0, _, _, _, _, _, _, _),
  657. PINGROUP(43, audio_pri, audio_pdm0, _, qdss_traceclk_a, _, _, _, _, _),
  658. PINGROUP(44, pwm, audio_sec, wsa_swrm, _, qdss_tracectl_a, _, _, _, _),
  659. PINGROUP(45, pwm, audio_sec, wsa_swrm, _, qdss_tracedata_a, _, _, _, _),
  660. PINGROUP(46, pwm, audio_sec, rx1, mac, _, qdss_tracedata_a, _, _, _),
  661. PINGROUP(47, pwm, audio_sec, mac, _, qdss_tracedata_a, _, _, _, _),
  662. PINGROUP(48, blsp5_i2c, blsp5_uart, _, qdss_tracedata_a, _, _, _, _, _),
  663. PINGROUP(49, blsp5_i2c, blsp5_uart, _, qdss_tracedata_a, _, _, _, _, _),
  664. PINGROUP(50, blsp4_uart, blsp4_i2c, blsp4_spi, pwm, qdss_tracedata_a, _, _, _, _),
  665. PINGROUP(51, blsp4_uart, blsp4_i2c, blsp4_spi, pwm, qdss_tracedata_a, _, _, _, _),
  666. PINGROUP(52, blsp4_uart, blsp4_spi, pwm, qdss_tracedata_a, _, _, _, _, _),
  667. PINGROUP(53, blsp4_uart, blsp4_spi, pwm, qdss_tracedata_a, _, _, _, _, _),
  668. PINGROUP(54, pta, pwm, qdss_tracedata_a, _, _, _, _, _, _),
  669. PINGROUP(55, pta, pwm, qdss_tracedata_a, _, _, _, _, _, _),
  670. PINGROUP(56, pta, pwm, qdss_tracedata_a, _, _, _, _, _, _),
  671. PINGROUP(57, wci20, cxc1, mac, pwm, qdss_tracedata_a, _, _, _, _),
  672. PINGROUP(58, wci20, cxc1, mac, pwm, qdss_tracedata_a, _, _, _, _),
  673. PINGROUP(59, rx0, pwm, qdss_tracedata_a, _, _, _, _, _, _),
  674. PINGROUP(60, pwm, prng_rosc0, qdss_tracedata_a, _, gcc_plltest, _, _, _, _),
  675. PINGROUP(61, blsp1_spi, audio_pri, audio_pdm1, audio_pri, pta, prng_rosc1, gcc_tlmm, _, _),
  676. PINGROUP(62, blsp1_spi, audio_sec, audio_pdm1, audio_sec, pta, prng_rosc2, gcc_plltest, _, _),
  677. PINGROUP(63, blsp1_spi, audio_pdm1, pta, prng_rosc3, _, _, _, _, _),
  678. PINGROUP(64, blsp1_spi, audio_pdm1, tsens_max, _, _, _, _, _, _),
  679. };
  680. /* Reserving GPIO59 for controlling the QFPROM LDO regulator */
  681. static const int ipq9574_reserved_gpios[] = {
  682. 59, -1
  683. };
  684. static const struct msm_pinctrl_soc_data ipq9574_pinctrl = {
  685. .pins = ipq9574_pins,
  686. .npins = ARRAY_SIZE(ipq9574_pins),
  687. .functions = ipq9574_functions,
  688. .nfunctions = ARRAY_SIZE(ipq9574_functions),
  689. .groups = ipq9574_groups,
  690. .ngroups = ARRAY_SIZE(ipq9574_groups),
  691. .reserved_gpios = ipq9574_reserved_gpios,
  692. .ngpios = 65,
  693. };
  694. static int ipq9574_pinctrl_probe(struct platform_device *pdev)
  695. {
  696. return msm_pinctrl_probe(pdev, &ipq9574_pinctrl);
  697. }
  698. static const struct of_device_id ipq9574_pinctrl_of_match[] = {
  699. { .compatible = "qcom,ipq9574-tlmm", },
  700. { }
  701. };
  702. MODULE_DEVICE_TABLE(of, ipq9574_pinctrl_of_match);
  703. static struct platform_driver ipq9574_pinctrl_driver = {
  704. .driver = {
  705. .name = "ipq9574-tlmm",
  706. .of_match_table = ipq9574_pinctrl_of_match,
  707. },
  708. .probe = ipq9574_pinctrl_probe,
  709. .remove_new = msm_pinctrl_remove,
  710. };
  711. static int __init ipq9574_pinctrl_init(void)
  712. {
  713. return platform_driver_register(&ipq9574_pinctrl_driver);
  714. }
  715. arch_initcall(ipq9574_pinctrl_init);
  716. static void __exit ipq9574_pinctrl_exit(void)
  717. {
  718. platform_driver_unregister(&ipq9574_pinctrl_driver);
  719. }
  720. module_exit(ipq9574_pinctrl_exit);
  721. MODULE_DESCRIPTION("QTI IPQ9574 TLMM driver");
  722. MODULE_LICENSE("GPL");