pinctrl-dove.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  1. /*
  2. * Marvell Dove pinctrl driver based on mvebu pinctrl core
  3. *
  4. * Author: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. */
  11. #include <linux/err.h>
  12. #include <linux/init.h>
  13. #include <linux/io.h>
  14. #include <linux/module.h>
  15. #include <linux/bitops.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/clk.h>
  18. #include <linux/of.h>
  19. #include <linux/of_device.h>
  20. #include <linux/pinctrl/pinctrl.h>
  21. #include "pinctrl-mvebu.h"
  22. #define DOVE_SB_REGS_VIRT_BASE IOMEM(0xfde00000)
  23. #define DOVE_MPP_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0200)
  24. #define DOVE_PMU_MPP_GENERAL_CTRL (DOVE_MPP_VIRT_BASE + 0x10)
  25. #define DOVE_AU0_AC97_SEL BIT(16)
  26. #define DOVE_PMU_SIGNAL_SELECT_0 (DOVE_SB_REGS_VIRT_BASE + 0xd802C)
  27. #define DOVE_PMU_SIGNAL_SELECT_1 (DOVE_SB_REGS_VIRT_BASE + 0xd8030)
  28. #define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C)
  29. #define DOVE_GLOBAL_CONFIG_1 (DOVE_SB_REGS_VIRT_BASE + 0xe802C)
  30. #define DOVE_TWSI_ENABLE_OPTION1 BIT(7)
  31. #define DOVE_GLOBAL_CONFIG_2 (DOVE_SB_REGS_VIRT_BASE + 0xe8030)
  32. #define DOVE_TWSI_ENABLE_OPTION2 BIT(20)
  33. #define DOVE_TWSI_ENABLE_OPTION3 BIT(21)
  34. #define DOVE_TWSI_OPTION3_GPIO BIT(22)
  35. #define DOVE_SSP_CTRL_STATUS_1 (DOVE_SB_REGS_VIRT_BASE + 0xe8034)
  36. #define DOVE_SSP_ON_AU1 BIT(0)
  37. #define DOVE_MPP_GENERAL_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xe803c)
  38. #define DOVE_AU1_SPDIFO_GPIO_EN BIT(1)
  39. #define DOVE_NAND_GPIO_EN BIT(0)
  40. #define DOVE_GPIO_LO_VIRT_BASE (DOVE_SB_REGS_VIRT_BASE + 0xd0400)
  41. #define DOVE_MPP_CTRL4_VIRT_BASE (DOVE_GPIO_LO_VIRT_BASE + 0x40)
  42. #define DOVE_SPI_GPIO_SEL BIT(5)
  43. #define DOVE_UART1_GPIO_SEL BIT(4)
  44. #define DOVE_AU1_GPIO_SEL BIT(3)
  45. #define DOVE_CAM_GPIO_SEL BIT(2)
  46. #define DOVE_SD1_GPIO_SEL BIT(1)
  47. #define DOVE_SD0_GPIO_SEL BIT(0)
  48. #define MPPS_PER_REG 8
  49. #define MPP_BITS 4
  50. #define MPP_MASK 0xf
  51. #define CONFIG_PMU BIT(4)
  52. static int dove_pmu_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl,
  53. unsigned long *config)
  54. {
  55. unsigned off = (ctrl->pid / MPPS_PER_REG) * MPP_BITS;
  56. unsigned shift = (ctrl->pid % MPPS_PER_REG) * MPP_BITS;
  57. unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL);
  58. unsigned long func;
  59. if (pmu & (1 << ctrl->pid)) {
  60. func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off);
  61. *config = (func >> shift) & MPP_MASK;
  62. *config |= CONFIG_PMU;
  63. } else {
  64. func = readl(DOVE_MPP_VIRT_BASE + off);
  65. *config = (func >> shift) & MPP_MASK;
  66. }
  67. return 0;
  68. }
  69. static int dove_pmu_mpp_ctrl_set(struct mvebu_mpp_ctrl *ctrl,
  70. unsigned long config)
  71. {
  72. unsigned off = (ctrl->pid / MPPS_PER_REG) * MPP_BITS;
  73. unsigned shift = (ctrl->pid % MPPS_PER_REG) * MPP_BITS;
  74. unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL);
  75. unsigned long func;
  76. if (config & CONFIG_PMU) {
  77. writel(pmu | (1 << ctrl->pid), DOVE_PMU_MPP_GENERAL_CTRL);
  78. func = readl(DOVE_PMU_SIGNAL_SELECT_0 + off);
  79. func &= ~(MPP_MASK << shift);
  80. func |= (config & MPP_MASK) << shift;
  81. writel(func, DOVE_PMU_SIGNAL_SELECT_0 + off);
  82. } else {
  83. writel(pmu & ~(1 << ctrl->pid), DOVE_PMU_MPP_GENERAL_CTRL);
  84. func = readl(DOVE_MPP_VIRT_BASE + off);
  85. func &= ~(MPP_MASK << shift);
  86. func |= (config & MPP_MASK) << shift;
  87. writel(func, DOVE_MPP_VIRT_BASE + off);
  88. }
  89. return 0;
  90. }
  91. static int dove_mpp4_ctrl_get(struct mvebu_mpp_ctrl *ctrl,
  92. unsigned long *config)
  93. {
  94. unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE);
  95. unsigned long mask;
  96. switch (ctrl->pid) {
  97. case 24: /* mpp_camera */
  98. mask = DOVE_CAM_GPIO_SEL;
  99. break;
  100. case 40: /* mpp_sdio0 */
  101. mask = DOVE_SD0_GPIO_SEL;
  102. break;
  103. case 46: /* mpp_sdio1 */
  104. mask = DOVE_SD1_GPIO_SEL;
  105. break;
  106. case 58: /* mpp_spi0 */
  107. mask = DOVE_SPI_GPIO_SEL;
  108. break;
  109. case 62: /* mpp_uart1 */
  110. mask = DOVE_UART1_GPIO_SEL;
  111. break;
  112. default:
  113. return -EINVAL;
  114. }
  115. *config = ((mpp4 & mask) != 0);
  116. return 0;
  117. }
  118. static int dove_mpp4_ctrl_set(struct mvebu_mpp_ctrl *ctrl,
  119. unsigned long config)
  120. {
  121. unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE);
  122. unsigned long mask;
  123. switch (ctrl->pid) {
  124. case 24: /* mpp_camera */
  125. mask = DOVE_CAM_GPIO_SEL;
  126. break;
  127. case 40: /* mpp_sdio0 */
  128. mask = DOVE_SD0_GPIO_SEL;
  129. break;
  130. case 46: /* mpp_sdio1 */
  131. mask = DOVE_SD1_GPIO_SEL;
  132. break;
  133. case 58: /* mpp_spi0 */
  134. mask = DOVE_SPI_GPIO_SEL;
  135. break;
  136. case 62: /* mpp_uart1 */
  137. mask = DOVE_UART1_GPIO_SEL;
  138. break;
  139. default:
  140. return -EINVAL;
  141. }
  142. mpp4 &= ~mask;
  143. if (config)
  144. mpp4 |= mask;
  145. writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE);
  146. return 0;
  147. }
  148. static int dove_nand_ctrl_get(struct mvebu_mpp_ctrl *ctrl,
  149. unsigned long *config)
  150. {
  151. unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE);
  152. *config = ((gmpp & DOVE_NAND_GPIO_EN) != 0);
  153. return 0;
  154. }
  155. static int dove_nand_ctrl_set(struct mvebu_mpp_ctrl *ctrl,
  156. unsigned long config)
  157. {
  158. unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE);
  159. gmpp &= ~DOVE_NAND_GPIO_EN;
  160. if (config)
  161. gmpp |= DOVE_NAND_GPIO_EN;
  162. writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE);
  163. return 0;
  164. }
  165. static int dove_audio0_ctrl_get(struct mvebu_mpp_ctrl *ctrl,
  166. unsigned long *config)
  167. {
  168. unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL);
  169. *config = ((pmu & DOVE_AU0_AC97_SEL) != 0);
  170. return 0;
  171. }
  172. static int dove_audio0_ctrl_set(struct mvebu_mpp_ctrl *ctrl,
  173. unsigned long config)
  174. {
  175. unsigned long pmu = readl(DOVE_PMU_MPP_GENERAL_CTRL);
  176. pmu &= ~DOVE_AU0_AC97_SEL;
  177. if (config)
  178. pmu |= DOVE_AU0_AC97_SEL;
  179. writel(pmu, DOVE_PMU_MPP_GENERAL_CTRL);
  180. return 0;
  181. }
  182. static int dove_audio1_ctrl_get(struct mvebu_mpp_ctrl *ctrl,
  183. unsigned long *config)
  184. {
  185. unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE);
  186. unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1);
  187. unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE);
  188. unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2);
  189. *config = 0;
  190. if (mpp4 & DOVE_AU1_GPIO_SEL)
  191. *config |= BIT(3);
  192. if (sspc1 & DOVE_SSP_ON_AU1)
  193. *config |= BIT(2);
  194. if (gmpp & DOVE_AU1_SPDIFO_GPIO_EN)
  195. *config |= BIT(1);
  196. if (gcfg2 & DOVE_TWSI_OPTION3_GPIO)
  197. *config |= BIT(0);
  198. /* SSP/TWSI only if I2S1 not set*/
  199. if ((*config & BIT(3)) == 0)
  200. *config &= ~(BIT(2) | BIT(0));
  201. /* TWSI only if SPDIFO not set*/
  202. if ((*config & BIT(1)) == 0)
  203. *config &= ~BIT(0);
  204. return 0;
  205. }
  206. static int dove_audio1_ctrl_set(struct mvebu_mpp_ctrl *ctrl,
  207. unsigned long config)
  208. {
  209. unsigned long mpp4 = readl(DOVE_MPP_CTRL4_VIRT_BASE);
  210. unsigned long sspc1 = readl(DOVE_SSP_CTRL_STATUS_1);
  211. unsigned long gmpp = readl(DOVE_MPP_GENERAL_VIRT_BASE);
  212. unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2);
  213. /*
  214. * clear all audio1 related bits before configure
  215. */
  216. gcfg2 &= ~DOVE_TWSI_OPTION3_GPIO;
  217. gmpp &= ~DOVE_AU1_SPDIFO_GPIO_EN;
  218. sspc1 &= ~DOVE_SSP_ON_AU1;
  219. mpp4 &= ~DOVE_AU1_GPIO_SEL;
  220. if (config & BIT(0))
  221. gcfg2 |= DOVE_TWSI_OPTION3_GPIO;
  222. if (config & BIT(1))
  223. gmpp |= DOVE_AU1_SPDIFO_GPIO_EN;
  224. if (config & BIT(2))
  225. sspc1 |= DOVE_SSP_ON_AU1;
  226. if (config & BIT(3))
  227. mpp4 |= DOVE_AU1_GPIO_SEL;
  228. writel(mpp4, DOVE_MPP_CTRL4_VIRT_BASE);
  229. writel(sspc1, DOVE_SSP_CTRL_STATUS_1);
  230. writel(gmpp, DOVE_MPP_GENERAL_VIRT_BASE);
  231. writel(gcfg2, DOVE_GLOBAL_CONFIG_2);
  232. return 0;
  233. }
  234. /* mpp[52:57] gpio pins depend heavily on current config;
  235. * gpio_req does not try to mux in gpio capabilities to not
  236. * break other functions. If you require all mpps as gpio
  237. * enforce gpio setting by pinctrl mapping.
  238. */
  239. static int dove_audio1_ctrl_gpio_req(struct mvebu_mpp_ctrl *ctrl, u8 pid)
  240. {
  241. unsigned long config;
  242. dove_audio1_ctrl_get(ctrl, &config);
  243. switch (config) {
  244. case 0x02: /* i2s1 : gpio[56:57] */
  245. case 0x0e: /* ssp : gpio[56:57] */
  246. if (pid >= 56)
  247. return 0;
  248. return -ENOTSUPP;
  249. case 0x08: /* spdifo : gpio[52:55] */
  250. case 0x0b: /* twsi : gpio[52:55] */
  251. if (pid <= 55)
  252. return 0;
  253. return -ENOTSUPP;
  254. case 0x0a: /* all gpio */
  255. return 0;
  256. /* 0x00 : i2s1/spdifo : no gpio */
  257. /* 0x0c : ssp/spdifo : no gpio */
  258. /* 0x0f : ssp/twsi : no gpio */
  259. }
  260. return -ENOTSUPP;
  261. }
  262. /* mpp[52:57] has gpio pins capable of in and out */
  263. static int dove_audio1_ctrl_gpio_dir(struct mvebu_mpp_ctrl *ctrl, u8 pid,
  264. bool input)
  265. {
  266. if (pid < 52 || pid > 57)
  267. return -ENOTSUPP;
  268. return 0;
  269. }
  270. static int dove_twsi_ctrl_get(struct mvebu_mpp_ctrl *ctrl,
  271. unsigned long *config)
  272. {
  273. unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1);
  274. unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2);
  275. *config = 0;
  276. if (gcfg1 & DOVE_TWSI_ENABLE_OPTION1)
  277. *config = 1;
  278. else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION2)
  279. *config = 2;
  280. else if (gcfg2 & DOVE_TWSI_ENABLE_OPTION3)
  281. *config = 3;
  282. return 0;
  283. }
  284. static int dove_twsi_ctrl_set(struct mvebu_mpp_ctrl *ctrl,
  285. unsigned long config)
  286. {
  287. unsigned long gcfg1 = readl(DOVE_GLOBAL_CONFIG_1);
  288. unsigned long gcfg2 = readl(DOVE_GLOBAL_CONFIG_2);
  289. gcfg1 &= ~DOVE_TWSI_ENABLE_OPTION1;
  290. gcfg2 &= ~(DOVE_TWSI_ENABLE_OPTION2 | DOVE_TWSI_ENABLE_OPTION2);
  291. switch (config) {
  292. case 1:
  293. gcfg1 |= DOVE_TWSI_ENABLE_OPTION1;
  294. break;
  295. case 2:
  296. gcfg2 |= DOVE_TWSI_ENABLE_OPTION2;
  297. break;
  298. case 3:
  299. gcfg2 |= DOVE_TWSI_ENABLE_OPTION3;
  300. break;
  301. }
  302. writel(gcfg1, DOVE_GLOBAL_CONFIG_1);
  303. writel(gcfg2, DOVE_GLOBAL_CONFIG_2);
  304. return 0;
  305. }
  306. static struct mvebu_mpp_ctrl dove_mpp_controls[] = {
  307. MPP_FUNC_CTRL(0, 0, "mpp0", dove_pmu_mpp_ctrl),
  308. MPP_FUNC_CTRL(1, 1, "mpp1", dove_pmu_mpp_ctrl),
  309. MPP_FUNC_CTRL(2, 2, "mpp2", dove_pmu_mpp_ctrl),
  310. MPP_FUNC_CTRL(3, 3, "mpp3", dove_pmu_mpp_ctrl),
  311. MPP_FUNC_CTRL(4, 4, "mpp4", dove_pmu_mpp_ctrl),
  312. MPP_FUNC_CTRL(5, 5, "mpp5", dove_pmu_mpp_ctrl),
  313. MPP_FUNC_CTRL(6, 6, "mpp6", dove_pmu_mpp_ctrl),
  314. MPP_FUNC_CTRL(7, 7, "mpp7", dove_pmu_mpp_ctrl),
  315. MPP_FUNC_CTRL(8, 8, "mpp8", dove_pmu_mpp_ctrl),
  316. MPP_FUNC_CTRL(9, 9, "mpp9", dove_pmu_mpp_ctrl),
  317. MPP_FUNC_CTRL(10, 10, "mpp10", dove_pmu_mpp_ctrl),
  318. MPP_FUNC_CTRL(11, 11, "mpp11", dove_pmu_mpp_ctrl),
  319. MPP_FUNC_CTRL(12, 12, "mpp12", dove_pmu_mpp_ctrl),
  320. MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl),
  321. MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl),
  322. MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl),
  323. MPP_REG_CTRL(16, 23),
  324. MPP_FUNC_CTRL(24, 39, "mpp_camera", dove_mpp4_ctrl),
  325. MPP_FUNC_CTRL(40, 45, "mpp_sdio0", dove_mpp4_ctrl),
  326. MPP_FUNC_CTRL(46, 51, "mpp_sdio1", dove_mpp4_ctrl),
  327. MPP_FUNC_GPIO_CTRL(52, 57, "mpp_audio1", dove_audio1_ctrl),
  328. MPP_FUNC_CTRL(58, 61, "mpp_spi0", dove_mpp4_ctrl),
  329. MPP_FUNC_CTRL(62, 63, "mpp_uart1", dove_mpp4_ctrl),
  330. MPP_FUNC_CTRL(64, 71, "mpp_nand", dove_nand_ctrl),
  331. MPP_FUNC_CTRL(72, 72, "audio0", dove_audio0_ctrl),
  332. MPP_FUNC_CTRL(73, 73, "twsi", dove_twsi_ctrl),
  333. };
  334. static struct mvebu_mpp_mode dove_mpp_modes[] = {
  335. MPP_MODE(0,
  336. MPP_FUNCTION(0x00, "gpio", NULL),
  337. MPP_FUNCTION(0x02, "uart2", "rts"),
  338. MPP_FUNCTION(0x03, "sdio0", "cd"),
  339. MPP_FUNCTION(0x0f, "lcd0", "pwm"),
  340. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  341. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  342. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  343. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  344. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  345. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  346. MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
  347. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  348. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  349. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  350. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  351. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  352. MPP_MODE(1,
  353. MPP_FUNCTION(0x00, "gpio", NULL),
  354. MPP_FUNCTION(0x02, "uart2", "cts"),
  355. MPP_FUNCTION(0x03, "sdio0", "wp"),
  356. MPP_FUNCTION(0x0f, "lcd1", "pwm"),
  357. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  358. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  359. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  360. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  361. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  362. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  363. MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
  364. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  365. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  366. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  367. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  368. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  369. MPP_MODE(2,
  370. MPP_FUNCTION(0x00, "gpio", NULL),
  371. MPP_FUNCTION(0x01, "sata", "prsnt"),
  372. MPP_FUNCTION(0x02, "uart2", "txd"),
  373. MPP_FUNCTION(0x03, "sdio0", "buspwr"),
  374. MPP_FUNCTION(0x04, "uart1", "rts"),
  375. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  376. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  377. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  378. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  379. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  380. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  381. MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
  382. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  383. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  384. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  385. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  386. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  387. MPP_MODE(3,
  388. MPP_FUNCTION(0x00, "gpio", NULL),
  389. MPP_FUNCTION(0x01, "sata", "act"),
  390. MPP_FUNCTION(0x02, "uart2", "rxd"),
  391. MPP_FUNCTION(0x03, "sdio0", "ledctrl"),
  392. MPP_FUNCTION(0x04, "uart1", "cts"),
  393. MPP_FUNCTION(0x0f, "lcd-spi", "cs1"),
  394. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  395. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  396. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  397. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  398. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  399. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  400. MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
  401. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  402. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  403. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  404. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  405. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  406. MPP_MODE(4,
  407. MPP_FUNCTION(0x00, "gpio", NULL),
  408. MPP_FUNCTION(0x02, "uart3", "rts"),
  409. MPP_FUNCTION(0x03, "sdio1", "cd"),
  410. MPP_FUNCTION(0x04, "spi1", "miso"),
  411. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  412. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  413. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  414. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  415. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  416. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  417. MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
  418. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  419. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  420. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  421. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  422. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  423. MPP_MODE(5,
  424. MPP_FUNCTION(0x00, "gpio", NULL),
  425. MPP_FUNCTION(0x02, "uart3", "cts"),
  426. MPP_FUNCTION(0x03, "sdio1", "wp"),
  427. MPP_FUNCTION(0x04, "spi1", "cs"),
  428. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  429. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  430. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  431. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  432. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  433. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  434. MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
  435. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  436. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  437. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  438. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  439. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  440. MPP_MODE(6,
  441. MPP_FUNCTION(0x00, "gpio", NULL),
  442. MPP_FUNCTION(0x02, "uart3", "txd"),
  443. MPP_FUNCTION(0x03, "sdio1", "buspwr"),
  444. MPP_FUNCTION(0x04, "spi1", "mosi"),
  445. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  446. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  447. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  448. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  449. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  450. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  451. MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
  452. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  453. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  454. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  455. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  456. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  457. MPP_MODE(7,
  458. MPP_FUNCTION(0x00, "gpio", NULL),
  459. MPP_FUNCTION(0x02, "uart3", "rxd"),
  460. MPP_FUNCTION(0x03, "sdio1", "ledctrl"),
  461. MPP_FUNCTION(0x04, "spi1", "sck"),
  462. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  463. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  464. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  465. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  466. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  467. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  468. MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
  469. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  470. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  471. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  472. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  473. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  474. MPP_MODE(8,
  475. MPP_FUNCTION(0x00, "gpio", NULL),
  476. MPP_FUNCTION(0x01, "watchdog", "rstout"),
  477. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  478. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  479. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  480. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  481. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  482. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  483. MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
  484. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  485. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  486. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  487. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  488. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  489. MPP_MODE(9,
  490. MPP_FUNCTION(0x00, "gpio", NULL),
  491. MPP_FUNCTION(0x05, "pex1", "clkreq"),
  492. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  493. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  494. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  495. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  496. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  497. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  498. MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
  499. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  500. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  501. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  502. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  503. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  504. MPP_MODE(10,
  505. MPP_FUNCTION(0x00, "gpio", NULL),
  506. MPP_FUNCTION(0x05, "ssp", "sclk"),
  507. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  508. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  509. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  510. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  511. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  512. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  513. MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
  514. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  515. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  516. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  517. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  518. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  519. MPP_MODE(11,
  520. MPP_FUNCTION(0x00, "gpio", NULL),
  521. MPP_FUNCTION(0x01, "sata", "prsnt"),
  522. MPP_FUNCTION(0x02, "sata-1", "act"),
  523. MPP_FUNCTION(0x03, "sdio0", "ledctrl"),
  524. MPP_FUNCTION(0x04, "sdio1", "ledctrl"),
  525. MPP_FUNCTION(0x05, "pex0", "clkreq"),
  526. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  527. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  528. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  529. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  530. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  531. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  532. MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
  533. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  534. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  535. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  536. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  537. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  538. MPP_MODE(12,
  539. MPP_FUNCTION(0x00, "gpio", NULL),
  540. MPP_FUNCTION(0x01, "sata", "act"),
  541. MPP_FUNCTION(0x02, "uart2", "rts"),
  542. MPP_FUNCTION(0x03, "audio0", "extclk"),
  543. MPP_FUNCTION(0x04, "sdio1", "cd"),
  544. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  545. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  546. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  547. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  548. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  549. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  550. MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
  551. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  552. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  553. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  554. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  555. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  556. MPP_MODE(13,
  557. MPP_FUNCTION(0x00, "gpio", NULL),
  558. MPP_FUNCTION(0x02, "uart2", "cts"),
  559. MPP_FUNCTION(0x03, "audio1", "extclk"),
  560. MPP_FUNCTION(0x04, "sdio1", "wp"),
  561. MPP_FUNCTION(0x05, "ssp", "extclk"),
  562. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  563. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  564. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  565. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  566. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  567. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  568. MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
  569. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  570. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  571. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  572. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  573. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  574. MPP_MODE(14,
  575. MPP_FUNCTION(0x00, "gpio", NULL),
  576. MPP_FUNCTION(0x02, "uart2", "txd"),
  577. MPP_FUNCTION(0x04, "sdio1", "buspwr"),
  578. MPP_FUNCTION(0x05, "ssp", "rxd"),
  579. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  580. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  581. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  582. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  583. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  584. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  585. MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
  586. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  587. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  588. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  589. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  590. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  591. MPP_MODE(15,
  592. MPP_FUNCTION(0x00, "gpio", NULL),
  593. MPP_FUNCTION(0x02, "uart2", "rxd"),
  594. MPP_FUNCTION(0x04, "sdio1", "ledctrl"),
  595. MPP_FUNCTION(0x05, "ssp", "sfrm"),
  596. MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
  597. MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
  598. MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
  599. MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
  600. MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
  601. MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
  602. MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
  603. MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
  604. MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
  605. MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
  606. MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
  607. MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
  608. MPP_MODE(16,
  609. MPP_FUNCTION(0x00, "gpio", NULL),
  610. MPP_FUNCTION(0x02, "uart3", "rts"),
  611. MPP_FUNCTION(0x03, "sdio0", "cd"),
  612. MPP_FUNCTION(0x04, "lcd-spi", "cs1"),
  613. MPP_FUNCTION(0x05, "ac97", "sdi1")),
  614. MPP_MODE(17,
  615. MPP_FUNCTION(0x00, "gpio", NULL),
  616. MPP_FUNCTION(0x01, "ac97-1", "sysclko"),
  617. MPP_FUNCTION(0x02, "uart3", "cts"),
  618. MPP_FUNCTION(0x03, "sdio0", "wp"),
  619. MPP_FUNCTION(0x04, "twsi", "sda"),
  620. MPP_FUNCTION(0x05, "ac97", "sdi2")),
  621. MPP_MODE(18,
  622. MPP_FUNCTION(0x00, "gpio", NULL),
  623. MPP_FUNCTION(0x02, "uart3", "txd"),
  624. MPP_FUNCTION(0x03, "sdio0", "buspwr"),
  625. MPP_FUNCTION(0x04, "lcd0", "pwm"),
  626. MPP_FUNCTION(0x05, "ac97", "sdi3")),
  627. MPP_MODE(19,
  628. MPP_FUNCTION(0x00, "gpio", NULL),
  629. MPP_FUNCTION(0x02, "uart3", "rxd"),
  630. MPP_FUNCTION(0x03, "sdio0", "ledctrl"),
  631. MPP_FUNCTION(0x04, "twsi", "sck")),
  632. MPP_MODE(20,
  633. MPP_FUNCTION(0x00, "gpio", NULL),
  634. MPP_FUNCTION(0x01, "ac97", "sysclko"),
  635. MPP_FUNCTION(0x02, "lcd-spi", "miso"),
  636. MPP_FUNCTION(0x03, "sdio1", "cd"),
  637. MPP_FUNCTION(0x05, "sdio0", "cd"),
  638. MPP_FUNCTION(0x06, "spi1", "miso")),
  639. MPP_MODE(21,
  640. MPP_FUNCTION(0x00, "gpio", NULL),
  641. MPP_FUNCTION(0x01, "uart1", "rts"),
  642. MPP_FUNCTION(0x02, "lcd-spi", "cs0"),
  643. MPP_FUNCTION(0x03, "sdio1", "wp"),
  644. MPP_FUNCTION(0x04, "ssp", "sfrm"),
  645. MPP_FUNCTION(0x05, "sdio0", "wp"),
  646. MPP_FUNCTION(0x06, "spi1", "cs")),
  647. MPP_MODE(22,
  648. MPP_FUNCTION(0x00, "gpio", NULL),
  649. MPP_FUNCTION(0x01, "uart1", "cts"),
  650. MPP_FUNCTION(0x02, "lcd-spi", "mosi"),
  651. MPP_FUNCTION(0x03, "sdio1", "buspwr"),
  652. MPP_FUNCTION(0x04, "ssp", "txd"),
  653. MPP_FUNCTION(0x05, "sdio0", "buspwr"),
  654. MPP_FUNCTION(0x06, "spi1", "mosi")),
  655. MPP_MODE(23,
  656. MPP_FUNCTION(0x00, "gpio", NULL),
  657. MPP_FUNCTION(0x02, "lcd-spi", "sck"),
  658. MPP_FUNCTION(0x03, "sdio1", "ledctrl"),
  659. MPP_FUNCTION(0x04, "ssp", "sclk"),
  660. MPP_FUNCTION(0x05, "sdio0", "ledctrl"),
  661. MPP_FUNCTION(0x06, "spi1", "sck")),
  662. MPP_MODE(24,
  663. MPP_FUNCTION(0x00, "camera", NULL),
  664. MPP_FUNCTION(0x01, "gpio", NULL)),
  665. MPP_MODE(40,
  666. MPP_FUNCTION(0x00, "sdio0", NULL),
  667. MPP_FUNCTION(0x01, "gpio", NULL)),
  668. MPP_MODE(46,
  669. MPP_FUNCTION(0x00, "sdio1", NULL),
  670. MPP_FUNCTION(0x01, "gpio", NULL)),
  671. MPP_MODE(52,
  672. MPP_FUNCTION(0x00, "i2s1/spdifo", NULL),
  673. MPP_FUNCTION(0x02, "i2s1", NULL),
  674. MPP_FUNCTION(0x08, "spdifo", NULL),
  675. MPP_FUNCTION(0x0a, "gpio", NULL),
  676. MPP_FUNCTION(0x0b, "twsi", NULL),
  677. MPP_FUNCTION(0x0c, "ssp/spdifo", NULL),
  678. MPP_FUNCTION(0x0e, "ssp", NULL),
  679. MPP_FUNCTION(0x0f, "ssp/twsi", NULL)),
  680. MPP_MODE(58,
  681. MPP_FUNCTION(0x00, "spi0", NULL),
  682. MPP_FUNCTION(0x01, "gpio", NULL)),
  683. MPP_MODE(62,
  684. MPP_FUNCTION(0x00, "uart1", NULL),
  685. MPP_FUNCTION(0x01, "gpio", NULL)),
  686. MPP_MODE(64,
  687. MPP_FUNCTION(0x00, "nand", NULL),
  688. MPP_FUNCTION(0x01, "gpo", NULL)),
  689. MPP_MODE(72,
  690. MPP_FUNCTION(0x00, "i2s", NULL),
  691. MPP_FUNCTION(0x01, "ac97", NULL)),
  692. MPP_MODE(73,
  693. MPP_FUNCTION(0x00, "twsi-none", NULL),
  694. MPP_FUNCTION(0x01, "twsi-opt1", NULL),
  695. MPP_FUNCTION(0x02, "twsi-opt2", NULL),
  696. MPP_FUNCTION(0x03, "twsi-opt3", NULL)),
  697. };
  698. static struct pinctrl_gpio_range dove_mpp_gpio_ranges[] = {
  699. MPP_GPIO_RANGE(0, 0, 0, 32),
  700. MPP_GPIO_RANGE(1, 32, 32, 32),
  701. MPP_GPIO_RANGE(2, 64, 64, 8),
  702. };
  703. static struct mvebu_pinctrl_soc_info dove_pinctrl_info = {
  704. .controls = dove_mpp_controls,
  705. .ncontrols = ARRAY_SIZE(dove_mpp_controls),
  706. .modes = dove_mpp_modes,
  707. .nmodes = ARRAY_SIZE(dove_mpp_modes),
  708. .gpioranges = dove_mpp_gpio_ranges,
  709. .ngpioranges = ARRAY_SIZE(dove_mpp_gpio_ranges),
  710. .variant = 0,
  711. };
  712. static struct clk *clk;
  713. static struct of_device_id dove_pinctrl_of_match[] = {
  714. { .compatible = "marvell,dove-pinctrl", .data = &dove_pinctrl_info },
  715. { }
  716. };
  717. static int dove_pinctrl_probe(struct platform_device *pdev)
  718. {
  719. const struct of_device_id *match =
  720. of_match_device(dove_pinctrl_of_match, &pdev->dev);
  721. pdev->dev.platform_data = (void *)match->data;
  722. /*
  723. * General MPP Configuration Register is part of pdma registers.
  724. * grab clk to make sure it is ticking.
  725. */
  726. clk = devm_clk_get(&pdev->dev, NULL);
  727. if (IS_ERR(clk)) {
  728. dev_err(&pdev->dev, "Unable to get pdma clock");
  729. return PTR_ERR(clk);
  730. }
  731. clk_prepare_enable(clk);
  732. return mvebu_pinctrl_probe(pdev);
  733. }
  734. static int dove_pinctrl_remove(struct platform_device *pdev)
  735. {
  736. int ret;
  737. ret = mvebu_pinctrl_remove(pdev);
  738. if (!IS_ERR(clk))
  739. clk_disable_unprepare(clk);
  740. return ret;
  741. }
  742. static struct platform_driver dove_pinctrl_driver = {
  743. .driver = {
  744. .name = "dove-pinctrl",
  745. .owner = THIS_MODULE,
  746. .of_match_table = of_match_ptr(dove_pinctrl_of_match),
  747. },
  748. .probe = dove_pinctrl_probe,
  749. .remove = dove_pinctrl_remove,
  750. };
  751. module_platform_driver(dove_pinctrl_driver);
  752. MODULE_AUTHOR("Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>");
  753. MODULE_DESCRIPTION("Marvell Dove pinctrl driver");
  754. MODULE_LICENSE("GPL v2");