pinctrl-ipq8064.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2014, 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. static const struct pinctrl_pin_desc ipq8064_pins[] = {
  10. PINCTRL_PIN(0, "GPIO_0"),
  11. PINCTRL_PIN(1, "GPIO_1"),
  12. PINCTRL_PIN(2, "GPIO_2"),
  13. PINCTRL_PIN(3, "GPIO_3"),
  14. PINCTRL_PIN(4, "GPIO_4"),
  15. PINCTRL_PIN(5, "GPIO_5"),
  16. PINCTRL_PIN(6, "GPIO_6"),
  17. PINCTRL_PIN(7, "GPIO_7"),
  18. PINCTRL_PIN(8, "GPIO_8"),
  19. PINCTRL_PIN(9, "GPIO_9"),
  20. PINCTRL_PIN(10, "GPIO_10"),
  21. PINCTRL_PIN(11, "GPIO_11"),
  22. PINCTRL_PIN(12, "GPIO_12"),
  23. PINCTRL_PIN(13, "GPIO_13"),
  24. PINCTRL_PIN(14, "GPIO_14"),
  25. PINCTRL_PIN(15, "GPIO_15"),
  26. PINCTRL_PIN(16, "GPIO_16"),
  27. PINCTRL_PIN(17, "GPIO_17"),
  28. PINCTRL_PIN(18, "GPIO_18"),
  29. PINCTRL_PIN(19, "GPIO_19"),
  30. PINCTRL_PIN(20, "GPIO_20"),
  31. PINCTRL_PIN(21, "GPIO_21"),
  32. PINCTRL_PIN(22, "GPIO_22"),
  33. PINCTRL_PIN(23, "GPIO_23"),
  34. PINCTRL_PIN(24, "GPIO_24"),
  35. PINCTRL_PIN(25, "GPIO_25"),
  36. PINCTRL_PIN(26, "GPIO_26"),
  37. PINCTRL_PIN(27, "GPIO_27"),
  38. PINCTRL_PIN(28, "GPIO_28"),
  39. PINCTRL_PIN(29, "GPIO_29"),
  40. PINCTRL_PIN(30, "GPIO_30"),
  41. PINCTRL_PIN(31, "GPIO_31"),
  42. PINCTRL_PIN(32, "GPIO_32"),
  43. PINCTRL_PIN(33, "GPIO_33"),
  44. PINCTRL_PIN(34, "GPIO_34"),
  45. PINCTRL_PIN(35, "GPIO_35"),
  46. PINCTRL_PIN(36, "GPIO_36"),
  47. PINCTRL_PIN(37, "GPIO_37"),
  48. PINCTRL_PIN(38, "GPIO_38"),
  49. PINCTRL_PIN(39, "GPIO_39"),
  50. PINCTRL_PIN(40, "GPIO_40"),
  51. PINCTRL_PIN(41, "GPIO_41"),
  52. PINCTRL_PIN(42, "GPIO_42"),
  53. PINCTRL_PIN(43, "GPIO_43"),
  54. PINCTRL_PIN(44, "GPIO_44"),
  55. PINCTRL_PIN(45, "GPIO_45"),
  56. PINCTRL_PIN(46, "GPIO_46"),
  57. PINCTRL_PIN(47, "GPIO_47"),
  58. PINCTRL_PIN(48, "GPIO_48"),
  59. PINCTRL_PIN(49, "GPIO_49"),
  60. PINCTRL_PIN(50, "GPIO_50"),
  61. PINCTRL_PIN(51, "GPIO_51"),
  62. PINCTRL_PIN(52, "GPIO_52"),
  63. PINCTRL_PIN(53, "GPIO_53"),
  64. PINCTRL_PIN(54, "GPIO_54"),
  65. PINCTRL_PIN(55, "GPIO_55"),
  66. PINCTRL_PIN(56, "GPIO_56"),
  67. PINCTRL_PIN(57, "GPIO_57"),
  68. PINCTRL_PIN(58, "GPIO_58"),
  69. PINCTRL_PIN(59, "GPIO_59"),
  70. PINCTRL_PIN(60, "GPIO_60"),
  71. PINCTRL_PIN(61, "GPIO_61"),
  72. PINCTRL_PIN(62, "GPIO_62"),
  73. PINCTRL_PIN(63, "GPIO_63"),
  74. PINCTRL_PIN(64, "GPIO_64"),
  75. PINCTRL_PIN(65, "GPIO_65"),
  76. PINCTRL_PIN(66, "GPIO_66"),
  77. PINCTRL_PIN(67, "GPIO_67"),
  78. PINCTRL_PIN(68, "GPIO_68"),
  79. PINCTRL_PIN(69, "SDC3_CLK"),
  80. PINCTRL_PIN(70, "SDC3_CMD"),
  81. PINCTRL_PIN(71, "SDC3_DATA"),
  82. };
  83. #define DECLARE_IPQ_GPIO_PINS(pin) static const unsigned int gpio##pin##_pins[] = { pin }
  84. DECLARE_IPQ_GPIO_PINS(0);
  85. DECLARE_IPQ_GPIO_PINS(1);
  86. DECLARE_IPQ_GPIO_PINS(2);
  87. DECLARE_IPQ_GPIO_PINS(3);
  88. DECLARE_IPQ_GPIO_PINS(4);
  89. DECLARE_IPQ_GPIO_PINS(5);
  90. DECLARE_IPQ_GPIO_PINS(6);
  91. DECLARE_IPQ_GPIO_PINS(7);
  92. DECLARE_IPQ_GPIO_PINS(8);
  93. DECLARE_IPQ_GPIO_PINS(9);
  94. DECLARE_IPQ_GPIO_PINS(10);
  95. DECLARE_IPQ_GPIO_PINS(11);
  96. DECLARE_IPQ_GPIO_PINS(12);
  97. DECLARE_IPQ_GPIO_PINS(13);
  98. DECLARE_IPQ_GPIO_PINS(14);
  99. DECLARE_IPQ_GPIO_PINS(15);
  100. DECLARE_IPQ_GPIO_PINS(16);
  101. DECLARE_IPQ_GPIO_PINS(17);
  102. DECLARE_IPQ_GPIO_PINS(18);
  103. DECLARE_IPQ_GPIO_PINS(19);
  104. DECLARE_IPQ_GPIO_PINS(20);
  105. DECLARE_IPQ_GPIO_PINS(21);
  106. DECLARE_IPQ_GPIO_PINS(22);
  107. DECLARE_IPQ_GPIO_PINS(23);
  108. DECLARE_IPQ_GPIO_PINS(24);
  109. DECLARE_IPQ_GPIO_PINS(25);
  110. DECLARE_IPQ_GPIO_PINS(26);
  111. DECLARE_IPQ_GPIO_PINS(27);
  112. DECLARE_IPQ_GPIO_PINS(28);
  113. DECLARE_IPQ_GPIO_PINS(29);
  114. DECLARE_IPQ_GPIO_PINS(30);
  115. DECLARE_IPQ_GPIO_PINS(31);
  116. DECLARE_IPQ_GPIO_PINS(32);
  117. DECLARE_IPQ_GPIO_PINS(33);
  118. DECLARE_IPQ_GPIO_PINS(34);
  119. DECLARE_IPQ_GPIO_PINS(35);
  120. DECLARE_IPQ_GPIO_PINS(36);
  121. DECLARE_IPQ_GPIO_PINS(37);
  122. DECLARE_IPQ_GPIO_PINS(38);
  123. DECLARE_IPQ_GPIO_PINS(39);
  124. DECLARE_IPQ_GPIO_PINS(40);
  125. DECLARE_IPQ_GPIO_PINS(41);
  126. DECLARE_IPQ_GPIO_PINS(42);
  127. DECLARE_IPQ_GPIO_PINS(43);
  128. DECLARE_IPQ_GPIO_PINS(44);
  129. DECLARE_IPQ_GPIO_PINS(45);
  130. DECLARE_IPQ_GPIO_PINS(46);
  131. DECLARE_IPQ_GPIO_PINS(47);
  132. DECLARE_IPQ_GPIO_PINS(48);
  133. DECLARE_IPQ_GPIO_PINS(49);
  134. DECLARE_IPQ_GPIO_PINS(50);
  135. DECLARE_IPQ_GPIO_PINS(51);
  136. DECLARE_IPQ_GPIO_PINS(52);
  137. DECLARE_IPQ_GPIO_PINS(53);
  138. DECLARE_IPQ_GPIO_PINS(54);
  139. DECLARE_IPQ_GPIO_PINS(55);
  140. DECLARE_IPQ_GPIO_PINS(56);
  141. DECLARE_IPQ_GPIO_PINS(57);
  142. DECLARE_IPQ_GPIO_PINS(58);
  143. DECLARE_IPQ_GPIO_PINS(59);
  144. DECLARE_IPQ_GPIO_PINS(60);
  145. DECLARE_IPQ_GPIO_PINS(61);
  146. DECLARE_IPQ_GPIO_PINS(62);
  147. DECLARE_IPQ_GPIO_PINS(63);
  148. DECLARE_IPQ_GPIO_PINS(64);
  149. DECLARE_IPQ_GPIO_PINS(65);
  150. DECLARE_IPQ_GPIO_PINS(66);
  151. DECLARE_IPQ_GPIO_PINS(67);
  152. DECLARE_IPQ_GPIO_PINS(68);
  153. static const unsigned int sdc3_clk_pins[] = { 69 };
  154. static const unsigned int sdc3_cmd_pins[] = { 70 };
  155. static const unsigned int sdc3_data_pins[] = { 71 };
  156. #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10) \
  157. { \
  158. .grp = PINCTRL_PINGROUP("gpio" #id, \
  159. gpio##id##_pins, \
  160. ARRAY_SIZE(gpio##id##_pins)), \
  161. .funcs = (int[]){ \
  162. IPQ_MUX_gpio, \
  163. IPQ_MUX_##f1, \
  164. IPQ_MUX_##f2, \
  165. IPQ_MUX_##f3, \
  166. IPQ_MUX_##f4, \
  167. IPQ_MUX_##f5, \
  168. IPQ_MUX_##f6, \
  169. IPQ_MUX_##f7, \
  170. IPQ_MUX_##f8, \
  171. IPQ_MUX_##f9, \
  172. IPQ_MUX_##f10, \
  173. }, \
  174. .nfuncs = 11, \
  175. .ctl_reg = 0x1000 + 0x10 * id, \
  176. .io_reg = 0x1004 + 0x10 * id, \
  177. .intr_cfg_reg = 0x1008 + 0x10 * id, \
  178. .intr_status_reg = 0x100c + 0x10 * id, \
  179. .intr_target_reg = 0x400 + 0x4 * id, \
  180. .mux_bit = 2, \
  181. .pull_bit = 0, \
  182. .drv_bit = 6, \
  183. .oe_bit = 9, \
  184. .in_bit = 0, \
  185. .out_bit = 1, \
  186. .intr_enable_bit = 0, \
  187. .intr_status_bit = 0, \
  188. .intr_ack_high = 1, \
  189. .intr_target_bit = 0, \
  190. .intr_target_kpss_val = 4, \
  191. .intr_raw_status_bit = 3, \
  192. .intr_polarity_bit = 1, \
  193. .intr_detection_bit = 2, \
  194. .intr_detection_width = 1, \
  195. }
  196. #define SDC_PINGROUP(pg_name, ctl, pull, drv) \
  197. { \
  198. .grp = PINCTRL_PINGROUP(#pg_name, \
  199. pg_name##_pins, \
  200. ARRAY_SIZE(pg_name##_pins)), \
  201. .ctl_reg = ctl, \
  202. .io_reg = 0, \
  203. .intr_cfg_reg = 0, \
  204. .intr_status_reg = 0, \
  205. .intr_target_reg = 0, \
  206. .mux_bit = -1, \
  207. .pull_bit = pull, \
  208. .drv_bit = drv, \
  209. .oe_bit = -1, \
  210. .in_bit = -1, \
  211. .out_bit = -1, \
  212. .intr_enable_bit = -1, \
  213. .intr_status_bit = -1, \
  214. .intr_target_bit = -1, \
  215. .intr_target_kpss_val = -1, \
  216. .intr_raw_status_bit = -1, \
  217. .intr_polarity_bit = -1, \
  218. .intr_detection_bit = -1, \
  219. .intr_detection_width = -1, \
  220. }
  221. enum ipq8064_functions {
  222. IPQ_MUX_gpio,
  223. IPQ_MUX_mdio,
  224. IPQ_MUX_mi2s,
  225. IPQ_MUX_pdm,
  226. IPQ_MUX_ssbi,
  227. IPQ_MUX_spmi,
  228. IPQ_MUX_audio_pcm,
  229. IPQ_MUX_gsbi1,
  230. IPQ_MUX_gsbi2,
  231. IPQ_MUX_gsbi4,
  232. IPQ_MUX_gsbi5,
  233. IPQ_MUX_gsbi5_spi_cs1,
  234. IPQ_MUX_gsbi5_spi_cs2,
  235. IPQ_MUX_gsbi5_spi_cs3,
  236. IPQ_MUX_gsbi6,
  237. IPQ_MUX_gsbi7,
  238. IPQ_MUX_nss_spi,
  239. IPQ_MUX_sdc1,
  240. IPQ_MUX_spdif,
  241. IPQ_MUX_nand,
  242. IPQ_MUX_tsif1,
  243. IPQ_MUX_tsif2,
  244. IPQ_MUX_usb_fs_n,
  245. IPQ_MUX_usb_fs,
  246. IPQ_MUX_usb2_hsic,
  247. IPQ_MUX_rgmii2,
  248. IPQ_MUX_sata,
  249. IPQ_MUX_pcie1_rst,
  250. IPQ_MUX_pcie1_prsnt,
  251. IPQ_MUX_pcie1_pwrflt,
  252. IPQ_MUX_pcie1_pwren_n,
  253. IPQ_MUX_pcie1_pwren,
  254. IPQ_MUX_pcie1_clk_req,
  255. IPQ_MUX_pcie2_rst,
  256. IPQ_MUX_pcie2_prsnt,
  257. IPQ_MUX_pcie2_pwrflt,
  258. IPQ_MUX_pcie2_pwren_n,
  259. IPQ_MUX_pcie2_pwren,
  260. IPQ_MUX_pcie2_clk_req,
  261. IPQ_MUX_pcie3_rst,
  262. IPQ_MUX_pcie3_prsnt,
  263. IPQ_MUX_pcie3_pwrflt,
  264. IPQ_MUX_pcie3_pwren_n,
  265. IPQ_MUX_pcie3_pwren,
  266. IPQ_MUX_pcie3_clk_req,
  267. IPQ_MUX_ps_hold,
  268. IPQ_MUX_NA,
  269. };
  270. static const char * const gpio_groups[] = {
  271. "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7",
  272. "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14",
  273. "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21",
  274. "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28",
  275. "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
  276. "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
  277. "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
  278. "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
  279. "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
  280. "gpio64", "gpio65", "gpio66", "gpio67", "gpio68"
  281. };
  282. static const char * const mdio_groups[] = {
  283. "gpio0", "gpio1", "gpio2", "gpio10", "gpio11", "gpio66",
  284. };
  285. static const char * const mi2s_groups[] = {
  286. "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32",
  287. "gpio33", "gpio55", "gpio56", "gpio57", "gpio58",
  288. };
  289. static const char * const pdm_groups[] = {
  290. "gpio3", "gpio16", "gpio17", "gpio22", "gpio30", "gpio31",
  291. "gpio34", "gpio35", "gpio52", "gpio55", "gpio56", "gpio58",
  292. "gpio59",
  293. };
  294. static const char * const ssbi_groups[] = {
  295. "gpio10", "gpio11",
  296. };
  297. static const char * const spmi_groups[] = {
  298. "gpio10", "gpio11",
  299. };
  300. static const char * const audio_pcm_groups[] = {
  301. "gpio14", "gpio15", "gpio16", "gpio17",
  302. };
  303. static const char * const gsbi1_groups[] = {
  304. "gpio51", "gpio52", "gpio53", "gpio54",
  305. };
  306. static const char * const gsbi2_groups[] = {
  307. "gpio22", "gpio23", "gpio24", "gpio25",
  308. };
  309. static const char * const gsbi4_groups[] = {
  310. "gpio10", "gpio11", "gpio12", "gpio13",
  311. };
  312. static const char * const gsbi5_groups[] = {
  313. "gpio18", "gpio19", "gpio20", "gpio21",
  314. };
  315. static const char * const gsbi5_spi_cs1_groups[] = {
  316. "gpio6", "gpio61",
  317. };
  318. static const char * const gsbi5_spi_cs2_groups[] = {
  319. "gpio7", "gpio62",
  320. };
  321. static const char * const gsbi5_spi_cs3_groups[] = {
  322. "gpio2",
  323. };
  324. static const char * const gsbi6_groups[] = {
  325. "gpio27", "gpio28", "gpio29", "gpio30", "gpio55", "gpio56",
  326. "gpio57", "gpio58",
  327. };
  328. static const char * const gsbi7_groups[] = {
  329. "gpio6", "gpio7", "gpio8", "gpio9",
  330. };
  331. static const char * const nss_spi_groups[] = {
  332. "gpio14", "gpio15", "gpio16", "gpio17", "gpio55", "gpio56",
  333. "gpio57", "gpio58",
  334. };
  335. static const char * const sdc1_groups[] = {
  336. "gpio38", "gpio39", "gpio40", "gpio41", "gpio42", "gpio43",
  337. "gpio44", "gpio45", "gpio46", "gpio47",
  338. };
  339. static const char * const spdif_groups[] = {
  340. "gpio10", "gpio48",
  341. };
  342. static const char * const nand_groups[] = {
  343. "gpio34", "gpio35", "gpio36", "gpio37", "gpio38", "gpio39",
  344. "gpio40", "gpio41", "gpio42", "gpio43", "gpio44", "gpio45",
  345. "gpio46", "gpio47",
  346. };
  347. static const char * const tsif1_groups[] = {
  348. "gpio55", "gpio56", "gpio57", "gpio58",
  349. };
  350. static const char * const tsif2_groups[] = {
  351. "gpio59", "gpio60", "gpio61", "gpio62",
  352. };
  353. static const char * const usb_fs_n_groups[] = {
  354. "gpio6",
  355. };
  356. static const char * const usb_fs_groups[] = {
  357. "gpio6", "gpio7", "gpio8",
  358. };
  359. static const char * const usb2_hsic_groups[] = {
  360. "gpio67", "gpio68",
  361. };
  362. static const char * const rgmii2_groups[] = {
  363. "gpio2", "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32",
  364. "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62", "gpio66",
  365. };
  366. static const char * const sata_groups[] = {
  367. "gpio10",
  368. };
  369. static const char * const pcie1_rst_groups[] = {
  370. "gpio3",
  371. };
  372. static const char * const pcie1_prsnt_groups[] = {
  373. "gpio3", "gpio11",
  374. };
  375. static const char * const pcie1_pwren_n_groups[] = {
  376. "gpio4", "gpio12",
  377. };
  378. static const char * const pcie1_pwren_groups[] = {
  379. "gpio4", "gpio12",
  380. };
  381. static const char * const pcie1_pwrflt_groups[] = {
  382. "gpio5", "gpio13",
  383. };
  384. static const char * const pcie1_clk_req_groups[] = {
  385. "gpio5",
  386. };
  387. static const char * const pcie2_rst_groups[] = {
  388. "gpio48",
  389. };
  390. static const char * const pcie2_prsnt_groups[] = {
  391. "gpio11", "gpio48",
  392. };
  393. static const char * const pcie2_pwren_n_groups[] = {
  394. "gpio12", "gpio49",
  395. };
  396. static const char * const pcie2_pwren_groups[] = {
  397. "gpio12", "gpio49",
  398. };
  399. static const char * const pcie2_pwrflt_groups[] = {
  400. "gpio13", "gpio50",
  401. };
  402. static const char * const pcie2_clk_req_groups[] = {
  403. "gpio50",
  404. };
  405. static const char * const pcie3_rst_groups[] = {
  406. "gpio63",
  407. };
  408. static const char * const pcie3_prsnt_groups[] = {
  409. "gpio11",
  410. };
  411. static const char * const pcie3_pwren_n_groups[] = {
  412. "gpio12",
  413. };
  414. static const char * const pcie3_pwren_groups[] = {
  415. "gpio12",
  416. };
  417. static const char * const pcie3_pwrflt_groups[] = {
  418. "gpio13",
  419. };
  420. static const char * const pcie3_clk_req_groups[] = {
  421. "gpio65",
  422. };
  423. static const char * const ps_hold_groups[] = {
  424. "gpio26",
  425. };
  426. static const struct pinfunction ipq8064_functions[] = {
  427. IPQ_PIN_FUNCTION(gpio),
  428. IPQ_PIN_FUNCTION(mdio),
  429. IPQ_PIN_FUNCTION(ssbi),
  430. IPQ_PIN_FUNCTION(spmi),
  431. IPQ_PIN_FUNCTION(mi2s),
  432. IPQ_PIN_FUNCTION(pdm),
  433. IPQ_PIN_FUNCTION(audio_pcm),
  434. IPQ_PIN_FUNCTION(gsbi1),
  435. IPQ_PIN_FUNCTION(gsbi2),
  436. IPQ_PIN_FUNCTION(gsbi4),
  437. IPQ_PIN_FUNCTION(gsbi5),
  438. IPQ_PIN_FUNCTION(gsbi5_spi_cs1),
  439. IPQ_PIN_FUNCTION(gsbi5_spi_cs2),
  440. IPQ_PIN_FUNCTION(gsbi5_spi_cs3),
  441. IPQ_PIN_FUNCTION(gsbi6),
  442. IPQ_PIN_FUNCTION(gsbi7),
  443. IPQ_PIN_FUNCTION(nss_spi),
  444. IPQ_PIN_FUNCTION(sdc1),
  445. IPQ_PIN_FUNCTION(spdif),
  446. IPQ_PIN_FUNCTION(nand),
  447. IPQ_PIN_FUNCTION(tsif1),
  448. IPQ_PIN_FUNCTION(tsif2),
  449. IPQ_PIN_FUNCTION(usb_fs_n),
  450. IPQ_PIN_FUNCTION(usb_fs),
  451. IPQ_PIN_FUNCTION(usb2_hsic),
  452. IPQ_PIN_FUNCTION(rgmii2),
  453. IPQ_PIN_FUNCTION(sata),
  454. IPQ_PIN_FUNCTION(pcie1_rst),
  455. IPQ_PIN_FUNCTION(pcie1_prsnt),
  456. IPQ_PIN_FUNCTION(pcie1_pwren_n),
  457. IPQ_PIN_FUNCTION(pcie1_pwren),
  458. IPQ_PIN_FUNCTION(pcie1_pwrflt),
  459. IPQ_PIN_FUNCTION(pcie1_clk_req),
  460. IPQ_PIN_FUNCTION(pcie2_rst),
  461. IPQ_PIN_FUNCTION(pcie2_prsnt),
  462. IPQ_PIN_FUNCTION(pcie2_pwren_n),
  463. IPQ_PIN_FUNCTION(pcie2_pwren),
  464. IPQ_PIN_FUNCTION(pcie2_pwrflt),
  465. IPQ_PIN_FUNCTION(pcie2_clk_req),
  466. IPQ_PIN_FUNCTION(pcie3_rst),
  467. IPQ_PIN_FUNCTION(pcie3_prsnt),
  468. IPQ_PIN_FUNCTION(pcie3_pwren_n),
  469. IPQ_PIN_FUNCTION(pcie3_pwren),
  470. IPQ_PIN_FUNCTION(pcie3_pwrflt),
  471. IPQ_PIN_FUNCTION(pcie3_clk_req),
  472. IPQ_PIN_FUNCTION(ps_hold),
  473. };
  474. static const struct msm_pingroup ipq8064_groups[] = {
  475. PINGROUP(0, mdio, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  476. PINGROUP(1, mdio, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  477. PINGROUP(2, gsbi5_spi_cs3, rgmii2, mdio, NA, NA, NA, NA, NA, NA, NA),
  478. PINGROUP(3, pcie1_rst, pcie1_prsnt, pdm, NA, NA, NA, NA, NA, NA, NA),
  479. PINGROUP(4, pcie1_pwren_n, pcie1_pwren, NA, NA, NA, NA, NA, NA, NA, NA),
  480. PINGROUP(5, pcie1_clk_req, pcie1_pwrflt, NA, NA, NA, NA, NA, NA, NA, NA),
  481. PINGROUP(6, gsbi7, usb_fs, gsbi5_spi_cs1, usb_fs_n, NA, NA, NA, NA, NA, NA),
  482. PINGROUP(7, gsbi7, usb_fs, gsbi5_spi_cs2, NA, NA, NA, NA, NA, NA, NA),
  483. PINGROUP(8, gsbi7, usb_fs, NA, NA, NA, NA, NA, NA, NA, NA),
  484. PINGROUP(9, gsbi7, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  485. PINGROUP(10, gsbi4, spdif, sata, ssbi, mdio, spmi, NA, NA, NA, NA),
  486. PINGROUP(11, gsbi4, pcie2_prsnt, pcie1_prsnt, pcie3_prsnt, ssbi, mdio, spmi, NA, NA, NA),
  487. PINGROUP(12, gsbi4, pcie2_pwren_n, pcie1_pwren_n, pcie3_pwren_n, pcie2_pwren, pcie1_pwren, pcie3_pwren, NA, NA, NA),
  488. PINGROUP(13, gsbi4, pcie2_pwrflt, pcie1_pwrflt, pcie3_pwrflt, NA, NA, NA, NA, NA, NA),
  489. PINGROUP(14, audio_pcm, nss_spi, NA, NA, NA, NA, NA, NA, NA, NA),
  490. PINGROUP(15, audio_pcm, nss_spi, NA, NA, NA, NA, NA, NA, NA, NA),
  491. PINGROUP(16, audio_pcm, nss_spi, pdm, NA, NA, NA, NA, NA, NA, NA),
  492. PINGROUP(17, audio_pcm, nss_spi, pdm, NA, NA, NA, NA, NA, NA, NA),
  493. PINGROUP(18, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  494. PINGROUP(19, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  495. PINGROUP(20, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  496. PINGROUP(21, gsbi5, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  497. PINGROUP(22, gsbi2, pdm, NA, NA, NA, NA, NA, NA, NA, NA),
  498. PINGROUP(23, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  499. PINGROUP(24, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  500. PINGROUP(25, gsbi2, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  501. PINGROUP(26, ps_hold, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  502. PINGROUP(27, mi2s, rgmii2, gsbi6, NA, NA, NA, NA, NA, NA, NA),
  503. PINGROUP(28, mi2s, rgmii2, gsbi6, NA, NA, NA, NA, NA, NA, NA),
  504. PINGROUP(29, mi2s, rgmii2, gsbi6, NA, NA, NA, NA, NA, NA, NA),
  505. PINGROUP(30, mi2s, rgmii2, gsbi6, pdm, NA, NA, NA, NA, NA, NA),
  506. PINGROUP(31, mi2s, rgmii2, pdm, NA, NA, NA, NA, NA, NA, NA),
  507. PINGROUP(32, mi2s, rgmii2, NA, NA, NA, NA, NA, NA, NA, NA),
  508. PINGROUP(33, mi2s, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  509. PINGROUP(34, nand, pdm, NA, NA, NA, NA, NA, NA, NA, NA),
  510. PINGROUP(35, nand, pdm, NA, NA, NA, NA, NA, NA, NA, NA),
  511. PINGROUP(36, nand, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  512. PINGROUP(37, nand, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  513. PINGROUP(38, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  514. PINGROUP(39, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  515. PINGROUP(40, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  516. PINGROUP(41, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  517. PINGROUP(42, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  518. PINGROUP(43, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  519. PINGROUP(44, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  520. PINGROUP(45, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  521. PINGROUP(46, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  522. PINGROUP(47, nand, sdc1, NA, NA, NA, NA, NA, NA, NA, NA),
  523. PINGROUP(48, pcie2_rst, spdif, NA, NA, NA, NA, NA, NA, NA, NA),
  524. PINGROUP(49, pcie2_pwren_n, pcie2_pwren, NA, NA, NA, NA, NA, NA, NA, NA),
  525. PINGROUP(50, pcie2_clk_req, pcie2_pwrflt, NA, NA, NA, NA, NA, NA, NA, NA),
  526. PINGROUP(51, gsbi1, rgmii2, NA, NA, NA, NA, NA, NA, NA, NA),
  527. PINGROUP(52, gsbi1, rgmii2, pdm, NA, NA, NA, NA, NA, NA, NA),
  528. PINGROUP(53, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  529. PINGROUP(54, gsbi1, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  530. PINGROUP(55, tsif1, mi2s, gsbi6, pdm, nss_spi, NA, NA, NA, NA, NA),
  531. PINGROUP(56, tsif1, mi2s, gsbi6, pdm, nss_spi, NA, NA, NA, NA, NA),
  532. PINGROUP(57, tsif1, mi2s, gsbi6, nss_spi, NA, NA, NA, NA, NA, NA),
  533. PINGROUP(58, tsif1, mi2s, gsbi6, pdm, nss_spi, NA, NA, NA, NA, NA),
  534. PINGROUP(59, tsif2, rgmii2, pdm, NA, NA, NA, NA, NA, NA, NA),
  535. PINGROUP(60, tsif2, rgmii2, NA, NA, NA, NA, NA, NA, NA, NA),
  536. PINGROUP(61, tsif2, rgmii2, gsbi5_spi_cs1, NA, NA, NA, NA, NA, NA, NA),
  537. PINGROUP(62, tsif2, rgmii2, gsbi5_spi_cs2, NA, NA, NA, NA, NA, NA, NA),
  538. PINGROUP(63, pcie3_rst, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  539. PINGROUP(64, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  540. PINGROUP(65, pcie3_clk_req, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  541. PINGROUP(66, rgmii2, mdio, NA, NA, NA, NA, NA, NA, NA, NA),
  542. PINGROUP(67, usb2_hsic, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  543. PINGROUP(68, usb2_hsic, NA, NA, NA, NA, NA, NA, NA, NA, NA),
  544. SDC_PINGROUP(sdc3_clk, 0x204a, 14, 6),
  545. SDC_PINGROUP(sdc3_cmd, 0x204a, 11, 3),
  546. SDC_PINGROUP(sdc3_data, 0x204a, 9, 0),
  547. };
  548. #define NUM_GPIO_PINGROUPS 69
  549. static const struct msm_pinctrl_soc_data ipq8064_pinctrl = {
  550. .pins = ipq8064_pins,
  551. .npins = ARRAY_SIZE(ipq8064_pins),
  552. .functions = ipq8064_functions,
  553. .nfunctions = ARRAY_SIZE(ipq8064_functions),
  554. .groups = ipq8064_groups,
  555. .ngroups = ARRAY_SIZE(ipq8064_groups),
  556. .ngpios = NUM_GPIO_PINGROUPS,
  557. };
  558. static int ipq8064_pinctrl_probe(struct platform_device *pdev)
  559. {
  560. return msm_pinctrl_probe(pdev, &ipq8064_pinctrl);
  561. }
  562. static const struct of_device_id ipq8064_pinctrl_of_match[] = {
  563. { .compatible = "qcom,ipq8064-pinctrl", },
  564. { },
  565. };
  566. static struct platform_driver ipq8064_pinctrl_driver = {
  567. .driver = {
  568. .name = "ipq8064-pinctrl",
  569. .of_match_table = ipq8064_pinctrl_of_match,
  570. },
  571. .probe = ipq8064_pinctrl_probe,
  572. .remove_new = msm_pinctrl_remove,
  573. };
  574. static int __init ipq8064_pinctrl_init(void)
  575. {
  576. return platform_driver_register(&ipq8064_pinctrl_driver);
  577. }
  578. arch_initcall(ipq8064_pinctrl_init);
  579. static void __exit ipq8064_pinctrl_exit(void)
  580. {
  581. platform_driver_unregister(&ipq8064_pinctrl_driver);
  582. }
  583. module_exit(ipq8064_pinctrl_exit);
  584. MODULE_AUTHOR("Andy Gross <agross@codeaurora.org>");
  585. MODULE_DESCRIPTION("Qualcomm IPQ8064 pinctrl driver");
  586. MODULE_LICENSE("GPL v2");
  587. MODULE_DEVICE_TABLE(of, ipq8064_pinctrl_of_match);