gpio.c 16 KB

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