gpio.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. /*
  2. * Coldfire generic GPIO support
  3. *
  4. * (C) Copyright 2009, Steven King <sfking@fdwdc.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; version 2 of the License.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include <asm/coldfire.h>
  18. #include <asm/mcfsim.h>
  19. #include <asm/mcfgpio.h>
  20. static struct mcf_gpio_chip mcf_gpio_chips[] = {
  21. #if defined(CONFIG_M5271)
  22. {
  23. .gpio_chip = {
  24. .label = "PIRQ",
  25. .request = mcf_gpio_request,
  26. .free = mcf_gpio_free,
  27. .direction_input = mcf_gpio_direction_input,
  28. .direction_output = mcf_gpio_direction_output,
  29. .get = mcf_gpio_get_value,
  30. .set = mcf_gpio_set_value,
  31. .base = 1,
  32. .ngpio = 7,
  33. },
  34. .pddr = (void __iomem *) MCFEPORT_EPDDR,
  35. .podr = (void __iomem *) MCFEPORT_EPDR,
  36. .ppdr = (void __iomem *) MCFEPORT_EPPDR,
  37. },
  38. {
  39. .gpio_chip = {
  40. .label = "ADDR",
  41. .request = mcf_gpio_request,
  42. .free = mcf_gpio_free,
  43. .direction_input = mcf_gpio_direction_input,
  44. .direction_output = mcf_gpio_direction_output,
  45. .get = mcf_gpio_get_value,
  46. .set = mcf_gpio_set_value_fast,
  47. .base = 13,
  48. .ngpio = 3,
  49. },
  50. .pddr = (void __iomem *) MCFGPIO_PDDR_ADDR,
  51. .podr = (void __iomem *) MCFGPIO_PODR_ADDR,
  52. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
  53. .setr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
  54. .clrr = (void __iomem *) MCFGPIO_PCLRR_ADDR,
  55. },
  56. {
  57. .gpio_chip = {
  58. .label = "DATAH",
  59. .request = mcf_gpio_request,
  60. .free = mcf_gpio_free,
  61. .direction_input = mcf_gpio_direction_input,
  62. .direction_output = mcf_gpio_direction_output,
  63. .get = mcf_gpio_get_value,
  64. .set = mcf_gpio_set_value_fast,
  65. .base = 16,
  66. .ngpio = 8,
  67. },
  68. .pddr = (void __iomem *) MCFGPIO_PDDR_DATAH,
  69. .podr = (void __iomem *) MCFGPIO_PODR_DATAH,
  70. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_DATAH,
  71. .setr = (void __iomem *) MCFGPIO_PPDSDR_DATAH,
  72. .clrr = (void __iomem *) MCFGPIO_PCLRR_DATAH,
  73. },
  74. {
  75. .gpio_chip = {
  76. .label = "DATAL",
  77. .request = mcf_gpio_request,
  78. .free = mcf_gpio_free,
  79. .direction_input = mcf_gpio_direction_input,
  80. .direction_output = mcf_gpio_direction_output,
  81. .get = mcf_gpio_get_value,
  82. .set = mcf_gpio_set_value_fast,
  83. .base = 24,
  84. .ngpio = 8,
  85. },
  86. .pddr = (void __iomem *) MCFGPIO_PDDR_DATAL,
  87. .podr = (void __iomem *) MCFGPIO_PODR_DATAL,
  88. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_DATAL,
  89. .setr = (void __iomem *) MCFGPIO_PPDSDR_DATAL,
  90. .clrr = (void __iomem *) MCFGPIO_PCLRR_DATAL,
  91. },
  92. {
  93. .gpio_chip = {
  94. .label = "BUSCTL",
  95. .request = mcf_gpio_request,
  96. .free = mcf_gpio_free,
  97. .direction_input = mcf_gpio_direction_input,
  98. .direction_output = mcf_gpio_direction_output,
  99. .get = mcf_gpio_get_value,
  100. .set = mcf_gpio_set_value_fast,
  101. .base = 32,
  102. .ngpio = 8,
  103. },
  104. .pddr = (void __iomem *) MCFGPIO_PDDR_BUSCTL,
  105. .podr = (void __iomem *) MCFGPIO_PODR_BUSCTL,
  106. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
  107. .setr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
  108. .clrr = (void __iomem *) MCFGPIO_PCLRR_BUSCTL,
  109. },
  110. {
  111. .gpio_chip = {
  112. .label = "BS",
  113. .request = mcf_gpio_request,
  114. .free = mcf_gpio_free,
  115. .direction_input = mcf_gpio_direction_input,
  116. .direction_output = mcf_gpio_direction_output,
  117. .get = mcf_gpio_get_value,
  118. .set = mcf_gpio_set_value_fast,
  119. .base = 40,
  120. .ngpio = 4,
  121. },
  122. .pddr = (void __iomem *) MCFGPIO_PDDR_BS,
  123. .podr = (void __iomem *) MCFGPIO_PODR_BS,
  124. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BS,
  125. .setr = (void __iomem *) MCFGPIO_PPDSDR_BS,
  126. .clrr = (void __iomem *) MCFGPIO_PCLRR_BS,
  127. },
  128. {
  129. .gpio_chip = {
  130. .label = "CS",
  131. .request = mcf_gpio_request,
  132. .free = mcf_gpio_free,
  133. .direction_input = mcf_gpio_direction_input,
  134. .direction_output = mcf_gpio_direction_output,
  135. .get = mcf_gpio_get_value,
  136. .set = mcf_gpio_set_value_fast,
  137. .base = 49,
  138. .ngpio = 7,
  139. },
  140. .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
  141. .podr = (void __iomem *) MCFGPIO_PODR_CS,
  142. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
  143. .setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
  144. .clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
  145. },
  146. {
  147. .gpio_chip = {
  148. .label = "SDRAM",
  149. .request = mcf_gpio_request,
  150. .free = mcf_gpio_free,
  151. .direction_input = mcf_gpio_direction_input,
  152. .direction_output = mcf_gpio_direction_output,
  153. .get = mcf_gpio_get_value,
  154. .set = mcf_gpio_set_value_fast,
  155. .base = 56,
  156. .ngpio = 6,
  157. },
  158. .pddr = (void __iomem *) MCFGPIO_PDDR_SDRAM,
  159. .podr = (void __iomem *) MCFGPIO_PODR_SDRAM,
  160. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
  161. .setr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
  162. .clrr = (void __iomem *) MCFGPIO_PCLRR_SDRAM,
  163. },
  164. {
  165. .gpio_chip = {
  166. .label = "FECI2C",
  167. .request = mcf_gpio_request,
  168. .free = mcf_gpio_free,
  169. .direction_input = mcf_gpio_direction_input,
  170. .direction_output = mcf_gpio_direction_output,
  171. .get = mcf_gpio_get_value,
  172. .set = mcf_gpio_set_value_fast,
  173. .base = 64,
  174. .ngpio = 4,
  175. },
  176. .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
  177. .podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
  178. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
  179. .setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
  180. .clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
  181. },
  182. {
  183. .gpio_chip = {
  184. .label = "UARTH",
  185. .request = mcf_gpio_request,
  186. .free = mcf_gpio_free,
  187. .direction_input = mcf_gpio_direction_input,
  188. .direction_output = mcf_gpio_direction_output,
  189. .get = mcf_gpio_get_value,
  190. .set = mcf_gpio_set_value_fast,
  191. .base = 72,
  192. .ngpio = 2,
  193. },
  194. .pddr = (void __iomem *) MCFGPIO_PDDR_UARTH,
  195. .podr = (void __iomem *) MCFGPIO_PODR_UARTH,
  196. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
  197. .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
  198. .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTH,
  199. },
  200. {
  201. .gpio_chip = {
  202. .label = "UARTL",
  203. .request = mcf_gpio_request,
  204. .free = mcf_gpio_free,
  205. .direction_input = mcf_gpio_direction_input,
  206. .direction_output = mcf_gpio_direction_output,
  207. .get = mcf_gpio_get_value,
  208. .set = mcf_gpio_set_value_fast,
  209. .base = 80,
  210. .ngpio = 8,
  211. },
  212. .pddr = (void __iomem *) MCFGPIO_PDDR_UARTL,
  213. .podr = (void __iomem *) MCFGPIO_PODR_UARTL,
  214. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
  215. .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
  216. .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTL,
  217. },
  218. {
  219. .gpio_chip = {
  220. .label = "QSPI",
  221. .request = mcf_gpio_request,
  222. .free = mcf_gpio_free,
  223. .direction_input = mcf_gpio_direction_input,
  224. .direction_output = mcf_gpio_direction_output,
  225. .get = mcf_gpio_get_value,
  226. .set = mcf_gpio_set_value_fast,
  227. .base = 88,
  228. .ngpio = 5,
  229. },
  230. .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
  231. .podr = (void __iomem *) MCFGPIO_PODR_QSPI,
  232. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
  233. .setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
  234. .clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
  235. },
  236. {
  237. .gpio_chip = {
  238. .label = "TIMER",
  239. .request = mcf_gpio_request,
  240. .free = mcf_gpio_free,
  241. .direction_input = mcf_gpio_direction_input,
  242. .direction_output = mcf_gpio_direction_output,
  243. .get = mcf_gpio_get_value,
  244. .set = mcf_gpio_set_value_fast,
  245. .base = 96,
  246. .ngpio = 8,
  247. },
  248. .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
  249. .podr = (void __iomem *) MCFGPIO_PODR_TIMER,
  250. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
  251. .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMER,
  252. .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMER,
  253. },
  254. #elif defined(CONFIG_M5275)
  255. {
  256. .gpio_chip = {
  257. .label = "PIRQ",
  258. .request = mcf_gpio_request,
  259. .free = mcf_gpio_free,
  260. .direction_input = mcf_gpio_direction_input,
  261. .direction_output = mcf_gpio_direction_output,
  262. .get = mcf_gpio_get_value,
  263. .set = mcf_gpio_set_value,
  264. .base = 1,
  265. .ngpio = 7,
  266. },
  267. .pddr = (void __iomem *) MCFEPORT_EPDDR,
  268. .podr = (void __iomem *) MCFEPORT_EPDR,
  269. .ppdr = (void __iomem *) MCFEPORT_EPPDR,
  270. },
  271. {
  272. .gpio_chip = {
  273. .label = "BUSCTL",
  274. .request = mcf_gpio_request,
  275. .free = mcf_gpio_free,
  276. .direction_input = mcf_gpio_direction_input,
  277. .direction_output = mcf_gpio_direction_output,
  278. .get = mcf_gpio_get_value,
  279. .set = mcf_gpio_set_value_fast,
  280. .base = 8,
  281. .ngpio = 8,
  282. },
  283. .pddr = (void __iomem *) MCFGPIO_PDDR_BUSCTL,
  284. .podr = (void __iomem *) MCFGPIO_PODR_BUSCTL,
  285. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
  286. .setr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
  287. .clrr = (void __iomem *) MCFGPIO_PCLRR_BUSCTL,
  288. },
  289. {
  290. .gpio_chip = {
  291. .label = "ADDR",
  292. .request = mcf_gpio_request,
  293. .free = mcf_gpio_free,
  294. .direction_input = mcf_gpio_direction_input,
  295. .direction_output = mcf_gpio_direction_output,
  296. .get = mcf_gpio_get_value,
  297. .set = mcf_gpio_set_value_fast,
  298. .base = 21,
  299. .ngpio = 3,
  300. },
  301. .pddr = (void __iomem *) MCFGPIO_PDDR_ADDR,
  302. .podr = (void __iomem *) MCFGPIO_PODR_ADDR,
  303. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
  304. .setr = (void __iomem *) MCFGPIO_PPDSDR_ADDR,
  305. .clrr = (void __iomem *) MCFGPIO_PCLRR_ADDR,
  306. },
  307. {
  308. .gpio_chip = {
  309. .label = "CS",
  310. .request = mcf_gpio_request,
  311. .free = mcf_gpio_free,
  312. .direction_input = mcf_gpio_direction_input,
  313. .direction_output = mcf_gpio_direction_output,
  314. .get = mcf_gpio_get_value,
  315. .set = mcf_gpio_set_value_fast,
  316. .base = 25,
  317. .ngpio = 7,
  318. },
  319. .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
  320. .podr = (void __iomem *) MCFGPIO_PODR_CS,
  321. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_CS,
  322. .setr = (void __iomem *) MCFGPIO_PPDSDR_CS,
  323. .clrr = (void __iomem *) MCFGPIO_PCLRR_CS,
  324. },
  325. {
  326. .gpio_chip = {
  327. .label = "FEC0H",
  328. .request = mcf_gpio_request,
  329. .free = mcf_gpio_free,
  330. .direction_input = mcf_gpio_direction_input,
  331. .direction_output = mcf_gpio_direction_output,
  332. .get = mcf_gpio_get_value,
  333. .set = mcf_gpio_set_value_fast,
  334. .base = 32,
  335. .ngpio = 8,
  336. },
  337. .pddr = (void __iomem *) MCFGPIO_PDDR_FEC0H,
  338. .podr = (void __iomem *) MCFGPIO_PODR_FEC0H,
  339. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FEC0H,
  340. .setr = (void __iomem *) MCFGPIO_PPDSDR_FEC0H,
  341. .clrr = (void __iomem *) MCFGPIO_PCLRR_FEC0H,
  342. },
  343. {
  344. .gpio_chip = {
  345. .label = "FEC0L",
  346. .request = mcf_gpio_request,
  347. .free = mcf_gpio_free,
  348. .direction_input = mcf_gpio_direction_input,
  349. .direction_output = mcf_gpio_direction_output,
  350. .get = mcf_gpio_get_value,
  351. .set = mcf_gpio_set_value_fast,
  352. .base = 40,
  353. .ngpio = 8,
  354. },
  355. .pddr = (void __iomem *) MCFGPIO_PDDR_FEC0L,
  356. .podr = (void __iomem *) MCFGPIO_PODR_FEC0L,
  357. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FEC0L,
  358. .setr = (void __iomem *) MCFGPIO_PPDSDR_FEC0L,
  359. .clrr = (void __iomem *) MCFGPIO_PCLRR_FEC0L,
  360. },
  361. {
  362. .gpio_chip = {
  363. .label = "FECI2C",
  364. .request = mcf_gpio_request,
  365. .free = mcf_gpio_free,
  366. .direction_input = mcf_gpio_direction_input,
  367. .direction_output = mcf_gpio_direction_output,
  368. .get = mcf_gpio_get_value,
  369. .set = mcf_gpio_set_value_fast,
  370. .base = 48,
  371. .ngpio = 6,
  372. },
  373. .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
  374. .podr = (void __iomem *) MCFGPIO_PODR_FECI2C,
  375. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
  376. .setr = (void __iomem *) MCFGPIO_PPDSDR_FECI2C,
  377. .clrr = (void __iomem *) MCFGPIO_PCLRR_FECI2C,
  378. },
  379. {
  380. .gpio_chip = {
  381. .label = "QSPI",
  382. .request = mcf_gpio_request,
  383. .free = mcf_gpio_free,
  384. .direction_input = mcf_gpio_direction_input,
  385. .direction_output = mcf_gpio_direction_output,
  386. .get = mcf_gpio_get_value,
  387. .set = mcf_gpio_set_value_fast,
  388. .base = 56,
  389. .ngpio = 7,
  390. },
  391. .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
  392. .podr = (void __iomem *) MCFGPIO_PODR_QSPI,
  393. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
  394. .setr = (void __iomem *) MCFGPIO_PPDSDR_QSPI,
  395. .clrr = (void __iomem *) MCFGPIO_PCLRR_QSPI,
  396. },
  397. {
  398. .gpio_chip = {
  399. .label = "SDRAM",
  400. .request = mcf_gpio_request,
  401. .free = mcf_gpio_free,
  402. .direction_input = mcf_gpio_direction_input,
  403. .direction_output = mcf_gpio_direction_output,
  404. .get = mcf_gpio_get_value,
  405. .set = mcf_gpio_set_value_fast,
  406. .base = 64,
  407. .ngpio = 8,
  408. },
  409. .pddr = (void __iomem *) MCFGPIO_PDDR_SDRAM,
  410. .podr = (void __iomem *) MCFGPIO_PODR_SDRAM,
  411. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
  412. .setr = (void __iomem *) MCFGPIO_PPDSDR_SDRAM,
  413. .clrr = (void __iomem *) MCFGPIO_PCLRR_SDRAM,
  414. },
  415. {
  416. .gpio_chip = {
  417. .label = "TIMERH",
  418. .request = mcf_gpio_request,
  419. .free = mcf_gpio_free,
  420. .direction_input = mcf_gpio_direction_input,
  421. .direction_output = mcf_gpio_direction_output,
  422. .get = mcf_gpio_get_value,
  423. .set = mcf_gpio_set_value_fast,
  424. .base = 72,
  425. .ngpio = 4,
  426. },
  427. .pddr = (void __iomem *) MCFGPIO_PDDR_TIMERH,
  428. .podr = (void __iomem *) MCFGPIO_PODR_TIMERH,
  429. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMERH,
  430. .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMERH,
  431. .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMERH,
  432. },
  433. {
  434. .gpio_chip = {
  435. .label = "TIMERL",
  436. .request = mcf_gpio_request,
  437. .free = mcf_gpio_free,
  438. .direction_input = mcf_gpio_direction_input,
  439. .direction_output = mcf_gpio_direction_output,
  440. .get = mcf_gpio_get_value,
  441. .set = mcf_gpio_set_value_fast,
  442. .base = 80,
  443. .ngpio = 4,
  444. },
  445. .pddr = (void __iomem *) MCFGPIO_PDDR_TIMERL,
  446. .podr = (void __iomem *) MCFGPIO_PODR_TIMERL,
  447. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_TIMERL,
  448. .setr = (void __iomem *) MCFGPIO_PPDSDR_TIMERL,
  449. .clrr = (void __iomem *) MCFGPIO_PCLRR_TIMERL,
  450. },
  451. {
  452. .gpio_chip = {
  453. .label = "UARTL",
  454. .request = mcf_gpio_request,
  455. .free = mcf_gpio_free,
  456. .direction_input = mcf_gpio_direction_input,
  457. .direction_output = mcf_gpio_direction_output,
  458. .get = mcf_gpio_get_value,
  459. .set = mcf_gpio_set_value_fast,
  460. .base = 88,
  461. .ngpio = 8,
  462. },
  463. .pddr = (void __iomem *) MCFGPIO_PDDR_UARTL,
  464. .podr = (void __iomem *) MCFGPIO_PODR_UARTL,
  465. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
  466. .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTL,
  467. .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTL,
  468. },
  469. {
  470. .gpio_chip = {
  471. .label = "FEC1H",
  472. .request = mcf_gpio_request,
  473. .free = mcf_gpio_free,
  474. .direction_input = mcf_gpio_direction_input,
  475. .direction_output = mcf_gpio_direction_output,
  476. .get = mcf_gpio_get_value,
  477. .set = mcf_gpio_set_value_fast,
  478. .base = 96,
  479. .ngpio = 8,
  480. },
  481. .pddr = (void __iomem *) MCFGPIO_PDDR_FEC1H,
  482. .podr = (void __iomem *) MCFGPIO_PODR_FEC1H,
  483. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FEC1H,
  484. .setr = (void __iomem *) MCFGPIO_PPDSDR_FEC1H,
  485. .clrr = (void __iomem *) MCFGPIO_PCLRR_FEC1H,
  486. },
  487. {
  488. .gpio_chip = {
  489. .label = "FEC1L",
  490. .request = mcf_gpio_request,
  491. .free = mcf_gpio_free,
  492. .direction_input = mcf_gpio_direction_input,
  493. .direction_output = mcf_gpio_direction_output,
  494. .get = mcf_gpio_get_value,
  495. .set = mcf_gpio_set_value_fast,
  496. .base = 104,
  497. .ngpio = 8,
  498. },
  499. .pddr = (void __iomem *) MCFGPIO_PDDR_FEC1L,
  500. .podr = (void __iomem *) MCFGPIO_PODR_FEC1L,
  501. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_FEC1L,
  502. .setr = (void __iomem *) MCFGPIO_PPDSDR_FEC1L,
  503. .clrr = (void __iomem *) MCFGPIO_PCLRR_FEC1L,
  504. },
  505. {
  506. .gpio_chip = {
  507. .label = "BS",
  508. .request = mcf_gpio_request,
  509. .free = mcf_gpio_free,
  510. .direction_input = mcf_gpio_direction_input,
  511. .direction_output = mcf_gpio_direction_output,
  512. .get = mcf_gpio_get_value,
  513. .set = mcf_gpio_set_value_fast,
  514. .base = 114,
  515. .ngpio = 2,
  516. },
  517. .pddr = (void __iomem *) MCFGPIO_PDDR_BS,
  518. .podr = (void __iomem *) MCFGPIO_PODR_BS,
  519. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BS,
  520. .setr = (void __iomem *) MCFGPIO_PPDSDR_BS,
  521. .clrr = (void __iomem *) MCFGPIO_PCLRR_BS,
  522. },
  523. {
  524. .gpio_chip = {
  525. .label = "IRQ",
  526. .request = mcf_gpio_request,
  527. .free = mcf_gpio_free,
  528. .direction_input = mcf_gpio_direction_input,
  529. .direction_output = mcf_gpio_direction_output,
  530. .get = mcf_gpio_get_value,
  531. .set = mcf_gpio_set_value_fast,
  532. .base = 121,
  533. .ngpio = 7,
  534. },
  535. .pddr = (void __iomem *) MCFGPIO_PDDR_IRQ,
  536. .podr = (void __iomem *) MCFGPIO_PODR_IRQ,
  537. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_IRQ,
  538. .setr = (void __iomem *) MCFGPIO_PPDSDR_IRQ,
  539. .clrr = (void __iomem *) MCFGPIO_PCLRR_IRQ,
  540. },
  541. {
  542. .gpio_chip = {
  543. .label = "USBH",
  544. .request = mcf_gpio_request,
  545. .free = mcf_gpio_free,
  546. .direction_input = mcf_gpio_direction_input,
  547. .direction_output = mcf_gpio_direction_output,
  548. .get = mcf_gpio_get_value,
  549. .set = mcf_gpio_set_value_fast,
  550. .base = 128,
  551. .ngpio = 1,
  552. },
  553. .pddr = (void __iomem *) MCFGPIO_PDDR_USBH,
  554. .podr = (void __iomem *) MCFGPIO_PODR_USBH,
  555. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_USBH,
  556. .setr = (void __iomem *) MCFGPIO_PPDSDR_USBH,
  557. .clrr = (void __iomem *) MCFGPIO_PCLRR_USBH,
  558. },
  559. {
  560. .gpio_chip = {
  561. .label = "USBL",
  562. .request = mcf_gpio_request,
  563. .free = mcf_gpio_free,
  564. .direction_input = mcf_gpio_direction_input,
  565. .direction_output = mcf_gpio_direction_output,
  566. .get = mcf_gpio_get_value,
  567. .set = mcf_gpio_set_value_fast,
  568. .base = 136,
  569. .ngpio = 8,
  570. },
  571. .pddr = (void __iomem *) MCFGPIO_PDDR_USBL,
  572. .podr = (void __iomem *) MCFGPIO_PODR_USBL,
  573. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_USBL,
  574. .setr = (void __iomem *) MCFGPIO_PPDSDR_USBL,
  575. .clrr = (void __iomem *) MCFGPIO_PCLRR_USBL,
  576. },
  577. {
  578. .gpio_chip = {
  579. .label = "UARTH",
  580. .request = mcf_gpio_request,
  581. .free = mcf_gpio_free,
  582. .direction_input = mcf_gpio_direction_input,
  583. .direction_output = mcf_gpio_direction_output,
  584. .get = mcf_gpio_get_value,
  585. .set = mcf_gpio_set_value_fast,
  586. .base = 144,
  587. .ngpio = 4,
  588. },
  589. .pddr = (void __iomem *) MCFGPIO_PDDR_UARTH,
  590. .podr = (void __iomem *) MCFGPIO_PODR_UARTH,
  591. .ppdr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
  592. .setr = (void __iomem *) MCFGPIO_PPDSDR_UARTH,
  593. .clrr = (void __iomem *) MCFGPIO_PCLRR_UARTH,
  594. },
  595. #endif
  596. };
  597. static int __init mcf_gpio_init(void)
  598. {
  599. unsigned i = 0;
  600. while (i < ARRAY_SIZE(mcf_gpio_chips))
  601. (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
  602. return 0;
  603. }
  604. core_initcall(mcf_gpio_init);