gpio.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * arch/asm-arm/mach-mv78xx0/include/mach/gpio.h
  3. *
  4. * This file is licensed under the terms of the GNU General Public
  5. * License version 2. This program is licensed "as is" without any
  6. * warranty of any kind, whether express or implied.
  7. */
  8. #ifndef __ASM_ARCH_GPIO_H
  9. #define __ASM_ARCH_GPIO_H
  10. #include <mach/irqs.h>
  11. #include <plat/gpio.h>
  12. #include <asm-generic/gpio.h> /* cansleep wrappers */
  13. extern int mv78xx0_core_index(void);
  14. #define GPIO_MAX 32
  15. #define GPIO_OUT(pin) (DEV_BUS_VIRT_BASE + 0x0100)
  16. #define GPIO_IO_CONF(pin) (DEV_BUS_VIRT_BASE + 0x0104)
  17. #define GPIO_BLINK_EN(pin) (DEV_BUS_VIRT_BASE + 0x0108)
  18. #define GPIO_IN_POL(pin) (DEV_BUS_VIRT_BASE + 0x010c)
  19. #define GPIO_DATA_IN(pin) (DEV_BUS_VIRT_BASE + 0x0110)
  20. #define GPIO_EDGE_CAUSE(pin) (DEV_BUS_VIRT_BASE + 0x0114)
  21. #define GPIO_MASK_OFF (mv78xx0_core_index() ? 0x18 : 0)
  22. #define GPIO_EDGE_MASK(pin) (DEV_BUS_VIRT_BASE + 0x0118 + GPIO_MASK_OFF)
  23. #define GPIO_LEVEL_MASK(pin) (DEV_BUS_VIRT_BASE + 0x011c + GPIO_MASK_OFF)
  24. static inline int gpio_to_irq(int pin)
  25. {
  26. return pin + IRQ_MV78XX0_GPIO_START;
  27. }
  28. static inline int irq_to_gpio(int irq)
  29. {
  30. return irq - IRQ_MV78XX0_GPIO_START;
  31. }
  32. #endif