gpio-pxa.h 946 B

1234567891011121314151617181920212223242526272829
  1. #ifndef __ASM_MACH_GPIO_PXA_H
  2. #define __ASM_MACH_GPIO_PXA_H
  3. #include <mach/addr-map.h>
  4. #include <mach/cputype.h>
  5. #include <mach/irqs.h>
  6. #define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
  7. #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
  8. #define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
  9. #define gpio_to_bank(gpio) ((gpio) >> 5)
  10. /* NOTE: these macros are defined here to make optimization of
  11. * gpio_{get,set}_value() to work when 'gpio' is a constant.
  12. * Usage of these macros otherwise is no longer recommended,
  13. * use generic GPIO API whenever possible.
  14. */
  15. #define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
  16. #define GPLR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
  17. #define GPDR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
  18. #define GPSR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
  19. #define GPCR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
  20. #include <plat/gpio-pxa.h>
  21. #endif /* __ASM_MACH_GPIO_PXA_H */