pinctrl-ipq8064.c 19 KB

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