gpio.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. MCFGPS(NQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
  22. MCFGPS(TA, 8, 4, MCFGPTA_GPTDDR, MCFGPTA_GPTPORT, MCFGPTB_GPTPORT),
  23. MCFGPS(TB, 16, 4, MCFGPTB_GPTDDR, MCFGPTB_GPTPORT, MCFGPTB_GPTPORT),
  24. MCFGPS(QA, 24, 4, MCFQADC_DDRQA, MCFQADC_PORTQA, MCFQADC_PORTQA),
  25. MCFGPS(QB, 32, 4, MCFQADC_DDRQB, MCFQADC_PORTQB, MCFQADC_PORTQB),
  26. MCFGPF(A, 40, 8),
  27. MCFGPF(B, 48, 8),
  28. MCFGPF(C, 56, 8),
  29. MCFGPF(D, 64, 8),
  30. MCFGPF(E, 72, 8),
  31. MCFGPF(F, 80, 8),
  32. MCFGPF(G, 88, 8),
  33. MCFGPF(H, 96, 8),
  34. MCFGPF(J, 104, 8),
  35. MCFGPF(DD, 112, 8),
  36. MCFGPF(EH, 120, 8),
  37. MCFGPF(EL, 128, 8),
  38. MCFGPF(AS, 136, 6),
  39. MCFGPF(QS, 144, 7),
  40. MCFGPF(SD, 152, 6),
  41. MCFGPF(TC, 160, 4),
  42. MCFGPF(TD, 168, 4),
  43. MCFGPF(UA, 176, 4),
  44. };
  45. static int __init mcf_gpio_init(void)
  46. {
  47. unsigned i = 0;
  48. while (i < ARRAY_SIZE(mcf_gpio_chips))
  49. (void)gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]);
  50. return 0;
  51. }
  52. core_initcall(mcf_gpio_init);