gpio.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* linux/arch/arm/mach-s5pv310/include/mach/gpio.h
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com/
  5. *
  6. * S5PV310 - GPIO lib support
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __ASM_ARCH_GPIO_H
  13. #define __ASM_ARCH_GPIO_H __FILE__
  14. #define gpio_get_value __gpio_get_value
  15. #define gpio_set_value __gpio_set_value
  16. #define gpio_cansleep __gpio_cansleep
  17. #define gpio_to_irq __gpio_to_irq
  18. /* Practically, GPIO banks upto GPZ are the configurable gpio banks */
  19. /* GPIO bank sizes */
  20. #define S5PV310_GPIO_A0_NR (8)
  21. #define S5PV310_GPIO_A1_NR (6)
  22. #define S5PV310_GPIO_B_NR (8)
  23. #define S5PV310_GPIO_C0_NR (5)
  24. #define S5PV310_GPIO_C1_NR (5)
  25. #define S5PV310_GPIO_D0_NR (4)
  26. #define S5PV310_GPIO_D1_NR (4)
  27. #define S5PV310_GPIO_E0_NR (5)
  28. #define S5PV310_GPIO_E1_NR (8)
  29. #define S5PV310_GPIO_E2_NR (6)
  30. #define S5PV310_GPIO_E3_NR (8)
  31. #define S5PV310_GPIO_E4_NR (8)
  32. #define S5PV310_GPIO_F0_NR (8)
  33. #define S5PV310_GPIO_F1_NR (8)
  34. #define S5PV310_GPIO_F2_NR (8)
  35. #define S5PV310_GPIO_F3_NR (6)
  36. #define S5PV310_GPIO_J0_NR (8)
  37. #define S5PV310_GPIO_J1_NR (5)
  38. #define S5PV310_GPIO_K0_NR (7)
  39. #define S5PV310_GPIO_K1_NR (7)
  40. #define S5PV310_GPIO_K2_NR (7)
  41. #define S5PV310_GPIO_K3_NR (7)
  42. #define S5PV310_GPIO_L0_NR (8)
  43. #define S5PV310_GPIO_L1_NR (3)
  44. #define S5PV310_GPIO_L2_NR (8)
  45. #define S5PV310_GPIO_X0_NR (8)
  46. #define S5PV310_GPIO_X1_NR (8)
  47. #define S5PV310_GPIO_X2_NR (8)
  48. #define S5PV310_GPIO_X3_NR (8)
  49. #define S5PV310_GPIO_Z_NR (7)
  50. /* GPIO bank numbers */
  51. #define S5PV310_GPIO_NEXT(__gpio) \
  52. ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
  53. enum s5p_gpio_number {
  54. S5PV310_GPIO_A0_START = 0,
  55. S5PV310_GPIO_A1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_A0),
  56. S5PV310_GPIO_B_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_A1),
  57. S5PV310_GPIO_C0_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_B),
  58. S5PV310_GPIO_C1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_C0),
  59. S5PV310_GPIO_D0_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_C1),
  60. S5PV310_GPIO_D1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_D0),
  61. S5PV310_GPIO_E0_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_D1),
  62. S5PV310_GPIO_E1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_E0),
  63. S5PV310_GPIO_E2_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_E1),
  64. S5PV310_GPIO_E3_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_E2),
  65. S5PV310_GPIO_E4_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_E3),
  66. S5PV310_GPIO_F0_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_E4),
  67. S5PV310_GPIO_F1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_F0),
  68. S5PV310_GPIO_F2_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_F1),
  69. S5PV310_GPIO_F3_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_F2),
  70. S5PV310_GPIO_J0_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_F3),
  71. S5PV310_GPIO_J1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_J0),
  72. S5PV310_GPIO_K0_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_J1),
  73. S5PV310_GPIO_K1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_K0),
  74. S5PV310_GPIO_K2_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_K1),
  75. S5PV310_GPIO_K3_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_K2),
  76. S5PV310_GPIO_L0_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_K3),
  77. S5PV310_GPIO_L1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_L0),
  78. S5PV310_GPIO_L2_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_L1),
  79. S5PV310_GPIO_X0_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_L2),
  80. S5PV310_GPIO_X1_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_X0),
  81. S5PV310_GPIO_X2_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_X1),
  82. S5PV310_GPIO_X3_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_X2),
  83. S5PV310_GPIO_Z_START = S5PV310_GPIO_NEXT(S5PV310_GPIO_X3),
  84. };
  85. /* S5PV310 GPIO number definitions */
  86. #define S5PV310_GPA0(_nr) (S5PV310_GPIO_A0_START + (_nr))
  87. #define S5PV310_GPA1(_nr) (S5PV310_GPIO_A1_START + (_nr))
  88. #define S5PV310_GPB(_nr) (S5PV310_GPIO_B_START + (_nr))
  89. #define S5PV310_GPC0(_nr) (S5PV310_GPIO_C0_START + (_nr))
  90. #define S5PV310_GPC1(_nr) (S5PV310_GPIO_C1_START + (_nr))
  91. #define S5PV310_GPD0(_nr) (S5PV310_GPIO_D0_START + (_nr))
  92. #define S5PV310_GPD1(_nr) (S5PV310_GPIO_D1_START + (_nr))
  93. #define S5PV310_GPE0(_nr) (S5PV310_GPIO_E0_START + (_nr))
  94. #define S5PV310_GPE1(_nr) (S5PV310_GPIO_E1_START + (_nr))
  95. #define S5PV310_GPE2(_nr) (S5PV310_GPIO_E2_START + (_nr))
  96. #define S5PV310_GPE3(_nr) (S5PV310_GPIO_E3_START + (_nr))
  97. #define S5PV310_GPE4(_nr) (S5PV310_GPIO_E4_START + (_nr))
  98. #define S5PV310_GPF0(_nr) (S5PV310_GPIO_F0_START + (_nr))
  99. #define S5PV310_GPF1(_nr) (S5PV310_GPIO_F1_START + (_nr))
  100. #define S5PV310_GPF2(_nr) (S5PV310_GPIO_F2_START + (_nr))
  101. #define S5PV310_GPF3(_nr) (S5PV310_GPIO_F3_START + (_nr))
  102. #define S5PV310_GPJ0(_nr) (S5PV310_GPIO_J0_START + (_nr))
  103. #define S5PV310_GPJ1(_nr) (S5PV310_GPIO_J1_START + (_nr))
  104. #define S5PV310_GPK0(_nr) (S5PV310_GPIO_K0_START + (_nr))
  105. #define S5PV310_GPK1(_nr) (S5PV310_GPIO_K1_START + (_nr))
  106. #define S5PV310_GPK2(_nr) (S5PV310_GPIO_K2_START + (_nr))
  107. #define S5PV310_GPK3(_nr) (S5PV310_GPIO_K3_START + (_nr))
  108. #define S5PV310_GPL0(_nr) (S5PV310_GPIO_L0_START + (_nr))
  109. #define S5PV310_GPL1(_nr) (S5PV310_GPIO_L1_START + (_nr))
  110. #define S5PV310_GPL2(_nr) (S5PV310_GPIO_L2_START + (_nr))
  111. #define S5PV310_GPX0(_nr) (S5PV310_GPIO_X0_START + (_nr))
  112. #define S5PV310_GPX1(_nr) (S5PV310_GPIO_X1_START + (_nr))
  113. #define S5PV310_GPX2(_nr) (S5PV310_GPIO_X2_START + (_nr))
  114. #define S5PV310_GPX3(_nr) (S5PV310_GPIO_X3_START + (_nr))
  115. #define S5PV310_GPZ(_nr) (S5PV310_GPIO_Z_START + (_nr))
  116. /* the end of the S5PV310 specific gpios */
  117. #define S5PV310_GPIO_END (S5PV310_GPZ(S5PV310_GPIO_Z_NR) + 1)
  118. #define S3C_GPIO_END S5PV310_GPIO_END
  119. /* define the number of gpios we need to the one after the GPZ() range */
  120. #define ARCH_NR_GPIOS (S5PV310_GPZ(S5PV310_GPIO_Z_NR) + \
  121. CONFIG_SAMSUNG_GPIO_EXTRA + 1)
  122. #include <asm-generic/gpio.h>
  123. #endif /* __ASM_ARCH_GPIO_H */