pinctrl-sunrisepoint.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /*
  2. * Intel Sunrisepoint PCH pinctrl/GPIO driver
  3. *
  4. * Copyright (C) 2015, Intel Corporation
  5. * Authors: Mathias Nyman <mathias.nyman@linux.intel.com>
  6. * Mika Westerberg <mika.westerberg@linux.intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/acpi.h>
  13. #include <linux/module.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/pm.h>
  16. #include <linux/pinctrl/pinctrl.h>
  17. #include "pinctrl-intel.h"
  18. #define SPT_PAD_OWN 0x020
  19. #define SPT_PADCFGLOCK 0x0a0
  20. #define SPT_HOSTSW_OWN 0x0d0
  21. #define SPT_GPI_IE 0x120
  22. #define SPT_COMMUNITY(b, s, e) \
  23. { \
  24. .barno = (b), \
  25. .padown_offset = SPT_PAD_OWN, \
  26. .padcfglock_offset = SPT_PADCFGLOCK, \
  27. .hostown_offset = SPT_HOSTSW_OWN, \
  28. .ie_offset = SPT_GPI_IE, \
  29. .gpp_size = 24, \
  30. .gpp_num_padown_regs = 4, \
  31. .pin_base = (s), \
  32. .npins = ((e) - (s) + 1), \
  33. }
  34. /* Sunrisepoint-LP */
  35. static const struct pinctrl_pin_desc sptlp_pins[] = {
  36. /* GPP_A */
  37. PINCTRL_PIN(0, "RCINB"),
  38. PINCTRL_PIN(1, "LAD_0"),
  39. PINCTRL_PIN(2, "LAD_1"),
  40. PINCTRL_PIN(3, "LAD_2"),
  41. PINCTRL_PIN(4, "LAD_3"),
  42. PINCTRL_PIN(5, "LFRAMEB"),
  43. PINCTRL_PIN(6, "SERIQ"),
  44. PINCTRL_PIN(7, "PIRQAB"),
  45. PINCTRL_PIN(8, "CLKRUNB"),
  46. PINCTRL_PIN(9, "CLKOUT_LPC_0"),
  47. PINCTRL_PIN(10, "CLKOUT_LPC_1"),
  48. PINCTRL_PIN(11, "PMEB"),
  49. PINCTRL_PIN(12, "BM_BUSYB"),
  50. PINCTRL_PIN(13, "SUSWARNB_SUS_PWRDNACK"),
  51. PINCTRL_PIN(14, "SUS_STATB"),
  52. PINCTRL_PIN(15, "SUSACKB"),
  53. PINCTRL_PIN(16, "SD_1P8_SEL"),
  54. PINCTRL_PIN(17, "SD_PWR_EN_B"),
  55. PINCTRL_PIN(18, "ISH_GP_0"),
  56. PINCTRL_PIN(19, "ISH_GP_1"),
  57. PINCTRL_PIN(20, "ISH_GP_2"),
  58. PINCTRL_PIN(21, "ISH_GP_3"),
  59. PINCTRL_PIN(22, "ISH_GP_4"),
  60. PINCTRL_PIN(23, "ISH_GP_5"),
  61. /* GPP_B */
  62. PINCTRL_PIN(24, "CORE_VID_0"),
  63. PINCTRL_PIN(25, "CORE_VID_1"),
  64. PINCTRL_PIN(26, "VRALERTB"),
  65. PINCTRL_PIN(27, "CPU_GP_2"),
  66. PINCTRL_PIN(28, "CPU_GP_3"),
  67. PINCTRL_PIN(29, "SRCCLKREQB_0"),
  68. PINCTRL_PIN(30, "SRCCLKREQB_1"),
  69. PINCTRL_PIN(31, "SRCCLKREQB_2"),
  70. PINCTRL_PIN(32, "SRCCLKREQB_3"),
  71. PINCTRL_PIN(33, "SRCCLKREQB_4"),
  72. PINCTRL_PIN(34, "SRCCLKREQB_5"),
  73. PINCTRL_PIN(35, "EXT_PWR_GATEB"),
  74. PINCTRL_PIN(36, "SLP_S0B"),
  75. PINCTRL_PIN(37, "PLTRSTB"),
  76. PINCTRL_PIN(38, "SPKR"),
  77. PINCTRL_PIN(39, "GSPI0_CSB"),
  78. PINCTRL_PIN(40, "GSPI0_CLK"),
  79. PINCTRL_PIN(41, "GSPI0_MISO"),
  80. PINCTRL_PIN(42, "GSPI0_MOSI"),
  81. PINCTRL_PIN(43, "GSPI1_CSB"),
  82. PINCTRL_PIN(44, "GSPI1_CLK"),
  83. PINCTRL_PIN(45, "GSPI1_MISO"),
  84. PINCTRL_PIN(46, "GSPI1_MOSI"),
  85. PINCTRL_PIN(47, "SML1ALERTB"),
  86. /* GPP_C */
  87. PINCTRL_PIN(48, "SMBCLK"),
  88. PINCTRL_PIN(49, "SMBDATA"),
  89. PINCTRL_PIN(50, "SMBALERTB"),
  90. PINCTRL_PIN(51, "SML0CLK"),
  91. PINCTRL_PIN(52, "SML0DATA"),
  92. PINCTRL_PIN(53, "SML0ALERTB"),
  93. PINCTRL_PIN(54, "SML1CLK"),
  94. PINCTRL_PIN(55, "SML1DATA"),
  95. PINCTRL_PIN(56, "UART0_RXD"),
  96. PINCTRL_PIN(57, "UART0_TXD"),
  97. PINCTRL_PIN(58, "UART0_RTSB"),
  98. PINCTRL_PIN(59, "UART0_CTSB"),
  99. PINCTRL_PIN(60, "UART1_RXD"),
  100. PINCTRL_PIN(61, "UART1_TXD"),
  101. PINCTRL_PIN(62, "UART1_RTSB"),
  102. PINCTRL_PIN(63, "UART1_CTSB"),
  103. PINCTRL_PIN(64, "I2C0_SDA"),
  104. PINCTRL_PIN(65, "I2C0_SCL"),
  105. PINCTRL_PIN(66, "I2C1_SDA"),
  106. PINCTRL_PIN(67, "I2C1_SCL"),
  107. PINCTRL_PIN(68, "UART2_RXD"),
  108. PINCTRL_PIN(69, "UART2_TXD"),
  109. PINCTRL_PIN(70, "UART2_RTSB"),
  110. PINCTRL_PIN(71, "UART2_CTSB"),
  111. /* GPP_D */
  112. PINCTRL_PIN(72, "SPI1_CSB"),
  113. PINCTRL_PIN(73, "SPI1_CLK"),
  114. PINCTRL_PIN(74, "SPI1_MISO_IO_1"),
  115. PINCTRL_PIN(75, "SPI1_MOSI_IO_0"),
  116. PINCTRL_PIN(76, "FLASHTRIG"),
  117. PINCTRL_PIN(77, "ISH_I2C0_SDA"),
  118. PINCTRL_PIN(78, "ISH_I2C0_SCL"),
  119. PINCTRL_PIN(79, "ISH_I2C1_SDA"),
  120. PINCTRL_PIN(80, "ISH_I2C1_SCL"),
  121. PINCTRL_PIN(81, "ISH_SPI_CSB"),
  122. PINCTRL_PIN(82, "ISH_SPI_CLK"),
  123. PINCTRL_PIN(83, "ISH_SPI_MISO"),
  124. PINCTRL_PIN(84, "ISH_SPI_MOSI"),
  125. PINCTRL_PIN(85, "ISH_UART0_RXD"),
  126. PINCTRL_PIN(86, "ISH_UART0_TXD"),
  127. PINCTRL_PIN(87, "ISH_UART0_RTSB"),
  128. PINCTRL_PIN(88, "ISH_UART0_CTSB"),
  129. PINCTRL_PIN(89, "DMIC_CLK_1"),
  130. PINCTRL_PIN(90, "DMIC_DATA_1"),
  131. PINCTRL_PIN(91, "DMIC_CLK_0"),
  132. PINCTRL_PIN(92, "DMIC_DATA_0"),
  133. PINCTRL_PIN(93, "SPI1_IO_2"),
  134. PINCTRL_PIN(94, "SPI1_IO_3"),
  135. PINCTRL_PIN(95, "SSP_MCLK"),
  136. /* GPP_E */
  137. PINCTRL_PIN(96, "SATAXPCIE_0"),
  138. PINCTRL_PIN(97, "SATAXPCIE_1"),
  139. PINCTRL_PIN(98, "SATAXPCIE_2"),
  140. PINCTRL_PIN(99, "CPU_GP_0"),
  141. PINCTRL_PIN(100, "SATA_DEVSLP_0"),
  142. PINCTRL_PIN(101, "SATA_DEVSLP_1"),
  143. PINCTRL_PIN(102, "SATA_DEVSLP_2"),
  144. PINCTRL_PIN(103, "CPU_GP_1"),
  145. PINCTRL_PIN(104, "SATA_LEDB"),
  146. PINCTRL_PIN(105, "USB2_OCB_0"),
  147. PINCTRL_PIN(106, "USB2_OCB_1"),
  148. PINCTRL_PIN(107, "USB2_OCB_2"),
  149. PINCTRL_PIN(108, "USB2_OCB_3"),
  150. PINCTRL_PIN(109, "DDSP_HPD_0"),
  151. PINCTRL_PIN(110, "DDSP_HPD_1"),
  152. PINCTRL_PIN(111, "DDSP_HPD_2"),
  153. PINCTRL_PIN(112, "DDSP_HPD_3"),
  154. PINCTRL_PIN(113, "EDP_HPD"),
  155. PINCTRL_PIN(114, "DDPB_CTRLCLK"),
  156. PINCTRL_PIN(115, "DDPB_CTRLDATA"),
  157. PINCTRL_PIN(116, "DDPC_CTRLCLK"),
  158. PINCTRL_PIN(117, "DDPC_CTRLDATA"),
  159. PINCTRL_PIN(118, "DDPD_CTRLCLK"),
  160. PINCTRL_PIN(119, "DDPD_CTRLDATA"),
  161. /* GPP_F */
  162. PINCTRL_PIN(120, "SSP2_SCLK"),
  163. PINCTRL_PIN(121, "SSP2_SFRM"),
  164. PINCTRL_PIN(122, "SSP2_TXD"),
  165. PINCTRL_PIN(123, "SSP2_RXD"),
  166. PINCTRL_PIN(124, "I2C2_SDA"),
  167. PINCTRL_PIN(125, "I2C2_SCL"),
  168. PINCTRL_PIN(126, "I2C3_SDA"),
  169. PINCTRL_PIN(127, "I2C3_SCL"),
  170. PINCTRL_PIN(128, "I2C4_SDA"),
  171. PINCTRL_PIN(129, "I2C4_SCL"),
  172. PINCTRL_PIN(130, "I2C5_SDA"),
  173. PINCTRL_PIN(131, "I2C5_SCL"),
  174. PINCTRL_PIN(132, "EMMC_CMD"),
  175. PINCTRL_PIN(133, "EMMC_DATA_0"),
  176. PINCTRL_PIN(134, "EMMC_DATA_1"),
  177. PINCTRL_PIN(135, "EMMC_DATA_2"),
  178. PINCTRL_PIN(136, "EMMC_DATA_3"),
  179. PINCTRL_PIN(137, "EMMC_DATA_4"),
  180. PINCTRL_PIN(138, "EMMC_DATA_5"),
  181. PINCTRL_PIN(139, "EMMC_DATA_6"),
  182. PINCTRL_PIN(140, "EMMC_DATA_7"),
  183. PINCTRL_PIN(141, "EMMC_RCLK"),
  184. PINCTRL_PIN(142, "EMMC_CLK"),
  185. PINCTRL_PIN(143, "GPP_F_23"),
  186. /* GPP_G */
  187. PINCTRL_PIN(144, "SD_CMD"),
  188. PINCTRL_PIN(145, "SD_DATA_0"),
  189. PINCTRL_PIN(146, "SD_DATA_1"),
  190. PINCTRL_PIN(147, "SD_DATA_2"),
  191. PINCTRL_PIN(148, "SD_DATA_3"),
  192. PINCTRL_PIN(149, "SD_CDB"),
  193. PINCTRL_PIN(150, "SD_CLK"),
  194. PINCTRL_PIN(151, "SD_WP"),
  195. };
  196. static const unsigned sptlp_spi0_pins[] = { 39, 40, 41, 42 };
  197. static const unsigned sptlp_spi1_pins[] = { 43, 44, 45, 46 };
  198. static const unsigned sptlp_uart0_pins[] = { 56, 57, 58, 59 };
  199. static const unsigned sptlp_uart1_pins[] = { 60, 61, 62, 63 };
  200. static const unsigned sptlp_uart2_pins[] = { 68, 69, 71, 71 };
  201. static const unsigned sptlp_i2c0_pins[] = { 64, 65 };
  202. static const unsigned sptlp_i2c1_pins[] = { 66, 67 };
  203. static const unsigned sptlp_i2c2_pins[] = { 124, 125 };
  204. static const unsigned sptlp_i2c3_pins[] = { 126, 127 };
  205. static const unsigned sptlp_i2c4_pins[] = { 128, 129 };
  206. static const unsigned sptlp_i2c4b_pins[] = { 85, 86 };
  207. static const unsigned sptlp_i2c5_pins[] = { 130, 131 };
  208. static const unsigned sptlp_ssp2_pins[] = { 120, 121, 122, 123 };
  209. static const unsigned sptlp_emmc_pins[] = {
  210. 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
  211. };
  212. static const unsigned sptlp_sd_pins[] = {
  213. 144, 145, 146, 147, 148, 149, 150, 151,
  214. };
  215. static const struct intel_pingroup sptlp_groups[] = {
  216. PIN_GROUP("spi0_grp", sptlp_spi0_pins, 1),
  217. PIN_GROUP("spi1_grp", sptlp_spi1_pins, 1),
  218. PIN_GROUP("uart0_grp", sptlp_uart0_pins, 1),
  219. PIN_GROUP("uart1_grp", sptlp_uart1_pins, 1),
  220. PIN_GROUP("uart2_grp", sptlp_uart2_pins, 1),
  221. PIN_GROUP("i2c0_grp", sptlp_i2c0_pins, 1),
  222. PIN_GROUP("i2c1_grp", sptlp_i2c1_pins, 1),
  223. PIN_GROUP("i2c2_grp", sptlp_i2c2_pins, 1),
  224. PIN_GROUP("i2c3_grp", sptlp_i2c3_pins, 1),
  225. PIN_GROUP("i2c4_grp", sptlp_i2c4_pins, 1),
  226. PIN_GROUP("i2c4b_grp", sptlp_i2c4b_pins, 3),
  227. PIN_GROUP("i2c5_grp", sptlp_i2c5_pins, 1),
  228. PIN_GROUP("ssp2_grp", sptlp_ssp2_pins, 1),
  229. PIN_GROUP("emmc_grp", sptlp_emmc_pins, 1),
  230. PIN_GROUP("sd_grp", sptlp_sd_pins, 1),
  231. };
  232. static const char * const sptlp_spi0_groups[] = { "spi0_grp" };
  233. static const char * const sptlp_spi1_groups[] = { "spi0_grp" };
  234. static const char * const sptlp_uart0_groups[] = { "uart0_grp" };
  235. static const char * const sptlp_uart1_groups[] = { "uart1_grp" };
  236. static const char * const sptlp_uart2_groups[] = { "uart2_grp" };
  237. static const char * const sptlp_i2c0_groups[] = { "i2c0_grp" };
  238. static const char * const sptlp_i2c1_groups[] = { "i2c1_grp" };
  239. static const char * const sptlp_i2c2_groups[] = { "i2c2_grp" };
  240. static const char * const sptlp_i2c3_groups[] = { "i2c3_grp" };
  241. static const char * const sptlp_i2c4_groups[] = { "i2c4_grp", "i2c4b_grp" };
  242. static const char * const sptlp_i2c5_groups[] = { "i2c5_grp" };
  243. static const char * const sptlp_ssp2_groups[] = { "ssp2_grp" };
  244. static const char * const sptlp_emmc_groups[] = { "emmc_grp" };
  245. static const char * const sptlp_sd_groups[] = { "sd_grp" };
  246. static const struct intel_function sptlp_functions[] = {
  247. FUNCTION("spi0", sptlp_spi0_groups),
  248. FUNCTION("spi1", sptlp_spi1_groups),
  249. FUNCTION("uart0", sptlp_uart0_groups),
  250. FUNCTION("uart1", sptlp_uart1_groups),
  251. FUNCTION("uart2", sptlp_uart2_groups),
  252. FUNCTION("i2c0", sptlp_i2c0_groups),
  253. FUNCTION("i2c1", sptlp_i2c1_groups),
  254. FUNCTION("i2c2", sptlp_i2c2_groups),
  255. FUNCTION("i2c3", sptlp_i2c3_groups),
  256. FUNCTION("i2c4", sptlp_i2c4_groups),
  257. FUNCTION("i2c5", sptlp_i2c5_groups),
  258. FUNCTION("ssp2", sptlp_ssp2_groups),
  259. FUNCTION("emmc", sptlp_emmc_groups),
  260. FUNCTION("sd", sptlp_sd_groups),
  261. };
  262. static const struct intel_community sptlp_communities[] = {
  263. SPT_COMMUNITY(0, 0, 47),
  264. SPT_COMMUNITY(1, 48, 119),
  265. SPT_COMMUNITY(2, 120, 151),
  266. };
  267. static const struct intel_pinctrl_soc_data sptlp_soc_data = {
  268. .pins = sptlp_pins,
  269. .npins = ARRAY_SIZE(sptlp_pins),
  270. .groups = sptlp_groups,
  271. .ngroups = ARRAY_SIZE(sptlp_groups),
  272. .functions = sptlp_functions,
  273. .nfunctions = ARRAY_SIZE(sptlp_functions),
  274. .communities = sptlp_communities,
  275. .ncommunities = ARRAY_SIZE(sptlp_communities),
  276. };
  277. /* Sunrisepoint-H */
  278. static const struct pinctrl_pin_desc spth_pins[] = {
  279. /* GPP_A */
  280. PINCTRL_PIN(0, "RCINB"),
  281. PINCTRL_PIN(1, "LAD_0"),
  282. PINCTRL_PIN(2, "LAD_1"),
  283. PINCTRL_PIN(3, "LAD_2"),
  284. PINCTRL_PIN(4, "LAD_3"),
  285. PINCTRL_PIN(5, "LFRAMEB"),
  286. PINCTRL_PIN(6, "SERIQ"),
  287. PINCTRL_PIN(7, "PIRQAB"),
  288. PINCTRL_PIN(8, "CLKRUNB"),
  289. PINCTRL_PIN(9, "CLKOUT_LPC_0"),
  290. PINCTRL_PIN(10, "CLKOUT_LPC_1"),
  291. PINCTRL_PIN(11, "PMEB"),
  292. PINCTRL_PIN(12, "BM_BUSYB"),
  293. PINCTRL_PIN(13, "SUSWARNB_SUS_PWRDNACK"),
  294. PINCTRL_PIN(14, "SUS_STATB"),
  295. PINCTRL_PIN(15, "SUSACKB"),
  296. PINCTRL_PIN(16, "CLKOUT_48"),
  297. PINCTRL_PIN(17, "ISH_GP_7"),
  298. PINCTRL_PIN(18, "ISH_GP_0"),
  299. PINCTRL_PIN(19, "ISH_GP_1"),
  300. PINCTRL_PIN(20, "ISH_GP_2"),
  301. PINCTRL_PIN(21, "ISH_GP_3"),
  302. PINCTRL_PIN(22, "ISH_GP_4"),
  303. PINCTRL_PIN(23, "ISH_GP_5"),
  304. /* GPP_B */
  305. PINCTRL_PIN(24, "CORE_VID_0"),
  306. PINCTRL_PIN(25, "CORE_VID_1"),
  307. PINCTRL_PIN(26, "VRALERTB"),
  308. PINCTRL_PIN(27, "CPU_GP_2"),
  309. PINCTRL_PIN(28, "CPU_GP_3"),
  310. PINCTRL_PIN(29, "SRCCLKREQB_0"),
  311. PINCTRL_PIN(30, "SRCCLKREQB_1"),
  312. PINCTRL_PIN(31, "SRCCLKREQB_2"),
  313. PINCTRL_PIN(32, "SRCCLKREQB_3"),
  314. PINCTRL_PIN(33, "SRCCLKREQB_4"),
  315. PINCTRL_PIN(34, "SRCCLKREQB_5"),
  316. PINCTRL_PIN(35, "EXT_PWR_GATEB"),
  317. PINCTRL_PIN(36, "SLP_S0B"),
  318. PINCTRL_PIN(37, "PLTRSTB"),
  319. PINCTRL_PIN(38, "SPKR"),
  320. PINCTRL_PIN(39, "GSPI0_CSB"),
  321. PINCTRL_PIN(40, "GSPI0_CLK"),
  322. PINCTRL_PIN(41, "GSPI0_MISO"),
  323. PINCTRL_PIN(42, "GSPI0_MOSI"),
  324. PINCTRL_PIN(43, "GSPI1_CSB"),
  325. PINCTRL_PIN(44, "GSPI1_CLK"),
  326. PINCTRL_PIN(45, "GSPI1_MISO"),
  327. PINCTRL_PIN(46, "GSPI1_MOSI"),
  328. PINCTRL_PIN(47, "SML1ALERTB"),
  329. /* GPP_C */
  330. PINCTRL_PIN(48, "SMBCLK"),
  331. PINCTRL_PIN(49, "SMBDATA"),
  332. PINCTRL_PIN(50, "SMBALERTB"),
  333. PINCTRL_PIN(51, "SML0CLK"),
  334. PINCTRL_PIN(52, "SML0DATA"),
  335. PINCTRL_PIN(53, "SML0ALERTB"),
  336. PINCTRL_PIN(54, "SML1CLK"),
  337. PINCTRL_PIN(55, "SML1DATA"),
  338. PINCTRL_PIN(56, "UART0_RXD"),
  339. PINCTRL_PIN(57, "UART0_TXD"),
  340. PINCTRL_PIN(58, "UART0_RTSB"),
  341. PINCTRL_PIN(59, "UART0_CTSB"),
  342. PINCTRL_PIN(60, "UART1_RXD"),
  343. PINCTRL_PIN(61, "UART1_TXD"),
  344. PINCTRL_PIN(62, "UART1_RTSB"),
  345. PINCTRL_PIN(63, "UART1_CTSB"),
  346. PINCTRL_PIN(64, "I2C0_SDA"),
  347. PINCTRL_PIN(65, "I2C0_SCL"),
  348. PINCTRL_PIN(66, "I2C1_SDA"),
  349. PINCTRL_PIN(67, "I2C1_SCL"),
  350. PINCTRL_PIN(68, "UART2_RXD"),
  351. PINCTRL_PIN(69, "UART2_TXD"),
  352. PINCTRL_PIN(70, "UART2_RTSB"),
  353. PINCTRL_PIN(71, "UART2_CTSB"),
  354. /* GPP_D */
  355. PINCTRL_PIN(72, "SPI1_CSB"),
  356. PINCTRL_PIN(73, "SPI1_CLK"),
  357. PINCTRL_PIN(74, "SPI1_MISO_IO_1"),
  358. PINCTRL_PIN(75, "SPI1_MOSI_IO_0"),
  359. PINCTRL_PIN(76, "ISH_I2C2_SDA"),
  360. PINCTRL_PIN(77, "SSP0_SFRM"),
  361. PINCTRL_PIN(78, "SSP0_TXD"),
  362. PINCTRL_PIN(79, "SSP0_RXD"),
  363. PINCTRL_PIN(80, "SSP0_SCLK"),
  364. PINCTRL_PIN(81, "ISH_SPI_CSB"),
  365. PINCTRL_PIN(82, "ISH_SPI_CLK"),
  366. PINCTRL_PIN(83, "ISH_SPI_MISO"),
  367. PINCTRL_PIN(84, "ISH_SPI_MOSI"),
  368. PINCTRL_PIN(85, "ISH_UART0_RXD"),
  369. PINCTRL_PIN(86, "ISH_UART0_TXD"),
  370. PINCTRL_PIN(87, "ISH_UART0_RTSB"),
  371. PINCTRL_PIN(88, "ISH_UART0_CTSB"),
  372. PINCTRL_PIN(89, "DMIC_CLK_1"),
  373. PINCTRL_PIN(90, "DMIC_DATA_1"),
  374. PINCTRL_PIN(91, "DMIC_CLK_0"),
  375. PINCTRL_PIN(92, "DMIC_DATA_0"),
  376. PINCTRL_PIN(93, "SPI1_IO_2"),
  377. PINCTRL_PIN(94, "SPI1_IO_3"),
  378. PINCTRL_PIN(95, "ISH_I2C2_SCL"),
  379. /* GPP_E */
  380. PINCTRL_PIN(96, "SATAXPCIE_0"),
  381. PINCTRL_PIN(97, "SATAXPCIE_1"),
  382. PINCTRL_PIN(98, "SATAXPCIE_2"),
  383. PINCTRL_PIN(99, "CPU_GP_0"),
  384. PINCTRL_PIN(100, "SATA_DEVSLP_0"),
  385. PINCTRL_PIN(101, "SATA_DEVSLP_1"),
  386. PINCTRL_PIN(102, "SATA_DEVSLP_2"),
  387. PINCTRL_PIN(103, "CPU_GP_1"),
  388. PINCTRL_PIN(104, "SATA_LEDB"),
  389. PINCTRL_PIN(105, "USB2_OCB_0"),
  390. PINCTRL_PIN(106, "USB2_OCB_1"),
  391. PINCTRL_PIN(107, "USB2_OCB_2"),
  392. PINCTRL_PIN(108, "USB2_OCB_3"),
  393. /* GPP_F */
  394. PINCTRL_PIN(109, "SATAXPCIE_3"),
  395. PINCTRL_PIN(110, "SATAXPCIE_4"),
  396. PINCTRL_PIN(111, "SATAXPCIE_5"),
  397. PINCTRL_PIN(112, "SATAXPCIE_6"),
  398. PINCTRL_PIN(113, "SATAXPCIE_7"),
  399. PINCTRL_PIN(114, "SATA_DEVSLP_3"),
  400. PINCTRL_PIN(115, "SATA_DEVSLP_4"),
  401. PINCTRL_PIN(116, "SATA_DEVSLP_5"),
  402. PINCTRL_PIN(117, "SATA_DEVSLP_6"),
  403. PINCTRL_PIN(118, "SATA_DEVSLP_7"),
  404. PINCTRL_PIN(119, "SATA_SCLOCK"),
  405. PINCTRL_PIN(120, "SATA_SLOAD"),
  406. PINCTRL_PIN(121, "SATA_SDATAOUT1"),
  407. PINCTRL_PIN(122, "SATA_SDATAOUT0"),
  408. PINCTRL_PIN(123, "GPP_F_14"),
  409. PINCTRL_PIN(124, "USB_OCB_4"),
  410. PINCTRL_PIN(125, "USB_OCB_5"),
  411. PINCTRL_PIN(126, "USB_OCB_6"),
  412. PINCTRL_PIN(127, "USB_OCB_7"),
  413. PINCTRL_PIN(128, "L_VDDEN"),
  414. PINCTRL_PIN(129, "L_BKLTEN"),
  415. PINCTRL_PIN(130, "L_BKLTCTL"),
  416. PINCTRL_PIN(131, "GPP_F_22"),
  417. PINCTRL_PIN(132, "GPP_F_23"),
  418. /* GPP_G */
  419. PINCTRL_PIN(133, "FAN_TACH_0"),
  420. PINCTRL_PIN(134, "FAN_TACH_1"),
  421. PINCTRL_PIN(135, "FAN_TACH_2"),
  422. PINCTRL_PIN(136, "FAN_TACH_3"),
  423. PINCTRL_PIN(137, "FAN_TACH_4"),
  424. PINCTRL_PIN(138, "FAN_TACH_5"),
  425. PINCTRL_PIN(139, "FAN_TACH_6"),
  426. PINCTRL_PIN(140, "FAN_TACH_7"),
  427. PINCTRL_PIN(141, "FAN_PWM_0"),
  428. PINCTRL_PIN(142, "FAN_PWM_1"),
  429. PINCTRL_PIN(143, "FAN_PWM_2"),
  430. PINCTRL_PIN(144, "FAN_PWM_3"),
  431. PINCTRL_PIN(145, "GSXDOUT"),
  432. PINCTRL_PIN(146, "GSXSLOAD"),
  433. PINCTRL_PIN(147, "GSXDIN"),
  434. PINCTRL_PIN(148, "GSXRESETB"),
  435. PINCTRL_PIN(149, "GSXCLK"),
  436. PINCTRL_PIN(150, "ADR_COMPLETE"),
  437. PINCTRL_PIN(151, "NMIB"),
  438. PINCTRL_PIN(152, "SMIB"),
  439. PINCTRL_PIN(153, "GPP_G_20"),
  440. PINCTRL_PIN(154, "GPP_G_21"),
  441. PINCTRL_PIN(155, "GPP_G_22"),
  442. PINCTRL_PIN(156, "GPP_G_23"),
  443. /* GPP_H */
  444. PINCTRL_PIN(157, "SRCCLKREQB_6"),
  445. PINCTRL_PIN(158, "SRCCLKREQB_7"),
  446. PINCTRL_PIN(159, "SRCCLKREQB_8"),
  447. PINCTRL_PIN(160, "SRCCLKREQB_9"),
  448. PINCTRL_PIN(161, "SRCCLKREQB_10"),
  449. PINCTRL_PIN(162, "SRCCLKREQB_11"),
  450. PINCTRL_PIN(163, "SRCCLKREQB_12"),
  451. PINCTRL_PIN(164, "SRCCLKREQB_13"),
  452. PINCTRL_PIN(165, "SRCCLKREQB_14"),
  453. PINCTRL_PIN(166, "SRCCLKREQB_15"),
  454. PINCTRL_PIN(167, "SML2CLK"),
  455. PINCTRL_PIN(168, "SML2DATA"),
  456. PINCTRL_PIN(169, "SML2ALERTB"),
  457. PINCTRL_PIN(170, "SML3CLK"),
  458. PINCTRL_PIN(171, "SML3DATA"),
  459. PINCTRL_PIN(172, "SML3ALERTB"),
  460. PINCTRL_PIN(173, "SML4CLK"),
  461. PINCTRL_PIN(174, "SML4DATA"),
  462. PINCTRL_PIN(175, "SML4ALERTB"),
  463. PINCTRL_PIN(176, "ISH_I2C0_SDA"),
  464. PINCTRL_PIN(177, "ISH_I2C0_SCL"),
  465. PINCTRL_PIN(178, "ISH_I2C1_SDA"),
  466. PINCTRL_PIN(179, "ISH_I2C1_SCL"),
  467. PINCTRL_PIN(180, "GPP_H_23"),
  468. /* GPP_I */
  469. PINCTRL_PIN(181, "DDSP_HDP_0"),
  470. PINCTRL_PIN(182, "DDSP_HDP_1"),
  471. PINCTRL_PIN(183, "DDSP_HDP_2"),
  472. PINCTRL_PIN(184, "DDSP_HDP_3"),
  473. PINCTRL_PIN(185, "EDP_HPD"),
  474. PINCTRL_PIN(186, "DDPB_CTRLCLK"),
  475. PINCTRL_PIN(187, "DDPB_CTRLDATA"),
  476. PINCTRL_PIN(188, "DDPC_CTRLCLK"),
  477. PINCTRL_PIN(189, "DDPC_CTRLDATA"),
  478. PINCTRL_PIN(190, "DDPD_CTRLCLK"),
  479. PINCTRL_PIN(191, "DDPD_CTRLDATA"),
  480. };
  481. static const unsigned spth_spi0_pins[] = { 39, 40, 41, 42 };
  482. static const unsigned spth_spi1_pins[] = { 43, 44, 45, 46 };
  483. static const unsigned spth_uart0_pins[] = { 56, 57, 58, 59 };
  484. static const unsigned spth_uart1_pins[] = { 60, 61, 62, 63 };
  485. static const unsigned spth_uart2_pins[] = { 68, 69, 71, 71 };
  486. static const unsigned spth_i2c0_pins[] = { 64, 65 };
  487. static const unsigned spth_i2c1_pins[] = { 66, 67 };
  488. static const unsigned spth_i2c2_pins[] = { 76, 95 };
  489. static const struct intel_pingroup spth_groups[] = {
  490. PIN_GROUP("spi0_grp", spth_spi0_pins, 1),
  491. PIN_GROUP("spi1_grp", spth_spi1_pins, 1),
  492. PIN_GROUP("uart0_grp", spth_uart0_pins, 1),
  493. PIN_GROUP("uart1_grp", spth_uart1_pins, 1),
  494. PIN_GROUP("uart2_grp", spth_uart2_pins, 1),
  495. PIN_GROUP("i2c0_grp", spth_i2c0_pins, 1),
  496. PIN_GROUP("i2c1_grp", spth_i2c1_pins, 1),
  497. PIN_GROUP("i2c2_grp", spth_i2c2_pins, 2),
  498. };
  499. static const char * const spth_spi0_groups[] = { "spi0_grp" };
  500. static const char * const spth_spi1_groups[] = { "spi0_grp" };
  501. static const char * const spth_uart0_groups[] = { "uart0_grp" };
  502. static const char * const spth_uart1_groups[] = { "uart1_grp" };
  503. static const char * const spth_uart2_groups[] = { "uart2_grp" };
  504. static const char * const spth_i2c0_groups[] = { "i2c0_grp" };
  505. static const char * const spth_i2c1_groups[] = { "i2c1_grp" };
  506. static const char * const spth_i2c2_groups[] = { "i2c2_grp" };
  507. static const struct intel_function spth_functions[] = {
  508. FUNCTION("spi0", spth_spi0_groups),
  509. FUNCTION("spi1", spth_spi1_groups),
  510. FUNCTION("uart0", spth_uart0_groups),
  511. FUNCTION("uart1", spth_uart1_groups),
  512. FUNCTION("uart2", spth_uart2_groups),
  513. FUNCTION("i2c0", spth_i2c0_groups),
  514. FUNCTION("i2c1", spth_i2c1_groups),
  515. FUNCTION("i2c2", spth_i2c2_groups),
  516. };
  517. static const struct intel_community spth_communities[] = {
  518. SPT_COMMUNITY(0, 0, 47),
  519. SPT_COMMUNITY(1, 48, 180),
  520. SPT_COMMUNITY(2, 181, 191),
  521. };
  522. static const struct intel_pinctrl_soc_data spth_soc_data = {
  523. .pins = spth_pins,
  524. .npins = ARRAY_SIZE(spth_pins),
  525. .groups = spth_groups,
  526. .ngroups = ARRAY_SIZE(spth_groups),
  527. .functions = spth_functions,
  528. .nfunctions = ARRAY_SIZE(spth_functions),
  529. .communities = spth_communities,
  530. .ncommunities = ARRAY_SIZE(spth_communities),
  531. };
  532. static const struct acpi_device_id spt_pinctrl_acpi_match[] = {
  533. { "INT344B", (kernel_ulong_t)&sptlp_soc_data },
  534. { "INT345D", (kernel_ulong_t)&spth_soc_data },
  535. { }
  536. };
  537. MODULE_DEVICE_TABLE(acpi, spt_pinctrl_acpi_match);
  538. static int spt_pinctrl_probe(struct platform_device *pdev)
  539. {
  540. const struct intel_pinctrl_soc_data *soc_data;
  541. const struct acpi_device_id *id;
  542. id = acpi_match_device(spt_pinctrl_acpi_match, &pdev->dev);
  543. if (!id || !id->driver_data)
  544. return -ENODEV;
  545. soc_data = (const struct intel_pinctrl_soc_data *)id->driver_data;
  546. return intel_pinctrl_probe(pdev, soc_data);
  547. }
  548. static const struct dev_pm_ops spt_pinctrl_pm_ops = {
  549. SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend,
  550. intel_pinctrl_resume)
  551. };
  552. static struct platform_driver spt_pinctrl_driver = {
  553. .probe = spt_pinctrl_probe,
  554. .driver = {
  555. .name = "sunrisepoint-pinctrl",
  556. .acpi_match_table = spt_pinctrl_acpi_match,
  557. .pm = &spt_pinctrl_pm_ops,
  558. },
  559. };
  560. static int __init spt_pinctrl_init(void)
  561. {
  562. return platform_driver_register(&spt_pinctrl_driver);
  563. }
  564. subsys_initcall(spt_pinctrl_init);
  565. static void __exit spt_pinctrl_exit(void)
  566. {
  567. platform_driver_unregister(&spt_pinctrl_driver);
  568. }
  569. module_exit(spt_pinctrl_exit);
  570. MODULE_AUTHOR("Mathias Nyman <mathias.nyman@linux.intel.com>");
  571. MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
  572. MODULE_DESCRIPTION("Intel Sunrisepoint PCH pinctrl/GPIO driver");
  573. MODULE_LICENSE("GPL v2");