gpio.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef __ASM_ARCH_GPIO_H
  2. #define __ASM_ARCH_GPIO_H
  3. /*
  4. * 288 (#267 is the highest one actually hooked up) onchip GPIOs, plus enough
  5. * room for a couple of GPIO expanders.
  6. */
  7. #define ARCH_NR_GPIOS 350
  8. #include <plat/gpio.h>
  9. #define __GPIO_RESOURCE(soc, block) \
  10. { \
  11. .start = soc##_GPIOBANK##block##_BASE, \
  12. .end = soc##_GPIOBANK##block##_BASE + 127, \
  13. .flags = IORESOURCE_MEM, \
  14. }, \
  15. { \
  16. .start = IRQ_GPIO##block, \
  17. .end = IRQ_GPIO##block, \
  18. .flags = IORESOURCE_IRQ, \
  19. }
  20. #define __GPIO_DEVICE(soc, block) \
  21. { \
  22. .name = "gpio", \
  23. .id = block, \
  24. .num_resources = 2, \
  25. .resource = &soc##_gpio_resources[block * 2], \
  26. .dev = { \
  27. .platform_data = &soc##_gpio_data[block], \
  28. }, \
  29. }
  30. #define GPIO_DATA(_name, first) \
  31. { \
  32. .name = _name, \
  33. .first_gpio = first, \
  34. .first_irq = NOMADIK_GPIO_TO_IRQ(first), \
  35. }
  36. #ifdef CONFIG_UX500_SOC_DB8500
  37. #define GPIO_RESOURCE(block) __GPIO_RESOURCE(U8500, block)
  38. #define GPIO_DEVICE(block) __GPIO_DEVICE(u8500, block)
  39. #elif defined(CONFIG_UX500_SOC_DB5500)
  40. #define GPIO_RESOURCE(block) __GPIO_RESOURCE(U5500, block)
  41. #define GPIO_DEVICE(block) __GPIO_DEVICE(u5500, block)
  42. #endif
  43. #endif /* __ASM_ARCH_GPIO_H */