gpio.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /* arch/arm/mach-s5pc100/include/mach/gpio.h
  2. *
  3. * Copyright 2009 Samsung Electronics Co.
  4. * Byungho Min <bhmin@samsung.com>
  5. *
  6. * S5PC100 - GPIO lib support
  7. *
  8. * Base on mach-s3c6400/include/mach/gpio.h
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef __ASM_ARCH_GPIO_H
  15. #define __ASM_ARCH_GPIO_H __FILE__
  16. #define gpio_get_value __gpio_get_value
  17. #define gpio_set_value __gpio_set_value
  18. #define gpio_cansleep __gpio_cansleep
  19. #define gpio_to_irq __gpio_to_irq
  20. /* GPIO bank sizes */
  21. #define S5PC100_GPIO_A0_NR (8)
  22. #define S5PC100_GPIO_A1_NR (5)
  23. #define S5PC100_GPIO_B_NR (8)
  24. #define S5PC100_GPIO_C_NR (5)
  25. #define S5PC100_GPIO_D_NR (7)
  26. #define S5PC100_GPIO_E0_NR (8)
  27. #define S5PC100_GPIO_E1_NR (6)
  28. #define S5PC100_GPIO_F0_NR (8)
  29. #define S5PC100_GPIO_F1_NR (8)
  30. #define S5PC100_GPIO_F2_NR (8)
  31. #define S5PC100_GPIO_F3_NR (4)
  32. #define S5PC100_GPIO_G0_NR (8)
  33. #define S5PC100_GPIO_G1_NR (3)
  34. #define S5PC100_GPIO_G2_NR (7)
  35. #define S5PC100_GPIO_G3_NR (7)
  36. #define S5PC100_GPIO_H0_NR (8)
  37. #define S5PC100_GPIO_H1_NR (8)
  38. #define S5PC100_GPIO_H2_NR (8)
  39. #define S5PC100_GPIO_H3_NR (8)
  40. #define S5PC100_GPIO_I_NR (8)
  41. #define S5PC100_GPIO_J0_NR (8)
  42. #define S5PC100_GPIO_J1_NR (5)
  43. #define S5PC100_GPIO_J2_NR (8)
  44. #define S5PC100_GPIO_J3_NR (8)
  45. #define S5PC100_GPIO_J4_NR (4)
  46. #define S5PC100_GPIO_K0_NR (8)
  47. #define S5PC100_GPIO_K1_NR (6)
  48. #define S5PC100_GPIO_K2_NR (8)
  49. #define S5PC100_GPIO_K3_NR (8)
  50. #define S5PC100_GPIO_L0_NR (8)
  51. #define S5PC100_GPIO_L1_NR (8)
  52. #define S5PC100_GPIO_L2_NR (8)
  53. #define S5PC100_GPIO_L3_NR (8)
  54. #define S5PC100_GPIO_L4_NR (8)
  55. /* GPIO bank numbes */
  56. /* CONFIG_S3C_GPIO_SPACE allows the user to select extra
  57. * space for debugging purposes so that any accidental
  58. * change from one gpio bank to another can be caught.
  59. */
  60. #define S5PC100_GPIO_NEXT(__gpio) \
  61. ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
  62. enum s5p_gpio_number {
  63. S5PC100_GPIO_A0_START = 0,
  64. S5PC100_GPIO_A1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_A0),
  65. S5PC100_GPIO_B_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_A1),
  66. S5PC100_GPIO_C_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_B),
  67. S5PC100_GPIO_D_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_C),
  68. S5PC100_GPIO_E0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_D),
  69. S5PC100_GPIO_E1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_E0),
  70. S5PC100_GPIO_F0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_E1),
  71. S5PC100_GPIO_F1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F0),
  72. S5PC100_GPIO_F2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F1),
  73. S5PC100_GPIO_F3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F2),
  74. S5PC100_GPIO_G0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_F3),
  75. S5PC100_GPIO_G1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G0),
  76. S5PC100_GPIO_G2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G1),
  77. S5PC100_GPIO_G3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G2),
  78. S5PC100_GPIO_H0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_G3),
  79. S5PC100_GPIO_H1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H0),
  80. S5PC100_GPIO_H2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H1),
  81. S5PC100_GPIO_H3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H2),
  82. S5PC100_GPIO_I_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_H3),
  83. S5PC100_GPIO_J0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_I),
  84. S5PC100_GPIO_J1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J0),
  85. S5PC100_GPIO_J2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J1),
  86. S5PC100_GPIO_J3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J2),
  87. S5PC100_GPIO_J4_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J3),
  88. S5PC100_GPIO_K0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_J4),
  89. S5PC100_GPIO_K1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K0),
  90. S5PC100_GPIO_K2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K1),
  91. S5PC100_GPIO_K3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K2),
  92. S5PC100_GPIO_L0_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_K3),
  93. S5PC100_GPIO_L1_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L0),
  94. S5PC100_GPIO_L2_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L1),
  95. S5PC100_GPIO_L3_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L2),
  96. S5PC100_GPIO_L4_START = S5PC100_GPIO_NEXT(S5PC100_GPIO_L3),
  97. S5PC100_GPIO_END = S5PC100_GPIO_NEXT(S5PC100_GPIO_L4),
  98. };
  99. /* S5PC100 GPIO number definitions. */
  100. #define S5PC100_GPA0(_nr) (S5PC100_GPIO_A0_START + (_nr))
  101. #define S5PC100_GPA1(_nr) (S5PC100_GPIO_A1_START + (_nr))
  102. #define S5PC100_GPB(_nr) (S5PC100_GPIO_B_START + (_nr))
  103. #define S5PC100_GPC(_nr) (S5PC100_GPIO_C_START + (_nr))
  104. #define S5PC100_GPD(_nr) (S5PC100_GPIO_D_START + (_nr))
  105. #define S5PC100_GPE0(_nr) (S5PC100_GPIO_E0_START + (_nr))
  106. #define S5PC100_GPE1(_nr) (S5PC100_GPIO_E1_START + (_nr))
  107. #define S5PC100_GPF0(_nr) (S5PC100_GPIO_F0_START + (_nr))
  108. #define S5PC100_GPF1(_nr) (S5PC100_GPIO_F1_START + (_nr))
  109. #define S5PC100_GPF2(_nr) (S5PC100_GPIO_F2_START + (_nr))
  110. #define S5PC100_GPF3(_nr) (S5PC100_GPIO_F3_START + (_nr))
  111. #define S5PC100_GPG0(_nr) (S5PC100_GPIO_G0_START + (_nr))
  112. #define S5PC100_GPG1(_nr) (S5PC100_GPIO_G1_START + (_nr))
  113. #define S5PC100_GPG2(_nr) (S5PC100_GPIO_G2_START + (_nr))
  114. #define S5PC100_GPG3(_nr) (S5PC100_GPIO_G3_START + (_nr))
  115. #define S5PC100_GPH0(_nr) (S5PC100_GPIO_H0_START + (_nr))
  116. #define S5PC100_GPH1(_nr) (S5PC100_GPIO_H1_START + (_nr))
  117. #define S5PC100_GPH2(_nr) (S5PC100_GPIO_H2_START + (_nr))
  118. #define S5PC100_GPH3(_nr) (S5PC100_GPIO_H3_START + (_nr))
  119. #define S5PC100_GPI(_nr) (S5PC100_GPIO_I_START + (_nr))
  120. #define S5PC100_GPJ0(_nr) (S5PC100_GPIO_J0_START + (_nr))
  121. #define S5PC100_GPJ1(_nr) (S5PC100_GPIO_J1_START + (_nr))
  122. #define S5PC100_GPJ2(_nr) (S5PC100_GPIO_J2_START + (_nr))
  123. #define S5PC100_GPJ3(_nr) (S5PC100_GPIO_J3_START + (_nr))
  124. #define S5PC100_GPJ4(_nr) (S5PC100_GPIO_J4_START + (_nr))
  125. #define S5PC100_GPK0(_nr) (S5PC100_GPIO_K0_START + (_nr))
  126. #define S5PC100_GPK1(_nr) (S5PC100_GPIO_K1_START + (_nr))
  127. #define S5PC100_GPK2(_nr) (S5PC100_GPIO_K2_START + (_nr))
  128. #define S5PC100_GPK3(_nr) (S5PC100_GPIO_K3_START + (_nr))
  129. #define S5PC100_GPL0(_nr) (S5PC100_GPIO_L0_START + (_nr))
  130. #define S5PC100_GPL1(_nr) (S5PC100_GPIO_L1_START + (_nr))
  131. #define S5PC100_GPL2(_nr) (S5PC100_GPIO_L2_START + (_nr))
  132. #define S5PC100_GPL3(_nr) (S5PC100_GPIO_L3_START + (_nr))
  133. #define S5PC100_GPL4(_nr) (S5PC100_GPIO_L4_START + (_nr))
  134. /* It used the end of the S5PC100 gpios */
  135. #define S3C_GPIO_END S5PC100_GPIO_END
  136. /* define the number of gpios we need to the one after the MP04() range */
  137. #define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1)
  138. #define EINT_MODE S3C_GPIO_SFN(0x2)
  139. #define EINT_GPIO_0(x) S5PC100_GPH0(x)
  140. #define EINT_GPIO_1(x) S5PC100_GPH1(x)
  141. #define EINT_GPIO_2(x) S5PC100_GPH2(x)
  142. #define EINT_GPIO_3(x) S5PC100_GPH3(x)
  143. #include <asm-generic/gpio.h>
  144. #endif /* __ASM_ARCH_GPIO_H */