pinctrl-geminilake.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. /*
  2. * Intel Gemini Lake SoC pinctrl/GPIO driver
  3. *
  4. * Copyright (C) 2017 Intel Corporation
  5. * Author: Mika Westerberg <mika.westerberg@linux.intel.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/acpi.h>
  12. #include <linux/module.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/pm.h>
  15. #include <linux/pinctrl/pinctrl.h>
  16. #include "pinctrl-intel.h"
  17. #define GLK_PAD_OWN 0x020
  18. #define GLK_HOSTSW_OWN 0x0b0
  19. #define GLK_PADCFGLOCK 0x080
  20. #define GLK_GPI_IE 0x110
  21. #define GLK_COMMUNITY(s, e) \
  22. { \
  23. .padown_offset = GLK_PAD_OWN, \
  24. .padcfglock_offset = GLK_PADCFGLOCK, \
  25. .hostown_offset = GLK_HOSTSW_OWN, \
  26. .ie_offset = GLK_GPI_IE, \
  27. .gpp_size = 32, \
  28. .pin_base = (s), \
  29. .npins = ((e) - (s) + 1), \
  30. }
  31. /* GLK */
  32. static const struct pinctrl_pin_desc glk_northwest_pins[] = {
  33. PINCTRL_PIN(0, "TCK"),
  34. PINCTRL_PIN(1, "TRST_B"),
  35. PINCTRL_PIN(2, "TMS"),
  36. PINCTRL_PIN(3, "TDI"),
  37. PINCTRL_PIN(4, "TDO"),
  38. PINCTRL_PIN(5, "JTAGX"),
  39. PINCTRL_PIN(6, "CX_PREQ_B"),
  40. PINCTRL_PIN(7, "CX_PRDY_B"),
  41. PINCTRL_PIN(8, "GPIO_8"),
  42. PINCTRL_PIN(9, "GPIO_9"),
  43. PINCTRL_PIN(10, "GPIO_10"),
  44. PINCTRL_PIN(11, "GPIO_11"),
  45. PINCTRL_PIN(12, "GPIO_12"),
  46. PINCTRL_PIN(13, "GPIO_13"),
  47. PINCTRL_PIN(14, "GPIO_14"),
  48. PINCTRL_PIN(15, "GPIO_15"),
  49. PINCTRL_PIN(16, "GPIO_16"),
  50. PINCTRL_PIN(17, "GPIO_17"),
  51. PINCTRL_PIN(18, "GPIO_18"),
  52. PINCTRL_PIN(19, "GPIO_19"),
  53. PINCTRL_PIN(20, "GPIO_20"),
  54. PINCTRL_PIN(21, "GPIO_21"),
  55. PINCTRL_PIN(22, "GPIO_22"),
  56. PINCTRL_PIN(23, "GPIO_23"),
  57. PINCTRL_PIN(24, "GPIO_24"),
  58. PINCTRL_PIN(25, "GPIO_25"),
  59. PINCTRL_PIN(26, "GPIO_26"),
  60. PINCTRL_PIN(27, "GPIO_27"),
  61. PINCTRL_PIN(28, "GPIO_28"),
  62. PINCTRL_PIN(29, "GPIO_29"),
  63. PINCTRL_PIN(30, "GPIO_30"),
  64. PINCTRL_PIN(31, "GPIO_31"),
  65. PINCTRL_PIN(32, "GPIO_32"),
  66. PINCTRL_PIN(33, "GPIO_33"),
  67. PINCTRL_PIN(34, "GPIO_34"),
  68. PINCTRL_PIN(35, "GPIO_35"),
  69. PINCTRL_PIN(36, "GPIO_36"),
  70. PINCTRL_PIN(37, "GPIO_37"),
  71. PINCTRL_PIN(38, "GPIO_38"),
  72. PINCTRL_PIN(39, "GPIO_39"),
  73. PINCTRL_PIN(40, "GPIO_40"),
  74. PINCTRL_PIN(41, "GPIO_41"),
  75. PINCTRL_PIN(42, "GP_INTD_DSI_TE1"),
  76. PINCTRL_PIN(43, "GP_INTD_DSI_TE2"),
  77. PINCTRL_PIN(44, "USB_OC0_B"),
  78. PINCTRL_PIN(45, "USB_OC1_B"),
  79. PINCTRL_PIN(46, "DSI_I2C_SDA"),
  80. PINCTRL_PIN(47, "DSI_I2C_SCL"),
  81. PINCTRL_PIN(48, "PMC_I2C_SDA"),
  82. PINCTRL_PIN(49, "PMC_I2C_SCL"),
  83. PINCTRL_PIN(50, "LPSS_I2C0_SDA"),
  84. PINCTRL_PIN(51, "LPSS_I2C0_SCL"),
  85. PINCTRL_PIN(52, "LPSS_I2C1_SDA"),
  86. PINCTRL_PIN(53, "LPSS_I2C1_SCL"),
  87. PINCTRL_PIN(54, "LPSS_I2C2_SDA"),
  88. PINCTRL_PIN(55, "LPSS_I2C2_SCL"),
  89. PINCTRL_PIN(56, "LPSS_I2C3_SDA"),
  90. PINCTRL_PIN(57, "LPSS_I2C3_SCL"),
  91. PINCTRL_PIN(58, "LPSS_I2C4_SDA"),
  92. PINCTRL_PIN(59, "LPSS_I2C4_SCL"),
  93. PINCTRL_PIN(60, "LPSS_UART0_RXD"),
  94. PINCTRL_PIN(61, "LPSS_UART0_TXD"),
  95. PINCTRL_PIN(62, "LPSS_UART0_RTS_B"),
  96. PINCTRL_PIN(63, "LPSS_UART0_CTS_B"),
  97. PINCTRL_PIN(64, "LPSS_UART2_RXD"),
  98. PINCTRL_PIN(65, "LPSS_UART2_TXD"),
  99. PINCTRL_PIN(66, "LPSS_UART2_RTS_B"),
  100. PINCTRL_PIN(67, "LPSS_UART2_CTS_B"),
  101. PINCTRL_PIN(68, "PMC_SPI_FS0"),
  102. PINCTRL_PIN(69, "PMC_SPI_FS1"),
  103. PINCTRL_PIN(70, "PMC_SPI_FS2"),
  104. PINCTRL_PIN(71, "PMC_SPI_RXD"),
  105. PINCTRL_PIN(72, "PMC_SPI_TXD"),
  106. PINCTRL_PIN(73, "PMC_SPI_CLK"),
  107. PINCTRL_PIN(74, "THERMTRIP_B"),
  108. PINCTRL_PIN(75, "PROCHOT_B"),
  109. PINCTRL_PIN(76, "EMMC_RST_B"),
  110. PINCTRL_PIN(77, "GPIO_212"),
  111. PINCTRL_PIN(78, "GPIO_213"),
  112. PINCTRL_PIN(79, "GPIO_214"),
  113. };
  114. static const unsigned int glk_northwest_uart1_pins[] = { 26, 27, 28, 29 };
  115. static const unsigned int glk_northwest_pwm0_pins[] = { 42 };
  116. static const unsigned int glk_northwest_pwm1_pins[] = { 43 };
  117. static const unsigned int glk_northwest_pwm2_pins[] = { 44 };
  118. static const unsigned int glk_northwest_pwm3_pins[] = { 45 };
  119. static const unsigned int glk_northwest_i2c0_pins[] = { 50, 51 };
  120. static const unsigned int glk_northwest_i2c1_pins[] = { 52, 53 };
  121. static const unsigned int glk_northwest_i2c2_pins[] = { 54, 55 };
  122. static const unsigned int glk_northwest_i2c3_pins[] = { 56, 57 };
  123. static const unsigned int glk_northwest_i2c4_pins[] = { 58, 59 };
  124. static const unsigned int glk_northwest_uart0_pins[] = { 60, 61, 62, 63 };
  125. static const unsigned int glk_northwest_uart2_pins[] = { 64, 65, 66, 67 };
  126. static const struct intel_pingroup glk_northwest_groups[] = {
  127. PIN_GROUP("uart1_grp", glk_northwest_uart1_pins, 2),
  128. PIN_GROUP("pwm0_grp", glk_northwest_pwm0_pins, 2),
  129. PIN_GROUP("pwm1_grp", glk_northwest_pwm1_pins, 2),
  130. PIN_GROUP("pwm2_grp", glk_northwest_pwm2_pins, 2),
  131. PIN_GROUP("pwm3_grp", glk_northwest_pwm3_pins, 2),
  132. PIN_GROUP("i2c0_grp", glk_northwest_i2c0_pins, 1),
  133. PIN_GROUP("i2c1_grp", glk_northwest_i2c1_pins, 1),
  134. PIN_GROUP("i2c2_grp", glk_northwest_i2c2_pins, 1),
  135. PIN_GROUP("i2c3_grp", glk_northwest_i2c3_pins, 1),
  136. PIN_GROUP("i2c4_grp", glk_northwest_i2c4_pins, 1),
  137. PIN_GROUP("uart0_grp", glk_northwest_uart0_pins, 1),
  138. PIN_GROUP("uart2_grp", glk_northwest_uart2_pins, 1),
  139. };
  140. static const char * const glk_northwest_uart1_groups[] = { "uart1_grp" };
  141. static const char * const glk_northwest_pwm0_groups[] = { "pwm0_grp" };
  142. static const char * const glk_northwest_pwm1_groups[] = { "pwm1_grp" };
  143. static const char * const glk_northwest_pwm2_groups[] = { "pwm2_grp" };
  144. static const char * const glk_northwest_pwm3_groups[] = { "pwm3_grp" };
  145. static const char * const glk_northwest_i2c0_groups[] = { "i2c0_grp" };
  146. static const char * const glk_northwest_i2c1_groups[] = { "i2c1_grp" };
  147. static const char * const glk_northwest_i2c2_groups[] = { "i2c2_grp" };
  148. static const char * const glk_northwest_i2c3_groups[] = { "i2c3_grp" };
  149. static const char * const glk_northwest_i2c4_groups[] = { "i2c4_grp" };
  150. static const char * const glk_northwest_uart0_groups[] = { "uart0_grp" };
  151. static const char * const glk_northwest_uart2_groups[] = { "uart2_grp" };
  152. static const struct intel_function glk_northwest_functions[] = {
  153. FUNCTION("uart1", glk_northwest_uart1_groups),
  154. FUNCTION("pmw0", glk_northwest_pwm0_groups),
  155. FUNCTION("pmw1", glk_northwest_pwm1_groups),
  156. FUNCTION("pmw2", glk_northwest_pwm2_groups),
  157. FUNCTION("pmw3", glk_northwest_pwm3_groups),
  158. FUNCTION("i2c0", glk_northwest_i2c0_groups),
  159. FUNCTION("i2c1", glk_northwest_i2c1_groups),
  160. FUNCTION("i2c2", glk_northwest_i2c2_groups),
  161. FUNCTION("i2c3", glk_northwest_i2c3_groups),
  162. FUNCTION("i2c4", glk_northwest_i2c4_groups),
  163. FUNCTION("uart0", glk_northwest_uart0_groups),
  164. FUNCTION("uart2", glk_northwest_uart2_groups),
  165. };
  166. static const struct intel_community glk_northwest_communities[] = {
  167. GLK_COMMUNITY(0, 79),
  168. };
  169. static const struct intel_pinctrl_soc_data glk_northwest_soc_data = {
  170. .uid = "1",
  171. .pins = glk_northwest_pins,
  172. .npins = ARRAY_SIZE(glk_northwest_pins),
  173. .groups = glk_northwest_groups,
  174. .ngroups = ARRAY_SIZE(glk_northwest_groups),
  175. .functions = glk_northwest_functions,
  176. .nfunctions = ARRAY_SIZE(glk_northwest_functions),
  177. .communities = glk_northwest_communities,
  178. .ncommunities = ARRAY_SIZE(glk_northwest_communities),
  179. };
  180. static const struct pinctrl_pin_desc glk_north_pins[] = {
  181. PINCTRL_PIN(0, "SVID0_ALERT_B"),
  182. PINCTRL_PIN(1, "SVID0_DATA"),
  183. PINCTRL_PIN(2, "SVID0_CLK"),
  184. PINCTRL_PIN(3, "LPSS_SPI_0_CLK"),
  185. PINCTRL_PIN(4, "LPSS_SPI_0_FS0"),
  186. PINCTRL_PIN(5, "LPSS_SPI_0_FS1"),
  187. PINCTRL_PIN(6, "LPSS_SPI_0_RXD"),
  188. PINCTRL_PIN(7, "LPSS_SPI_0_TXD"),
  189. PINCTRL_PIN(8, "LPSS_SPI_1_CLK"),
  190. PINCTRL_PIN(9, "LPSS_SPI_1_FS0"),
  191. PINCTRL_PIN(10, "LPSS_SPI_1_FS1"),
  192. PINCTRL_PIN(11, "LPSS_SPI_1_FS2"),
  193. PINCTRL_PIN(12, "LPSS_SPI_1_RXD"),
  194. PINCTRL_PIN(13, "LPSS_SPI_1_TXD"),
  195. PINCTRL_PIN(14, "FST_SPI_CS0_B"),
  196. PINCTRL_PIN(15, "FST_SPI_CS1_B"),
  197. PINCTRL_PIN(16, "FST_SPI_MOSI_IO0"),
  198. PINCTRL_PIN(17, "FST_SPI_MISO_IO1"),
  199. PINCTRL_PIN(18, "FST_SPI_IO2"),
  200. PINCTRL_PIN(19, "FST_SPI_IO3"),
  201. PINCTRL_PIN(20, "FST_SPI_CLK"),
  202. PINCTRL_PIN(21, "FST_SPI_CLK_FB"),
  203. PINCTRL_PIN(22, "PMU_PLTRST_B"),
  204. PINCTRL_PIN(23, "PMU_PWRBTN_B"),
  205. PINCTRL_PIN(24, "PMU_SLP_S0_B"),
  206. PINCTRL_PIN(25, "PMU_SLP_S3_B"),
  207. PINCTRL_PIN(26, "PMU_SLP_S4_B"),
  208. PINCTRL_PIN(27, "SUSPWRDNACK"),
  209. PINCTRL_PIN(28, "EMMC_PWR_EN_B"),
  210. PINCTRL_PIN(29, "PMU_AC_PRESENT"),
  211. PINCTRL_PIN(30, "PMU_BATLOW_B"),
  212. PINCTRL_PIN(31, "PMU_RESETBUTTON_B"),
  213. PINCTRL_PIN(32, "PMU_SUSCLK"),
  214. PINCTRL_PIN(33, "SUS_STAT_B"),
  215. PINCTRL_PIN(34, "LPSS_I2C5_SDA"),
  216. PINCTRL_PIN(35, "LPSS_I2C5_SCL"),
  217. PINCTRL_PIN(36, "LPSS_I2C6_SDA"),
  218. PINCTRL_PIN(37, "LPSS_I2C6_SCL"),
  219. PINCTRL_PIN(38, "LPSS_I2C7_SDA"),
  220. PINCTRL_PIN(39, "LPSS_I2C7_SCL"),
  221. PINCTRL_PIN(40, "PCIE_WAKE0_B"),
  222. PINCTRL_PIN(41, "PCIE_WAKE1_B"),
  223. PINCTRL_PIN(42, "PCIE_WAKE2_B"),
  224. PINCTRL_PIN(43, "PCIE_WAKE3_B"),
  225. PINCTRL_PIN(44, "PCIE_CLKREQ0_B"),
  226. PINCTRL_PIN(45, "PCIE_CLKREQ1_B"),
  227. PINCTRL_PIN(46, "PCIE_CLKREQ2_B"),
  228. PINCTRL_PIN(47, "PCIE_CLKREQ3_B"),
  229. PINCTRL_PIN(48, "HV_DDI0_DDC_SDA"),
  230. PINCTRL_PIN(49, "HV_DDI0_DDC_SCL"),
  231. PINCTRL_PIN(50, "HV_DDI1_DDC_SDA"),
  232. PINCTRL_PIN(51, "HV_DDI1_DDC_SCL"),
  233. PINCTRL_PIN(52, "PANEL0_VDDEN"),
  234. PINCTRL_PIN(53, "PANEL0_BKLTEN"),
  235. PINCTRL_PIN(54, "PANEL0_BKLTCTL"),
  236. PINCTRL_PIN(55, "HV_DDI0_HPD"),
  237. PINCTRL_PIN(56, "HV_DDI1_HPD"),
  238. PINCTRL_PIN(57, "HV_EDP_HPD"),
  239. PINCTRL_PIN(58, "GPIO_134"),
  240. PINCTRL_PIN(59, "GPIO_135"),
  241. PINCTRL_PIN(60, "GPIO_136"),
  242. PINCTRL_PIN(61, "GPIO_137"),
  243. PINCTRL_PIN(62, "GPIO_138"),
  244. PINCTRL_PIN(63, "GPIO_139"),
  245. PINCTRL_PIN(64, "GPIO_140"),
  246. PINCTRL_PIN(65, "GPIO_141"),
  247. PINCTRL_PIN(66, "GPIO_142"),
  248. PINCTRL_PIN(67, "GPIO_143"),
  249. PINCTRL_PIN(68, "GPIO_144"),
  250. PINCTRL_PIN(69, "GPIO_145"),
  251. PINCTRL_PIN(70, "GPIO_146"),
  252. PINCTRL_PIN(71, "LPC_ILB_SERIRQ"),
  253. PINCTRL_PIN(72, "LPC_CLKOUT0"),
  254. PINCTRL_PIN(73, "LPC_CLKOUT1"),
  255. PINCTRL_PIN(74, "LPC_AD0"),
  256. PINCTRL_PIN(75, "LPC_AD1"),
  257. PINCTRL_PIN(76, "LPC_AD2"),
  258. PINCTRL_PIN(77, "LPC_AD3"),
  259. PINCTRL_PIN(78, "LPC_CLKRUNB"),
  260. PINCTRL_PIN(79, "LPC_FRAMEB"),
  261. };
  262. static const unsigned int glk_north_spi0_pins[] = { 3, 4, 5, 6, 7 };
  263. static const unsigned int glk_north_spi1_pins[] = { 8, 9, 10, 11, 12, 13 };
  264. static const unsigned int glk_north_i2c5_pins[] = { 34, 35 };
  265. static const unsigned int glk_north_i2c6_pins[] = { 36, 37 };
  266. static const unsigned int glk_north_i2c7_pins[] = { 38, 39 };
  267. static const unsigned int glk_north_uart0_pins[] = { 62, 63, 64, 65 };
  268. static const unsigned int glk_north_spi0b_pins[] = { 66, 67, 68, 69, 70 };
  269. static const struct intel_pingroup glk_north_groups[] = {
  270. PIN_GROUP("spi0_grp", glk_north_spi0_pins, 1),
  271. PIN_GROUP("spi1_grp", glk_north_spi1_pins, 1),
  272. PIN_GROUP("i2c5_grp", glk_north_i2c5_pins, 1),
  273. PIN_GROUP("i2c6_grp", glk_north_i2c6_pins, 1),
  274. PIN_GROUP("i2c7_grp", glk_north_i2c7_pins, 1),
  275. PIN_GROUP("uart0_grp", glk_north_uart0_pins, 2),
  276. PIN_GROUP("spi0b_grp", glk_north_spi0b_pins, 2),
  277. };
  278. static const char * const glk_north_spi0_groups[] = { "spi0_grp", "spi0b_grp" };
  279. static const char * const glk_north_spi1_groups[] = { "spi1_grp" };
  280. static const char * const glk_north_i2c5_groups[] = { "i2c5_grp" };
  281. static const char * const glk_north_i2c6_groups[] = { "i2c6_grp" };
  282. static const char * const glk_north_i2c7_groups[] = { "i2c7_grp" };
  283. static const char * const glk_north_uart0_groups[] = { "uart0_grp" };
  284. static const struct intel_function glk_north_functions[] = {
  285. FUNCTION("spi0", glk_north_spi0_groups),
  286. FUNCTION("spi1", glk_north_spi1_groups),
  287. FUNCTION("i2c5", glk_north_i2c5_groups),
  288. FUNCTION("i2c6", glk_north_i2c6_groups),
  289. FUNCTION("i2c7", glk_north_i2c7_groups),
  290. FUNCTION("uart0", glk_north_uart0_groups),
  291. };
  292. static const struct intel_community glk_north_communities[] = {
  293. GLK_COMMUNITY(0, 79),
  294. };
  295. static const struct intel_pinctrl_soc_data glk_north_soc_data = {
  296. .uid = "2",
  297. .pins = glk_north_pins,
  298. .npins = ARRAY_SIZE(glk_north_pins),
  299. .groups = glk_north_groups,
  300. .ngroups = ARRAY_SIZE(glk_north_groups),
  301. .functions = glk_north_functions,
  302. .nfunctions = ARRAY_SIZE(glk_north_functions),
  303. .communities = glk_north_communities,
  304. .ncommunities = ARRAY_SIZE(glk_north_communities),
  305. };
  306. static const struct pinctrl_pin_desc glk_audio_pins[] = {
  307. PINCTRL_PIN(0, "AVS_I2S0_MCLK"),
  308. PINCTRL_PIN(1, "AVS_I2S0_BCLK"),
  309. PINCTRL_PIN(2, "AVS_I2S0_WS_SYNC"),
  310. PINCTRL_PIN(3, "AVS_I2S0_SDI"),
  311. PINCTRL_PIN(4, "AVS_I2S0_SDO"),
  312. PINCTRL_PIN(5, "AVS_I2S1_MCLK"),
  313. PINCTRL_PIN(6, "AVS_I2S1_BCLK"),
  314. PINCTRL_PIN(7, "AVS_I2S1_WS_SYNC"),
  315. PINCTRL_PIN(8, "AVS_I2S1_SDI"),
  316. PINCTRL_PIN(9, "AVS_I2S1_SDO"),
  317. PINCTRL_PIN(10, "AVS_HDA_BCLK"),
  318. PINCTRL_PIN(11, "AVS_HDA_WS_SYNC"),
  319. PINCTRL_PIN(12, "AVS_HDA_SDI"),
  320. PINCTRL_PIN(13, "AVS_HDA_SDO"),
  321. PINCTRL_PIN(14, "AVS_HDA_RSTB"),
  322. PINCTRL_PIN(15, "AVS_M_CLK_A1"),
  323. PINCTRL_PIN(16, "AVS_M_CLK_B1"),
  324. PINCTRL_PIN(17, "AVS_M_DATA_1"),
  325. PINCTRL_PIN(18, "AVS_M_CLK_AB2"),
  326. PINCTRL_PIN(19, "AVS_M_DATA_2"),
  327. };
  328. static const struct intel_community glk_audio_communities[] = {
  329. GLK_COMMUNITY(0, 19),
  330. };
  331. static const struct intel_pinctrl_soc_data glk_audio_soc_data = {
  332. .uid = "3",
  333. .pins = glk_audio_pins,
  334. .npins = ARRAY_SIZE(glk_audio_pins),
  335. .communities = glk_audio_communities,
  336. .ncommunities = ARRAY_SIZE(glk_audio_communities),
  337. };
  338. static const struct pinctrl_pin_desc glk_scc_pins[] = {
  339. PINCTRL_PIN(0, "SMB_ALERTB"),
  340. PINCTRL_PIN(1, "SMB_CLK"),
  341. PINCTRL_PIN(2, "SMB_DATA"),
  342. PINCTRL_PIN(3, "SDCARD_LVL_WP"),
  343. PINCTRL_PIN(4, "SDCARD_CLK"),
  344. PINCTRL_PIN(5, "SDCARD_CLK_FB"),
  345. PINCTRL_PIN(6, "SDCARD_D0"),
  346. PINCTRL_PIN(7, "SDCARD_D1"),
  347. PINCTRL_PIN(8, "SDCARD_D2"),
  348. PINCTRL_PIN(9, "SDCARD_D3"),
  349. PINCTRL_PIN(10, "SDCARD_CMD"),
  350. PINCTRL_PIN(11, "SDCARD_CD_B"),
  351. PINCTRL_PIN(12, "SDCARD_PWR_DOWN_B"),
  352. PINCTRL_PIN(13, "GPIO_210"),
  353. PINCTRL_PIN(14, "OSC_CLK_OUT_0"),
  354. PINCTRL_PIN(15, "OSC_CLK_OUT_1"),
  355. PINCTRL_PIN(16, "CNV_BRI_DT"),
  356. PINCTRL_PIN(17, "CNV_BRI_RSP"),
  357. PINCTRL_PIN(18, "CNV_RGI_DT"),
  358. PINCTRL_PIN(19, "CNV_RGI_RSP"),
  359. PINCTRL_PIN(20, "CNV_RF_RESET_B"),
  360. PINCTRL_PIN(21, "XTAL_CLKREQ"),
  361. PINCTRL_PIN(22, "SDIO_CLK_FB"),
  362. PINCTRL_PIN(23, "EMMC0_CLK"),
  363. PINCTRL_PIN(24, "EMMC0_CLK_FB"),
  364. PINCTRL_PIN(25, "EMMC0_D0"),
  365. PINCTRL_PIN(26, "EMMC0_D1"),
  366. PINCTRL_PIN(27, "EMMC0_D2"),
  367. PINCTRL_PIN(28, "EMMC0_D3"),
  368. PINCTRL_PIN(29, "EMMC0_D4"),
  369. PINCTRL_PIN(30, "EMMC0_D5"),
  370. PINCTRL_PIN(31, "EMMC0_D6"),
  371. PINCTRL_PIN(32, "EMMC0_D7"),
  372. PINCTRL_PIN(33, "EMMC0_CMD"),
  373. PINCTRL_PIN(34, "EMMC0_STROBE"),
  374. };
  375. static const unsigned int glk_scc_i2c7_pins[] = { 1, 2 };
  376. static const unsigned int glk_scc_sdcard_pins[] = {
  377. 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
  378. };
  379. static const unsigned int glk_scc_sdio_pins[] = { 16, 17, 18, 19, 20, 21, 22 };
  380. static const unsigned int glk_scc_uart1_pins[] = { 16, 17, 18, 19 };
  381. static const unsigned int glk_scc_emmc_pins[] = {
  382. 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  383. };
  384. static const struct intel_pingroup glk_scc_groups[] = {
  385. PIN_GROUP("i2c7_grp", glk_scc_i2c7_pins, 2),
  386. PIN_GROUP("sdcard_grp", glk_scc_sdcard_pins, 1),
  387. PIN_GROUP("sdio_grp", glk_scc_sdio_pins, 2),
  388. PIN_GROUP("uart1_grp", glk_scc_uart1_pins, 3),
  389. PIN_GROUP("emmc_grp", glk_scc_emmc_pins, 1),
  390. };
  391. static const char * const glk_scc_i2c7_groups[] = { "i2c7_grp" };
  392. static const char * const glk_scc_sdcard_groups[] = { "sdcard_grp" };
  393. static const char * const glk_scc_sdio_groups[] = { "sdio_grp" };
  394. static const char * const glk_scc_uart1_groups[] = { "uart1_grp" };
  395. static const char * const glk_scc_emmc_groups[] = { "emmc_grp" };
  396. static const struct intel_function glk_scc_functions[] = {
  397. FUNCTION("i2c7", glk_scc_i2c7_groups),
  398. FUNCTION("sdcard", glk_scc_sdcard_groups),
  399. FUNCTION("sdio", glk_scc_sdio_groups),
  400. FUNCTION("uart1", glk_scc_uart1_groups),
  401. FUNCTION("emmc", glk_scc_emmc_groups),
  402. };
  403. static const struct intel_community glk_scc_communities[] = {
  404. GLK_COMMUNITY(0, 34),
  405. };
  406. static const struct intel_pinctrl_soc_data glk_scc_soc_data = {
  407. .uid = "4",
  408. .pins = glk_scc_pins,
  409. .npins = ARRAY_SIZE(glk_scc_pins),
  410. .groups = glk_scc_groups,
  411. .ngroups = ARRAY_SIZE(glk_scc_groups),
  412. .functions = glk_scc_functions,
  413. .nfunctions = ARRAY_SIZE(glk_scc_functions),
  414. .communities = glk_scc_communities,
  415. .ncommunities = ARRAY_SIZE(glk_scc_communities),
  416. };
  417. static const struct intel_pinctrl_soc_data *glk_pinctrl_soc_data[] = {
  418. &glk_northwest_soc_data,
  419. &glk_north_soc_data,
  420. &glk_audio_soc_data,
  421. &glk_scc_soc_data,
  422. NULL,
  423. };
  424. static const struct acpi_device_id glk_pinctrl_acpi_match[] = {
  425. { "INT3453" },
  426. { }
  427. };
  428. MODULE_DEVICE_TABLE(acpi, glk_pinctrl_acpi_match);
  429. static int glk_pinctrl_probe(struct platform_device *pdev)
  430. {
  431. const struct intel_pinctrl_soc_data *soc_data = NULL;
  432. struct acpi_device *adev;
  433. int i;
  434. adev = ACPI_COMPANION(&pdev->dev);
  435. if (!adev)
  436. return -ENODEV;
  437. for (i = 0; glk_pinctrl_soc_data[i]; i++) {
  438. if (!strcmp(adev->pnp.unique_id,
  439. glk_pinctrl_soc_data[i]->uid)) {
  440. soc_data = glk_pinctrl_soc_data[i];
  441. break;
  442. }
  443. }
  444. if (!soc_data)
  445. return -ENODEV;
  446. return intel_pinctrl_probe(pdev, soc_data);
  447. }
  448. static const struct dev_pm_ops glk_pinctrl_pm_ops = {
  449. SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_pinctrl_suspend,
  450. intel_pinctrl_resume)
  451. };
  452. static struct platform_driver glk_pinctrl_driver = {
  453. .probe = glk_pinctrl_probe,
  454. .driver = {
  455. .name = "geminilake-pinctrl",
  456. .acpi_match_table = glk_pinctrl_acpi_match,
  457. .pm = &glk_pinctrl_pm_ops,
  458. },
  459. };
  460. static int __init glk_pinctrl_init(void)
  461. {
  462. return platform_driver_register(&glk_pinctrl_driver);
  463. }
  464. subsys_initcall(glk_pinctrl_init);
  465. static void __exit glk_pinctrl_exit(void)
  466. {
  467. platform_driver_unregister(&glk_pinctrl_driver);
  468. }
  469. module_exit(glk_pinctrl_exit);
  470. MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
  471. MODULE_DESCRIPTION("Intel Gemini Lake SoC pinctrl/GPIO driver");
  472. MODULE_LICENSE("GPL v2");