pinctrl-armada-375.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. /*
  2. * Marvell Armada 375 pinctrl driver based on mvebu pinctrl core
  3. *
  4. * Copyright (C) 2012 Marvell
  5. *
  6. * Thomas Petazzoni <thomas.petazzoni@free-electrons.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 as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. */
  13. #include <linux/err.h>
  14. #include <linux/init.h>
  15. #include <linux/io.h>
  16. #include <linux/module.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/clk.h>
  19. #include <linux/of.h>
  20. #include <linux/of_device.h>
  21. #include <linux/pinctrl/pinctrl.h>
  22. #include "pinctrl-mvebu.h"
  23. static void __iomem *mpp_base;
  24. static int armada_375_mpp_ctrl_get(unsigned pid, unsigned long *config)
  25. {
  26. return default_mpp_ctrl_get(mpp_base, pid, config);
  27. }
  28. static int armada_375_mpp_ctrl_set(unsigned pid, unsigned long config)
  29. {
  30. return default_mpp_ctrl_set(mpp_base, pid, config);
  31. }
  32. static struct mvebu_mpp_mode mv88f6720_mpp_modes[] = {
  33. MPP_MODE(0,
  34. MPP_FUNCTION(0x0, "gpio", NULL),
  35. MPP_FUNCTION(0x1, "dev", "ad2"),
  36. MPP_FUNCTION(0x2, "spi0", "cs1"),
  37. MPP_FUNCTION(0x3, "spi1", "cs1"),
  38. MPP_FUNCTION(0x5, "nand", "io2")),
  39. MPP_MODE(1,
  40. MPP_FUNCTION(0x0, "gpio", NULL),
  41. MPP_FUNCTION(0x1, "dev", "ad3"),
  42. MPP_FUNCTION(0x2, "spi0", "mosi"),
  43. MPP_FUNCTION(0x3, "spi1", "mosi"),
  44. MPP_FUNCTION(0x5, "nand", "io3")),
  45. MPP_MODE(2,
  46. MPP_FUNCTION(0x0, "gpio", NULL),
  47. MPP_FUNCTION(0x1, "dev", "ad4"),
  48. MPP_FUNCTION(0x2, "ptp", "evreq"),
  49. MPP_FUNCTION(0x3, "led", "c0"),
  50. MPP_FUNCTION(0x4, "audio", "sdi"),
  51. MPP_FUNCTION(0x5, "nand", "io4"),
  52. MPP_FUNCTION(0x6, "spi1", "mosi")),
  53. MPP_MODE(3,
  54. MPP_FUNCTION(0x0, "gpio", NULL),
  55. MPP_FUNCTION(0x1, "dev", "ad5"),
  56. MPP_FUNCTION(0x2, "ptp", "trig"),
  57. MPP_FUNCTION(0x3, "led", "p3"),
  58. MPP_FUNCTION(0x4, "audio", "mclk"),
  59. MPP_FUNCTION(0x5, "nand", "io5"),
  60. MPP_FUNCTION(0x6, "spi1", "miso")),
  61. MPP_MODE(4,
  62. MPP_FUNCTION(0x0, "gpio", NULL),
  63. MPP_FUNCTION(0x1, "dev", "ad6"),
  64. MPP_FUNCTION(0x2, "spi0", "miso"),
  65. MPP_FUNCTION(0x3, "spi1", "miso"),
  66. MPP_FUNCTION(0x5, "nand", "io6")),
  67. MPP_MODE(5,
  68. MPP_FUNCTION(0x0, "gpio", NULL),
  69. MPP_FUNCTION(0x1, "dev", "ad7"),
  70. MPP_FUNCTION(0x2, "spi0", "cs2"),
  71. MPP_FUNCTION(0x3, "spi1", "cs2"),
  72. MPP_FUNCTION(0x5, "nand", "io7"),
  73. MPP_FUNCTION(0x6, "spi1", "miso")),
  74. MPP_MODE(6,
  75. MPP_FUNCTION(0x0, "gpio", NULL),
  76. MPP_FUNCTION(0x1, "dev", "ad0"),
  77. MPP_FUNCTION(0x3, "led", "p1"),
  78. MPP_FUNCTION(0x4, "audio", "lrclk"),
  79. MPP_FUNCTION(0x5, "nand", "io0")),
  80. MPP_MODE(7,
  81. MPP_FUNCTION(0x0, "gpio", NULL),
  82. MPP_FUNCTION(0x1, "dev", "ad1"),
  83. MPP_FUNCTION(0x2, "ptp", "clk"),
  84. MPP_FUNCTION(0x3, "led", "p2"),
  85. MPP_FUNCTION(0x4, "audio", "extclk"),
  86. MPP_FUNCTION(0x5, "nand", "io1")),
  87. MPP_MODE(8,
  88. MPP_FUNCTION(0x0, "gpio", NULL),
  89. MPP_FUNCTION(0x1, "dev", "bootcs"),
  90. MPP_FUNCTION(0x2, "spi0", "cs0"),
  91. MPP_FUNCTION(0x3, "spi1", "cs0"),
  92. MPP_FUNCTION(0x5, "nand", "ce")),
  93. MPP_MODE(9,
  94. MPP_FUNCTION(0x0, "gpio", NULL),
  95. MPP_FUNCTION(0x2, "spi0", "sck"),
  96. MPP_FUNCTION(0x3, "spi1", "sck"),
  97. MPP_FUNCTION(0x5, "nand", "we")),
  98. MPP_MODE(10,
  99. MPP_FUNCTION(0x0, "gpio", NULL),
  100. MPP_FUNCTION(0x2, "dram", "vttctrl"),
  101. MPP_FUNCTION(0x3, "led", "c1"),
  102. MPP_FUNCTION(0x5, "nand", "re"),
  103. MPP_FUNCTION(0x6, "spi1", "sck")),
  104. MPP_MODE(11,
  105. MPP_FUNCTION(0x0, "gpio", NULL),
  106. MPP_FUNCTION(0x1, "dev", "a0"),
  107. MPP_FUNCTION(0x3, "led", "c2"),
  108. MPP_FUNCTION(0x4, "audio", "sdo"),
  109. MPP_FUNCTION(0x5, "nand", "cle")),
  110. MPP_MODE(12,
  111. MPP_FUNCTION(0x0, "gpio", NULL),
  112. MPP_FUNCTION(0x1, "dev", "a1"),
  113. MPP_FUNCTION(0x4, "audio", "bclk"),
  114. MPP_FUNCTION(0x5, "nand", "ale")),
  115. MPP_MODE(13,
  116. MPP_FUNCTION(0x0, "gpio", NULL),
  117. MPP_FUNCTION(0x1, "dev", "ready"),
  118. MPP_FUNCTION(0x2, "pcie0", "rstout"),
  119. MPP_FUNCTION(0x3, "pcie1", "rstout"),
  120. MPP_FUNCTION(0x5, "nand", "rb"),
  121. MPP_FUNCTION(0x6, "spi1", "mosi")),
  122. MPP_MODE(14,
  123. MPP_FUNCTION(0x0, "gpio", NULL),
  124. MPP_FUNCTION(0x2, "i2c0", "sda"),
  125. MPP_FUNCTION(0x3, "uart1", "txd")),
  126. MPP_MODE(15,
  127. MPP_FUNCTION(0x0, "gpio", NULL),
  128. MPP_FUNCTION(0x2, "i2c0", "sck"),
  129. MPP_FUNCTION(0x3, "uart1", "rxd")),
  130. MPP_MODE(16,
  131. MPP_FUNCTION(0x0, "gpio", NULL),
  132. MPP_FUNCTION(0x2, "uart0", "txd")),
  133. MPP_MODE(17,
  134. MPP_FUNCTION(0x0, "gpio", NULL),
  135. MPP_FUNCTION(0x2, "uart0", "rxd")),
  136. MPP_MODE(18,
  137. MPP_FUNCTION(0x0, "gpio", NULL),
  138. MPP_FUNCTION(0x2, "tdm", "int")),
  139. MPP_MODE(19,
  140. MPP_FUNCTION(0x0, "gpio", NULL),
  141. MPP_FUNCTION(0x2, "tdm", "rst")),
  142. MPP_MODE(20,
  143. MPP_FUNCTION(0x0, "gpio", NULL),
  144. MPP_FUNCTION(0x2, "tdm", "pclk")),
  145. MPP_MODE(21,
  146. MPP_FUNCTION(0x0, "gpio", NULL),
  147. MPP_FUNCTION(0x2, "tdm", "fsync")),
  148. MPP_MODE(22,
  149. MPP_FUNCTION(0x0, "gpio", NULL),
  150. MPP_FUNCTION(0x2, "tdm", "drx")),
  151. MPP_MODE(23,
  152. MPP_FUNCTION(0x0, "gpio", NULL),
  153. MPP_FUNCTION(0x2, "tdm", "dtx")),
  154. MPP_MODE(24,
  155. MPP_FUNCTION(0x0, "gpio", NULL),
  156. MPP_FUNCTION(0x1, "led", "p0"),
  157. MPP_FUNCTION(0x2, "ge1", "rxd0"),
  158. MPP_FUNCTION(0x3, "sd", "cmd"),
  159. MPP_FUNCTION(0x4, "uart0", "rts"),
  160. MPP_FUNCTION(0x5, "spi0", "cs0"),
  161. MPP_FUNCTION(0x6, "dev", "cs1")),
  162. MPP_MODE(25,
  163. MPP_FUNCTION(0x0, "gpio", NULL),
  164. MPP_FUNCTION(0x1, "led", "p2"),
  165. MPP_FUNCTION(0x2, "ge1", "rxd1"),
  166. MPP_FUNCTION(0x3, "sd", "d0"),
  167. MPP_FUNCTION(0x4, "uart0", "cts"),
  168. MPP_FUNCTION(0x5, "spi0", "mosi"),
  169. MPP_FUNCTION(0x6, "dev", "cs2")),
  170. MPP_MODE(26,
  171. MPP_FUNCTION(0x0, "gpio", NULL),
  172. MPP_FUNCTION(0x1, "pcie0", "clkreq"),
  173. MPP_FUNCTION(0x2, "ge1", "rxd2"),
  174. MPP_FUNCTION(0x3, "sd", "d2"),
  175. MPP_FUNCTION(0x4, "uart1", "rts"),
  176. MPP_FUNCTION(0x5, "spi0", "cs1"),
  177. MPP_FUNCTION(0x6, "led", "c1")),
  178. MPP_MODE(27,
  179. MPP_FUNCTION(0x0, "gpio", NULL),
  180. MPP_FUNCTION(0x1, "pcie1", "clkreq"),
  181. MPP_FUNCTION(0x2, "ge1", "rxd3"),
  182. MPP_FUNCTION(0x3, "sd", "d1"),
  183. MPP_FUNCTION(0x4, "uart1", "cts"),
  184. MPP_FUNCTION(0x5, "spi0", "miso"),
  185. MPP_FUNCTION(0x6, "led", "c2")),
  186. MPP_MODE(28,
  187. MPP_FUNCTION(0x0, "gpio", NULL),
  188. MPP_FUNCTION(0x1, "led", "p3"),
  189. MPP_FUNCTION(0x2, "ge1", "txctl"),
  190. MPP_FUNCTION(0x3, "sd", "clk"),
  191. MPP_FUNCTION(0x5, "dram", "vttctrl")),
  192. MPP_MODE(29,
  193. MPP_FUNCTION(0x0, "gpio", NULL),
  194. MPP_FUNCTION(0x1, "pcie1", "clkreq"),
  195. MPP_FUNCTION(0x2, "ge1", "rxclk"),
  196. MPP_FUNCTION(0x3, "sd", "d3"),
  197. MPP_FUNCTION(0x5, "spi0", "sck"),
  198. MPP_FUNCTION(0x6, "pcie0", "rstout")),
  199. MPP_MODE(30,
  200. MPP_FUNCTION(0x0, "gpio", NULL),
  201. MPP_FUNCTION(0x2, "ge1", "txd0"),
  202. MPP_FUNCTION(0x3, "spi1", "cs0"),
  203. MPP_FUNCTION(0x5, "led", "p3"),
  204. MPP_FUNCTION(0x6, "ptp", "evreq")),
  205. MPP_MODE(31,
  206. MPP_FUNCTION(0x0, "gpio", NULL),
  207. MPP_FUNCTION(0x2, "ge1", "txd1"),
  208. MPP_FUNCTION(0x3, "spi1", "mosi"),
  209. MPP_FUNCTION(0x5, "led", "p0")),
  210. MPP_MODE(32,
  211. MPP_FUNCTION(0x0, "gpio", NULL),
  212. MPP_FUNCTION(0x2, "ge1", "txd2"),
  213. MPP_FUNCTION(0x3, "spi1", "sck"),
  214. MPP_FUNCTION(0x4, "ptp", "trig"),
  215. MPP_FUNCTION(0x5, "led", "c0")),
  216. MPP_MODE(33,
  217. MPP_FUNCTION(0x0, "gpio", NULL),
  218. MPP_FUNCTION(0x2, "ge1", "txd3"),
  219. MPP_FUNCTION(0x3, "spi1", "miso"),
  220. MPP_FUNCTION(0x5, "led", "p2")),
  221. MPP_MODE(34,
  222. MPP_FUNCTION(0x0, "gpio", NULL),
  223. MPP_FUNCTION(0x2, "ge1", "txclkout"),
  224. MPP_FUNCTION(0x3, "spi1", "sck"),
  225. MPP_FUNCTION(0x5, "led", "c1")),
  226. MPP_MODE(35,
  227. MPP_FUNCTION(0x0, "gpio", NULL),
  228. MPP_FUNCTION(0x2, "ge1", "rxctl"),
  229. MPP_FUNCTION(0x3, "spi1", "cs1"),
  230. MPP_FUNCTION(0x4, "spi0", "cs2"),
  231. MPP_FUNCTION(0x5, "led", "p1")),
  232. MPP_MODE(36,
  233. MPP_FUNCTION(0x0, "gpio", NULL),
  234. MPP_FUNCTION(0x1, "pcie0", "clkreq"),
  235. MPP_FUNCTION(0x5, "led", "c2")),
  236. MPP_MODE(37,
  237. MPP_FUNCTION(0x0, "gpio", NULL),
  238. MPP_FUNCTION(0x1, "pcie0", "clkreq"),
  239. MPP_FUNCTION(0x2, "tdm", "int"),
  240. MPP_FUNCTION(0x4, "ge", "mdc")),
  241. MPP_MODE(38,
  242. MPP_FUNCTION(0x0, "gpio", NULL),
  243. MPP_FUNCTION(0x1, "pcie1", "clkreq"),
  244. MPP_FUNCTION(0x4, "ge", "mdio")),
  245. MPP_MODE(39,
  246. MPP_FUNCTION(0x0, "gpio", NULL),
  247. MPP_FUNCTION(0x4, "ref", "clkout"),
  248. MPP_FUNCTION(0x5, "led", "p3")),
  249. MPP_MODE(40,
  250. MPP_FUNCTION(0x0, "gpio", NULL),
  251. MPP_FUNCTION(0x4, "uart1", "txd"),
  252. MPP_FUNCTION(0x5, "led", "p0")),
  253. MPP_MODE(41,
  254. MPP_FUNCTION(0x0, "gpio", NULL),
  255. MPP_FUNCTION(0x4, "uart1", "rxd"),
  256. MPP_FUNCTION(0x5, "led", "p1")),
  257. MPP_MODE(42,
  258. MPP_FUNCTION(0x0, "gpio", NULL),
  259. MPP_FUNCTION(0x3, "spi1", "cs2"),
  260. MPP_FUNCTION(0x4, "led", "c0"),
  261. MPP_FUNCTION(0x6, "ptp", "clk")),
  262. MPP_MODE(43,
  263. MPP_FUNCTION(0x0, "gpio", NULL),
  264. MPP_FUNCTION(0x2, "sata0", "prsnt"),
  265. MPP_FUNCTION(0x4, "dram", "vttctrl"),
  266. MPP_FUNCTION(0x5, "led", "c1")),
  267. MPP_MODE(44,
  268. MPP_FUNCTION(0x0, "gpio", NULL),
  269. MPP_FUNCTION(0x4, "sata0", "prsnt")),
  270. MPP_MODE(45,
  271. MPP_FUNCTION(0x0, "gpio", NULL),
  272. MPP_FUNCTION(0x2, "spi0", "cs2"),
  273. MPP_FUNCTION(0x4, "pcie0", "rstout"),
  274. MPP_FUNCTION(0x5, "led", "c2"),
  275. MPP_FUNCTION(0x6, "spi1", "cs2")),
  276. MPP_MODE(46,
  277. MPP_FUNCTION(0x0, "gpio", NULL),
  278. MPP_FUNCTION(0x1, "led", "p0"),
  279. MPP_FUNCTION(0x2, "ge0", "txd0"),
  280. MPP_FUNCTION(0x3, "ge1", "txd0"),
  281. MPP_FUNCTION(0x6, "dev", "we1")),
  282. MPP_MODE(47,
  283. MPP_FUNCTION(0x0, "gpio", NULL),
  284. MPP_FUNCTION(0x1, "led", "p1"),
  285. MPP_FUNCTION(0x2, "ge0", "txd1"),
  286. MPP_FUNCTION(0x3, "ge1", "txd1"),
  287. MPP_FUNCTION(0x5, "ptp", "trig"),
  288. MPP_FUNCTION(0x6, "dev", "ale0")),
  289. MPP_MODE(48,
  290. MPP_FUNCTION(0x0, "gpio", NULL),
  291. MPP_FUNCTION(0x1, "led", "p2"),
  292. MPP_FUNCTION(0x2, "ge0", "txd2"),
  293. MPP_FUNCTION(0x3, "ge1", "txd2"),
  294. MPP_FUNCTION(0x6, "dev", "ale1")),
  295. MPP_MODE(49,
  296. MPP_FUNCTION(0x0, "gpio", NULL),
  297. MPP_FUNCTION(0x1, "led", "p3"),
  298. MPP_FUNCTION(0x2, "ge0", "txd3"),
  299. MPP_FUNCTION(0x3, "ge1", "txd3"),
  300. MPP_FUNCTION(0x6, "dev", "a2")),
  301. MPP_MODE(50,
  302. MPP_FUNCTION(0x0, "gpio", NULL),
  303. MPP_FUNCTION(0x1, "led", "c0"),
  304. MPP_FUNCTION(0x2, "ge0", "rxd0"),
  305. MPP_FUNCTION(0x3, "ge1", "rxd0"),
  306. MPP_FUNCTION(0x5, "ptp", "evreq"),
  307. MPP_FUNCTION(0x6, "dev", "ad12")),
  308. MPP_MODE(51,
  309. MPP_FUNCTION(0x0, "gpio", NULL),
  310. MPP_FUNCTION(0x1, "led", "c1"),
  311. MPP_FUNCTION(0x2, "ge0", "rxd1"),
  312. MPP_FUNCTION(0x3, "ge1", "rxd1"),
  313. MPP_FUNCTION(0x6, "dev", "ad8")),
  314. MPP_MODE(52,
  315. MPP_FUNCTION(0x0, "gpio", NULL),
  316. MPP_FUNCTION(0x1, "led", "c2"),
  317. MPP_FUNCTION(0x2, "ge0", "rxd2"),
  318. MPP_FUNCTION(0x3, "ge1", "rxd2"),
  319. MPP_FUNCTION(0x5, "i2c0", "sda"),
  320. MPP_FUNCTION(0x6, "dev", "ad9")),
  321. MPP_MODE(53,
  322. MPP_FUNCTION(0x0, "gpio", NULL),
  323. MPP_FUNCTION(0x1, "pcie1", "rstout"),
  324. MPP_FUNCTION(0x2, "ge0", "rxd3"),
  325. MPP_FUNCTION(0x3, "ge1", "rxd3"),
  326. MPP_FUNCTION(0x5, "i2c0", "sck"),
  327. MPP_FUNCTION(0x6, "dev", "ad10")),
  328. MPP_MODE(54,
  329. MPP_FUNCTION(0x0, "gpio", NULL),
  330. MPP_FUNCTION(0x1, "pcie0", "rstout"),
  331. MPP_FUNCTION(0x2, "ge0", "rxctl"),
  332. MPP_FUNCTION(0x3, "ge1", "rxctl"),
  333. MPP_FUNCTION(0x6, "dev", "ad11")),
  334. MPP_MODE(55,
  335. MPP_FUNCTION(0x0, "gpio", NULL),
  336. MPP_FUNCTION(0x2, "ge0", "rxclk"),
  337. MPP_FUNCTION(0x3, "ge1", "rxclk"),
  338. MPP_FUNCTION(0x6, "dev", "cs0")),
  339. MPP_MODE(56,
  340. MPP_FUNCTION(0x0, "gpio", NULL),
  341. MPP_FUNCTION(0x2, "ge0", "txclkout"),
  342. MPP_FUNCTION(0x3, "ge1", "txclkout"),
  343. MPP_FUNCTION(0x6, "dev", "oe")),
  344. MPP_MODE(57,
  345. MPP_FUNCTION(0x0, "gpio", NULL),
  346. MPP_FUNCTION(0x2, "ge0", "txctl"),
  347. MPP_FUNCTION(0x3, "ge1", "txctl"),
  348. MPP_FUNCTION(0x6, "dev", "we0")),
  349. MPP_MODE(58,
  350. MPP_FUNCTION(0x0, "gpio", NULL),
  351. MPP_FUNCTION(0x4, "led", "c0")),
  352. MPP_MODE(59,
  353. MPP_FUNCTION(0x0, "gpio", NULL),
  354. MPP_FUNCTION(0x4, "led", "c1")),
  355. MPP_MODE(60,
  356. MPP_FUNCTION(0x0, "gpio", NULL),
  357. MPP_FUNCTION(0x2, "uart1", "txd"),
  358. MPP_FUNCTION(0x4, "led", "c2"),
  359. MPP_FUNCTION(0x6, "dev", "ad13")),
  360. MPP_MODE(61,
  361. MPP_FUNCTION(0x0, "gpio", NULL),
  362. MPP_FUNCTION(0x1, "i2c1", "sda"),
  363. MPP_FUNCTION(0x2, "uart1", "rxd"),
  364. MPP_FUNCTION(0x3, "spi1", "cs2"),
  365. MPP_FUNCTION(0x4, "led", "p0"),
  366. MPP_FUNCTION(0x6, "dev", "ad14")),
  367. MPP_MODE(62,
  368. MPP_FUNCTION(0x0, "gpio", NULL),
  369. MPP_FUNCTION(0x1, "i2c1", "sck"),
  370. MPP_FUNCTION(0x4, "led", "p1"),
  371. MPP_FUNCTION(0x6, "dev", "ad15")),
  372. MPP_MODE(63,
  373. MPP_FUNCTION(0x0, "gpio", NULL),
  374. MPP_FUNCTION(0x2, "ptp", "trig"),
  375. MPP_FUNCTION(0x4, "led", "p2"),
  376. MPP_FUNCTION(0x6, "dev", "burst/last")),
  377. MPP_MODE(64,
  378. MPP_FUNCTION(0x0, "gpio", NULL),
  379. MPP_FUNCTION(0x2, "dram", "vttctrl"),
  380. MPP_FUNCTION(0x4, "led", "p3")),
  381. MPP_MODE(65,
  382. MPP_FUNCTION(0x0, "gpio", NULL),
  383. MPP_FUNCTION(0x1, "sata1", "prsnt")),
  384. MPP_MODE(66,
  385. MPP_FUNCTION(0x0, "gpio", NULL),
  386. MPP_FUNCTION(0x2, "ptp", "evreq"),
  387. MPP_FUNCTION(0x4, "spi1", "cs3"),
  388. MPP_FUNCTION(0x5, "pcie0", "rstout"),
  389. MPP_FUNCTION(0x6, "dev", "cs3")),
  390. };
  391. static struct mvebu_pinctrl_soc_info armada_375_pinctrl_info;
  392. static const struct of_device_id armada_375_pinctrl_of_match[] = {
  393. { .compatible = "marvell,mv88f6720-pinctrl" },
  394. { },
  395. };
  396. static struct mvebu_mpp_ctrl mv88f6720_mpp_controls[] = {
  397. MPP_FUNC_CTRL(0, 69, NULL, armada_375_mpp_ctrl),
  398. };
  399. static struct pinctrl_gpio_range mv88f6720_mpp_gpio_ranges[] = {
  400. MPP_GPIO_RANGE(0, 0, 0, 32),
  401. MPP_GPIO_RANGE(1, 32, 32, 32),
  402. MPP_GPIO_RANGE(2, 64, 64, 3),
  403. };
  404. static int armada_375_pinctrl_probe(struct platform_device *pdev)
  405. {
  406. struct mvebu_pinctrl_soc_info *soc = &armada_375_pinctrl_info;
  407. struct resource *res;
  408. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  409. mpp_base = devm_ioremap_resource(&pdev->dev, res);
  410. if (IS_ERR(mpp_base))
  411. return PTR_ERR(mpp_base);
  412. soc->variant = 0; /* no variants for Armada 375 */
  413. soc->controls = mv88f6720_mpp_controls;
  414. soc->ncontrols = ARRAY_SIZE(mv88f6720_mpp_controls);
  415. soc->modes = mv88f6720_mpp_modes;
  416. soc->nmodes = ARRAY_SIZE(mv88f6720_mpp_modes);
  417. soc->gpioranges = mv88f6720_mpp_gpio_ranges;
  418. soc->ngpioranges = ARRAY_SIZE(mv88f6720_mpp_gpio_ranges);
  419. pdev->dev.platform_data = soc;
  420. return mvebu_pinctrl_probe(pdev);
  421. }
  422. static int armada_375_pinctrl_remove(struct platform_device *pdev)
  423. {
  424. return mvebu_pinctrl_remove(pdev);
  425. }
  426. static struct platform_driver armada_375_pinctrl_driver = {
  427. .driver = {
  428. .name = "armada-375-pinctrl",
  429. .of_match_table = of_match_ptr(armada_375_pinctrl_of_match),
  430. },
  431. .probe = armada_375_pinctrl_probe,
  432. .remove = armada_375_pinctrl_remove,
  433. };
  434. module_platform_driver(armada_375_pinctrl_driver);
  435. MODULE_AUTHOR("Thomas Petazzoni <thomas.petazzoni@free-electrons.com>");
  436. MODULE_DESCRIPTION("Marvell Armada 375 pinctrl driver");
  437. MODULE_LICENSE("GPL v2");