gpio.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2012
  4. * Philippe Reynes <tremyfr@yahoo.fr>
  5. */
  6. #ifndef __ASM_ARCH_MX27_GPIO_H
  7. #define __ASM_ARCH_MX27_GPIO_H
  8. /* GPIO registers */
  9. struct gpio_regs {
  10. u32 gpio_dir; /* DDIR */
  11. u32 ocr1;
  12. u32 ocr2;
  13. u32 iconfa1;
  14. u32 iconfa2;
  15. u32 iconfb1;
  16. u32 iconfb2;
  17. u32 gpio_dr; /* DR */
  18. u32 gius;
  19. u32 gpio_psr; /* SSR */
  20. u32 icr1;
  21. u32 icr2;
  22. u32 imr;
  23. u32 isr;
  24. u32 gpr;
  25. u32 swr;
  26. u32 puen;
  27. u32 res[0x2f];
  28. };
  29. /* This structure is used by the function imx_gpio_mode */
  30. struct gpio_port_regs {
  31. struct gpio_regs port[6];
  32. };
  33. /*
  34. * GPIO Module and I/O Multiplexer
  35. */
  36. #define PORTA 0
  37. #define PORTB 1
  38. #define PORTC 2
  39. #define PORTD 3
  40. #define PORTE 4
  41. #define PORTF 5
  42. #define GPIO_PIN_MASK 0x1f
  43. #define GPIO_PORT_SHIFT 5
  44. #define GPIO_PORT_MASK (0x7 << GPIO_PORT_SHIFT)
  45. #define GPIO_PORTA (PORTA << GPIO_PORT_SHIFT)
  46. #define GPIO_PORTB (PORTB << GPIO_PORT_SHIFT)
  47. #define GPIO_PORTC (PORTC << GPIO_PORT_SHIFT)
  48. #define GPIO_PORTD (PORTD << GPIO_PORT_SHIFT)
  49. #define GPIO_PORTE (PORTE << GPIO_PORT_SHIFT)
  50. #define GPIO_PORTF (PORTF << GPIO_PORT_SHIFT)
  51. #endif