berlin-bg2q.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  1. /*
  2. * Marvell Berlin BG2Q pinctrl driver
  3. *
  4. * Copyright (C) 2014 Marvell Technology Group Ltd.
  5. *
  6. * Antoine Ténart <antoine.tenart@free-electrons.com>
  7. *
  8. * This file is licensed under the terms of the GNU General Public
  9. * License version 2. This program is licensed "as is" without any
  10. * warranty of any kind, whether express or implied.
  11. */
  12. #include <linux/module.h>
  13. #include <linux/of_device.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/regmap.h>
  16. #include "berlin.h"
  17. static const struct berlin_desc_group berlin2q_soc_pinctrl_groups[] = {
  18. /* G */
  19. BERLIN_PINCTRL_GROUP("G0", 0x18, 0x3, 0x00,
  20. BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
  21. BERLIN_PINCTRL_FUNCTION(0x1, "mmc"),
  22. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  23. BERLIN_PINCTRL_GROUP("G1", 0x18, 0x3, 0x03,
  24. BERLIN_PINCTRL_FUNCTION(0x0, "nand"),
  25. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  26. BERLIN_PINCTRL_GROUP("G2", 0x18, 0x3, 0x06,
  27. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  28. BERLIN_PINCTRL_FUNCTION(0x2, "arc"),
  29. BERLIN_PINCTRL_FUNCTION(0x3, "lvds")),
  30. BERLIN_PINCTRL_GROUP("G3", 0x18, 0x3, 0x09,
  31. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  32. BERLIN_PINCTRL_FUNCTION(0x2, "i2s2"),
  33. BERLIN_PINCTRL_FUNCTION(0x3, "lvds")),
  34. BERLIN_PINCTRL_GROUP("G4", 0x18, 0x3, 0x0c,
  35. BERLIN_PINCTRL_FUNCTION(0x0, "pll"),
  36. BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
  37. BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
  38. BERLIN_PINCTRL_FUNCTION(0x3, "gpio"),
  39. BERLIN_PINCTRL_FUNCTION(0x5, "sata_dbg"),
  40. BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  41. BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  42. BERLIN_PINCTRL_GROUP("G5", 0x18, 0x3, 0x0f,
  43. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  44. BERLIN_PINCTRL_FUNCTION(0x1, "sd0"),
  45. BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
  46. BERLIN_PINCTRL_FUNCTION(0x5, "sata_dbg"),
  47. BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  48. BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  49. BERLIN_PINCTRL_GROUP("G6", 0x18, 0x3, 0x12,
  50. BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
  51. BERLIN_PINCTRL_FUNCTION(0x1, "twsi0"),
  52. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  53. BERLIN_PINCTRL_GROUP("G7", 0x18, 0x3, 0x15,
  54. BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
  55. BERLIN_PINCTRL_FUNCTION(0x1, "twsi1"),
  56. BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
  57. BERLIN_PINCTRL_FUNCTION(0x3, "eddc")),
  58. BERLIN_PINCTRL_GROUP("G8", 0x18, 0x3, 0x18,
  59. BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* CLK/SDI/SDO */
  60. BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  61. BERLIN_PINCTRL_GROUP("G9", 0x18, 0x3, 0x1b,
  62. BERLIN_PINCTRL_FUNCTION(0x0, "spi1"), /* SS0n/SS1n */
  63. BERLIN_PINCTRL_FUNCTION(0x1, "gpio"),
  64. BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
  65. BERLIN_PINCTRL_GROUP("G10", 0x1c, 0x3, 0x00,
  66. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  67. BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS2n */
  68. BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"),
  69. BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
  70. BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
  71. BERLIN_PINCTRL_GROUP("G11", 0x1c, 0x3, 0x03,
  72. BERLIN_PINCTRL_FUNCTION(0x0, "jtag"),
  73. BERLIN_PINCTRL_FUNCTION(0x1, "spi1"), /* SS3n */
  74. BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
  75. BERLIN_PINCTRL_FUNCTION(0x3, "i2s1"),
  76. BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
  77. BERLIN_PINCTRL_FUNCTION(0x5, "sata")),
  78. BERLIN_PINCTRL_GROUP("G12", 0x1c, 0x3, 0x06,
  79. BERLIN_PINCTRL_FUNCTION(0x0, "agc"),
  80. BERLIN_PINCTRL_FUNCTION(0x1, "gpio")),
  81. BERLIN_PINCTRL_GROUP("G13", 0x1c, 0x3, 0x09,
  82. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  83. BERLIN_PINCTRL_FUNCTION(0x1, "sts1"),
  84. BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
  85. BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  86. BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  87. BERLIN_PINCTRL_GROUP("G14", 0x1c, 0x3, 0x0c,
  88. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  89. BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
  90. BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
  91. BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  92. BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  93. BERLIN_PINCTRL_GROUP("G15", 0x1c, 0x3, 0x0f,
  94. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  95. BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
  96. BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
  97. BERLIN_PINCTRL_FUNCTION(0x5, "vdac"),
  98. BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  99. BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  100. BERLIN_PINCTRL_GROUP("G16", 0x1c, 0x3, 0x12,
  101. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  102. BERLIN_PINCTRL_FUNCTION(0x1, "sts0"),
  103. BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
  104. BERLIN_PINCTRL_FUNCTION(0x5, "osco"),
  105. BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  106. BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  107. BERLIN_PINCTRL_GROUP("G17", 0x1c, 0x3, 0x15,
  108. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  109. BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
  110. BERLIN_PINCTRL_FUNCTION(0x3, "spdif"),
  111. BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
  112. BERLIN_PINCTRL_FUNCTION(0x6, "usb0_dbg"),
  113. BERLIN_PINCTRL_FUNCTION(0x7, "usb1_dbg")),
  114. BERLIN_PINCTRL_GROUP("G18", 0x1c, 0x3, 0x18,
  115. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  116. BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
  117. BERLIN_PINCTRL_FUNCTION(0x3, "i2s2"),
  118. BERLIN_PINCTRL_FUNCTION(0x4, "sts1")),
  119. BERLIN_PINCTRL_GROUP("G19", 0x1c, 0x3, 0x1b,
  120. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  121. BERLIN_PINCTRL_FUNCTION(0x2, "rgmii"),
  122. BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
  123. BERLIN_PINCTRL_FUNCTION(0x4, "sts1"),
  124. BERLIN_PINCTRL_FUNCTION(0x5, "osco")),
  125. BERLIN_PINCTRL_GROUP("G20", 0x20, 0x3, 0x00,
  126. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  127. BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
  128. BERLIN_PINCTRL_FUNCTION(0x3, "demod"),
  129. /*
  130. * Mode 0x4 mux usb2_dbg *and* usb3_dbg:
  131. * add two functions so it can be used with other groups
  132. * within the same subnode in the device tree
  133. */
  134. BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg"),
  135. BERLIN_PINCTRL_FUNCTION(0x4, "usb3_dbg")),
  136. BERLIN_PINCTRL_GROUP("G21", 0x20, 0x3, 0x03,
  137. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  138. BERLIN_PINCTRL_FUNCTION(0x1, "sts2"),
  139. BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
  140. BERLIN_PINCTRL_FUNCTION(0x3, "demod")),
  141. BERLIN_PINCTRL_GROUP("G22", 0x20, 0x3, 0x06,
  142. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  143. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  144. BERLIN_PINCTRL_GROUP("G23", 0x20, 0x3, 0x09,
  145. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  146. BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
  147. BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
  148. BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
  149. BERLIN_PINCTRL_GROUP("G24", 0x20, 0x3, 0x0c,
  150. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  151. BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
  152. BERLIN_PINCTRL_FUNCTION(0x3, "demod"),
  153. BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
  154. BERLIN_PINCTRL_GROUP("G25", 0x20, 0x3, 0x0f,
  155. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  156. BERLIN_PINCTRL_FUNCTION(0x1, "vga"),
  157. BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
  158. BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
  159. BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
  160. BERLIN_PINCTRL_GROUP("G26", 0x20, 0x3, 0x12,
  161. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  162. BERLIN_PINCTRL_FUNCTION(0x1, "lvds"),
  163. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  164. BERLIN_PINCTRL_GROUP("G27", 0x20, 0x3, 0x15,
  165. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  166. BERLIN_PINCTRL_FUNCTION(0x1, "agc"),
  167. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  168. BERLIN_PINCTRL_GROUP("G28", 0x20, 0x3, 0x18,
  169. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  170. BERLIN_PINCTRL_FUNCTION(0x2, "gpio"),
  171. BERLIN_PINCTRL_FUNCTION(0x3, "avif"),
  172. BERLIN_PINCTRL_FUNCTION(0x4, "usb2_dbg")),
  173. BERLIN_PINCTRL_GROUP("G29", 0x20, 0x3, 0x1b,
  174. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  175. BERLIN_PINCTRL_FUNCTION(0x1, "scrd0"),
  176. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  177. BERLIN_PINCTRL_GROUP("G30", 0x24, 0x3, 0x00,
  178. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  179. BERLIN_PINCTRL_FUNCTION(0x1, "scrd1"),
  180. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  181. BERLIN_PINCTRL_GROUP("G31", 0x24, 0x3, 0x03,
  182. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  183. BERLIN_PINCTRL_FUNCTION(0x1, "sd1"),
  184. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  185. BERLIN_PINCTRL_GROUP("G32", 0x24, 0x3, 0x06,
  186. BERLIN_PINCTRL_FUNCTION(0x0, "cam"),
  187. BERLIN_PINCTRL_FUNCTION(0x1, "sd1"),
  188. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  189. /* GAV */
  190. BERLIN_PINCTRL_GROUP("GAV0", 0x24, 0x3, 0x09,
  191. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  192. BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
  193. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  194. BERLIN_PINCTRL_FUNCTION(0x4, "lvds")),
  195. BERLIN_PINCTRL_GROUP("GAV1", 0x24, 0x3, 0x0c,
  196. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  197. BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
  198. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  199. BERLIN_PINCTRL_FUNCTION(0x4, "vga")),
  200. BERLIN_PINCTRL_GROUP("GAV2", 0x24, 0x3, 0x0f,
  201. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  202. BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
  203. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  204. BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
  205. BERLIN_PINCTRL_FUNCTION(0x4, "pdm"),
  206. BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
  207. BERLIN_PINCTRL_GROUP("GAV3", 0x24, 0x3, 0x12,
  208. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  209. BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
  210. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  211. BERLIN_PINCTRL_FUNCTION(0x3, "i2s3"),
  212. BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
  213. BERLIN_PINCTRL_GROUP("GAV4", 0x24, 0x3, 0x15,
  214. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  215. BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
  216. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  217. BERLIN_PINCTRL_FUNCTION(0x4, "i2s1"),
  218. BERLIN_PINCTRL_FUNCTION(0x6, "adac")),
  219. BERLIN_PINCTRL_GROUP("GAV5", 0x24, 0x3, 0x18,
  220. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  221. BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
  222. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  223. BERLIN_PINCTRL_FUNCTION(0x4, "spdif")),
  224. BERLIN_PINCTRL_GROUP("GAV6", 0x24, 0x3, 0x1b,
  225. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  226. BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
  227. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  228. BERLIN_PINCTRL_FUNCTION(0x4, "i2s2")),
  229. BERLIN_PINCTRL_GROUP("GAV7", 0x28, 0x3, 0x00,
  230. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  231. BERLIN_PINCTRL_FUNCTION(0x1, "dvio"),
  232. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  233. BERLIN_PINCTRL_FUNCTION(0x4, "i2s3")),
  234. BERLIN_PINCTRL_GROUP("GAV8", 0x28, 0x3, 0x03,
  235. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  236. BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
  237. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  238. BERLIN_PINCTRL_FUNCTION(0x4, "pwm")),
  239. BERLIN_PINCTRL_GROUP("GAV9", 0x28, 0x3, 0x06,
  240. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  241. BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
  242. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  243. BERLIN_PINCTRL_FUNCTION(0x4, "pwm")),
  244. BERLIN_PINCTRL_GROUP("GAV10", 0x28, 0x3, 0x09,
  245. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  246. BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
  247. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  248. BERLIN_PINCTRL_FUNCTION(0x4, "agc")),
  249. BERLIN_PINCTRL_GROUP("GAV11", 0x28, 0x3, 0x0c,
  250. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  251. BERLIN_PINCTRL_FUNCTION(0x1, "dv0"),
  252. BERLIN_PINCTRL_FUNCTION(0x2, "fp"),
  253. BERLIN_PINCTRL_FUNCTION(0x3, "i2s0"),
  254. BERLIN_PINCTRL_FUNCTION(0x4, "pwm"),
  255. BERLIN_PINCTRL_FUNCTION(0x5, "vclki")),
  256. BERLIN_PINCTRL_GROUP("GAV12", 0x28, 0x3, 0x0f,
  257. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  258. BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
  259. BERLIN_PINCTRL_FUNCTION(0x2, "i2s1")),
  260. BERLIN_PINCTRL_GROUP("GAV13", 0x28, 0x3, 0x12,
  261. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  262. BERLIN_PINCTRL_FUNCTION(0x1, "i2s2")),
  263. BERLIN_PINCTRL_GROUP("GAV14", 0x28, 0x3, 0x15,
  264. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  265. BERLIN_PINCTRL_FUNCTION(0x1, "i2s2"),
  266. BERLIN_PINCTRL_FUNCTION(0x2, "i2s1")),
  267. BERLIN_PINCTRL_GROUP("GAV15", 0x28, 0x3, 0x18,
  268. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  269. BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"),
  270. BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
  271. BERLIN_PINCTRL_GROUP("GAV16", 0x28, 0x3, 0x1b,
  272. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  273. BERLIN_PINCTRL_FUNCTION(0x1, "i2s0"),
  274. BERLIN_PINCTRL_FUNCTION(0x2, "i2s1"),
  275. BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
  276. BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
  277. BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
  278. BERLIN_PINCTRL_GROUP("GAV17", 0x2c, 0x3, 0x00,
  279. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  280. BERLIN_PINCTRL_FUNCTION(0x1, "i2s0"),
  281. BERLIN_PINCTRL_FUNCTION(0x2, "i2s1"),
  282. BERLIN_PINCTRL_FUNCTION(0x3, "pwm"),
  283. BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
  284. BERLIN_PINCTRL_FUNCTION(0x5, "pdm"),
  285. BERLIN_PINCTRL_FUNCTION(0x6, "dac_dbg")),
  286. BERLIN_PINCTRL_GROUP("GAV18", 0x2c, 0x3, 0x03,
  287. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  288. BERLIN_PINCTRL_FUNCTION(0x1, "spdif"),
  289. BERLIN_PINCTRL_FUNCTION(0x2, "arc")),
  290. BERLIN_PINCTRL_GROUP("GAV19", 0x2c, 0x3, 0x06,
  291. BERLIN_PINCTRL_FUNCTION(0x0, "avio"),
  292. BERLIN_PINCTRL_FUNCTION(0x1, "spdif"),
  293. BERLIN_PINCTRL_FUNCTION(0x4, "i2s3"),
  294. BERLIN_PINCTRL_FUNCTION(0x5, "pdm")),
  295. };
  296. static const struct berlin_desc_group berlin2q_sysmgr_pinctrl_groups[] = {
  297. /* GSM */
  298. BERLIN_PINCTRL_GROUP("GSM0", 0x40, 0x2, 0x00,
  299. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  300. BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS0n */
  301. BERLIN_PINCTRL_FUNCTION(0x2, "eth1")),
  302. BERLIN_PINCTRL_GROUP("GSM1", 0x40, 0x2, 0x02,
  303. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  304. BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS1n */
  305. BERLIN_PINCTRL_FUNCTION(0x2, "eth1")),
  306. BERLIN_PINCTRL_GROUP("GSM2", 0x40, 0x2, 0x04,
  307. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  308. BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* SS2n/SS3n */
  309. BERLIN_PINCTRL_FUNCTION(0x2, "eddc")),
  310. BERLIN_PINCTRL_GROUP("GSM3", 0x40, 0x2, 0x06,
  311. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  312. BERLIN_PINCTRL_FUNCTION(0x1, "spi2"), /* CLK/SDO */
  313. BERLIN_PINCTRL_FUNCTION(0x2, "eddc")),
  314. BERLIN_PINCTRL_GROUP("GSM4", 0x40, 0x1, 0x08,
  315. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  316. BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
  317. BERLIN_PINCTRL_GROUP("GSM5", 0x40, 0x1, 0x09,
  318. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  319. BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
  320. BERLIN_PINCTRL_GROUP("GSM6", 0x40, 0x1, 0x0a,
  321. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  322. BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
  323. BERLIN_PINCTRL_GROUP("GSM7", 0x40, 0x1, 0x0b,
  324. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  325. BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
  326. BERLIN_PINCTRL_GROUP("GSM8", 0x40, 0x1, 0x0c,
  327. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  328. BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
  329. BERLIN_PINCTRL_GROUP("GSM9", 0x40, 0x1, 0x0d,
  330. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  331. BERLIN_PINCTRL_FUNCTION(0x1, "hdmi")),
  332. BERLIN_PINCTRL_GROUP("GSM10", 0x40, 0x1, 0x0e,
  333. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  334. BERLIN_PINCTRL_FUNCTION(0x1, "led")),
  335. BERLIN_PINCTRL_GROUP("GSM11", 0x40, 0x1, 0x0f,
  336. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  337. BERLIN_PINCTRL_FUNCTION(0x1, "led")),
  338. BERLIN_PINCTRL_GROUP("GSM12", 0x40, 0x2, 0x10,
  339. BERLIN_PINCTRL_FUNCTION(0x0, "uart0"), /* RX/TX */
  340. BERLIN_PINCTRL_FUNCTION(0x1, "irda0"),
  341. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  342. BERLIN_PINCTRL_GROUP("GSM13", 0x40, 0x2, 0x12,
  343. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  344. BERLIN_PINCTRL_FUNCTION(0x1, "uart0"), /* CTS/RTS */
  345. BERLIN_PINCTRL_FUNCTION(0x2, "uart1"), /* RX/TX */
  346. BERLIN_PINCTRL_FUNCTION(0x3, "twsi2")),
  347. BERLIN_PINCTRL_GROUP("GSM14", 0x40, 0x2, 0x14,
  348. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  349. BERLIN_PINCTRL_FUNCTION(0x1, "uart1"), /* RX/TX */
  350. BERLIN_PINCTRL_FUNCTION(0x2, "irda1"),
  351. BERLIN_PINCTRL_FUNCTION(0x3, "twsi3")),
  352. BERLIN_PINCTRL_GROUP("GSM15", 0x40, 0x2, 0x16,
  353. BERLIN_PINCTRL_FUNCTION(0x0, "pwr"),
  354. BERLIN_PINCTRL_FUNCTION(0x1, "led"),
  355. BERLIN_PINCTRL_FUNCTION(0x2, "gpio")),
  356. BERLIN_PINCTRL_GROUP("GSM16", 0x40, 0x1, 0x18,
  357. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  358. BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
  359. BERLIN_PINCTRL_GROUP("GSM17", 0x40, 0x1, 0x19,
  360. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  361. BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
  362. BERLIN_PINCTRL_GROUP("GSM18", 0x40, 0x1, 0x1a,
  363. BERLIN_PINCTRL_FUNCTION(0x0, "gpio"),
  364. BERLIN_PINCTRL_FUNCTION(0x1, "eddc")),
  365. };
  366. static const struct berlin_pinctrl_desc berlin2q_soc_pinctrl_data = {
  367. .groups = berlin2q_soc_pinctrl_groups,
  368. .ngroups = ARRAY_SIZE(berlin2q_soc_pinctrl_groups),
  369. };
  370. static const struct berlin_pinctrl_desc berlin2q_sysmgr_pinctrl_data = {
  371. .groups = berlin2q_sysmgr_pinctrl_groups,
  372. .ngroups = ARRAY_SIZE(berlin2q_sysmgr_pinctrl_groups),
  373. };
  374. static const struct of_device_id berlin2q_pinctrl_match[] = {
  375. {
  376. .compatible = "marvell,berlin2q-soc-pinctrl",
  377. .data = &berlin2q_soc_pinctrl_data,
  378. },
  379. {
  380. .compatible = "marvell,berlin2q-system-pinctrl",
  381. .data = &berlin2q_sysmgr_pinctrl_data,
  382. },
  383. {}
  384. };
  385. MODULE_DEVICE_TABLE(of, berlin2q_pinctrl_match);
  386. static int berlin2q_pinctrl_probe(struct platform_device *pdev)
  387. {
  388. const struct of_device_id *match =
  389. of_match_device(berlin2q_pinctrl_match, &pdev->dev);
  390. return berlin_pinctrl_probe(pdev, match->data);
  391. }
  392. static struct platform_driver berlin2q_pinctrl_driver = {
  393. .probe = berlin2q_pinctrl_probe,
  394. .driver = {
  395. .name = "berlin-bg2q-pinctrl",
  396. .of_match_table = berlin2q_pinctrl_match,
  397. },
  398. };
  399. module_platform_driver(berlin2q_pinctrl_driver);
  400. MODULE_AUTHOR("Antoine Ténart <antoine.tenart@free-electrons.com>");
  401. MODULE_DESCRIPTION("Marvell Berlin BG2Q pinctrl driver");
  402. MODULE_LICENSE("GPL");