gpio.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* arch/arm/mach-s3c6400/include/mach/gpio.h
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * http://armlinux.simtec.co.uk/
  6. * Ben Dooks <ben@simtec.co.uk>
  7. *
  8. * S3C6400 - GPIO lib support
  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. /* GPIO bank sizes */
  15. #define S3C64XX_GPIO_A_NR (8)
  16. #define S3C64XX_GPIO_B_NR (7)
  17. #define S3C64XX_GPIO_C_NR (8)
  18. #define S3C64XX_GPIO_D_NR (5)
  19. #define S3C64XX_GPIO_E_NR (5)
  20. #define S3C64XX_GPIO_F_NR (16)
  21. #define S3C64XX_GPIO_G_NR (7)
  22. #define S3C64XX_GPIO_H_NR (10)
  23. #define S3C64XX_GPIO_I_NR (16)
  24. #define S3C64XX_GPIO_J_NR (12)
  25. #define S3C64XX_GPIO_K_NR (16)
  26. #define S3C64XX_GPIO_L_NR (15)
  27. #define S3C64XX_GPIO_M_NR (6)
  28. #define S3C64XX_GPIO_N_NR (16)
  29. #define S3C64XX_GPIO_O_NR (16)
  30. #define S3C64XX_GPIO_P_NR (15)
  31. #define S3C64XX_GPIO_Q_NR (9)
  32. /* GPIO bank numbes */
  33. /* CONFIG_S3C_GPIO_SPACE allows the user to select extra
  34. * space for debugging purposes so that any accidental
  35. * change from one gpio bank to another can be caught.
  36. */
  37. #define S3C64XX_GPIO_NEXT(__gpio) \
  38. ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
  39. enum s3c_gpio_number {
  40. S3C64XX_GPIO_A_START = 0,
  41. S3C64XX_GPIO_B_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_A),
  42. S3C64XX_GPIO_C_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_B),
  43. S3C64XX_GPIO_D_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_C),
  44. S3C64XX_GPIO_E_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_D),
  45. S3C64XX_GPIO_F_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_E),
  46. S3C64XX_GPIO_G_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_F),
  47. S3C64XX_GPIO_H_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_G),
  48. S3C64XX_GPIO_I_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_H),
  49. S3C64XX_GPIO_J_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_I),
  50. S3C64XX_GPIO_K_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_J),
  51. S3C64XX_GPIO_L_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_K),
  52. S3C64XX_GPIO_M_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_L),
  53. S3C64XX_GPIO_N_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_M),
  54. S3C64XX_GPIO_O_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_N),
  55. S3C64XX_GPIO_P_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_O),
  56. S3C64XX_GPIO_Q_START = S3C64XX_GPIO_NEXT(S3C64XX_GPIO_P),
  57. };
  58. /* S3C64XX GPIO number definitions. */
  59. #define S3C64XX_GPA(_nr) (S3C64XX_GPIO_A_START + (_nr))
  60. #define S3C64XX_GPB(_nr) (S3C64XX_GPIO_B_START + (_nr))
  61. #define S3C64XX_GPC(_nr) (S3C64XX_GPIO_C_START + (_nr))
  62. #define S3C64XX_GPD(_nr) (S3C64XX_GPIO_D_START + (_nr))
  63. #define S3C64XX_GPE(_nr) (S3C64XX_GPIO_E_START + (_nr))
  64. #define S3C64XX_GPF(_nr) (S3C64XX_GPIO_F_START + (_nr))
  65. #define S3C64XX_GPG(_nr) (S3C64XX_GPIO_G_START + (_nr))
  66. #define S3C64XX_GPH(_nr) (S3C64XX_GPIO_H_START + (_nr))
  67. #define S3C64XX_GPI(_nr) (S3C64XX_GPIO_I_START + (_nr))
  68. #define S3C64XX_GPJ(_nr) (S3C64XX_GPIO_J_START + (_nr))
  69. #define S3C64XX_GPK(_nr) (S3C64XX_GPIO_K_START + (_nr))
  70. #define S3C64XX_GPL(_nr) (S3C64XX_GPIO_L_START + (_nr))
  71. #define S3C64XX_GPM(_nr) (S3C64XX_GPIO_M_START + (_nr))
  72. #define S3C64XX_GPN(_nr) (S3C64XX_GPIO_N_START + (_nr))
  73. #define S3C64XX_GPO(_nr) (S3C64XX_GPIO_O_START + (_nr))
  74. #define S3C64XX_GPP(_nr) (S3C64XX_GPIO_P_START + (_nr))
  75. #define S3C64XX_GPQ(_nr) (S3C64XX_GPIO_Q_START + (_nr))
  76. /* the end of the S3C64XX specific gpios */
  77. #define S3C64XX_GPIO_END (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
  78. #define S3C_GPIO_END S3C64XX_GPIO_END
  79. /* define the number of gpios we need to the one after the GPQ() range */
  80. #define GPIO_BOARD_START (S3C64XX_GPQ(S3C64XX_GPIO_Q_NR) + 1)
  81. #define BOARD_NR_GPIOS (16 + CONFIG_SAMSUNG_GPIO_EXTRA)
  82. #define ARCH_NR_GPIOS (GPIO_BOARD_START + BOARD_NR_GPIOS)