gpio.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* linux/arch/arm/mach-s5p6440/include/mach/gpio.h
  2. *
  3. * Copyright (c) 2009 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com/
  5. *
  6. * S5P6440 - 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. /* GPIO bank sizes */
  19. #define S5P6440_GPIO_A_NR (6)
  20. #define S5P6440_GPIO_B_NR (7)
  21. #define S5P6440_GPIO_C_NR (8)
  22. #define S5P6440_GPIO_F_NR (2)
  23. #define S5P6440_GPIO_G_NR (7)
  24. #define S5P6440_GPIO_H_NR (10)
  25. #define S5P6440_GPIO_I_NR (16)
  26. #define S5P6440_GPIO_J_NR (12)
  27. #define S5P6440_GPIO_N_NR (16)
  28. #define S5P6440_GPIO_P_NR (8)
  29. #define S5P6440_GPIO_R_NR (15)
  30. /* GPIO bank numbers */
  31. /* CONFIG_S3C_GPIO_SPACE allows the user to select extra
  32. * space for debugging purposes so that any accidental
  33. * change from one gpio bank to another can be caught.
  34. */
  35. #define S5P6440_GPIO_NEXT(__gpio) \
  36. ((__gpio##_START) + (__gpio##_NR) + CONFIG_S3C_GPIO_SPACE + 1)
  37. enum s5p_gpio_number {
  38. S5P6440_GPIO_A_START = 0,
  39. S5P6440_GPIO_B_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_A),
  40. S5P6440_GPIO_C_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_B),
  41. S5P6440_GPIO_F_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_C),
  42. S5P6440_GPIO_G_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_F),
  43. S5P6440_GPIO_H_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_G),
  44. S5P6440_GPIO_I_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_H),
  45. S5P6440_GPIO_J_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_I),
  46. S5P6440_GPIO_N_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_J),
  47. S5P6440_GPIO_P_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_N),
  48. S5P6440_GPIO_R_START = S5P6440_GPIO_NEXT(S5P6440_GPIO_P),
  49. };
  50. /* S5P6440 GPIO number definitions. */
  51. #define S5P6440_GPA(_nr) (S5P6440_GPIO_A_START + (_nr))
  52. #define S5P6440_GPB(_nr) (S5P6440_GPIO_B_START + (_nr))
  53. #define S5P6440_GPC(_nr) (S5P6440_GPIO_C_START + (_nr))
  54. #define S5P6440_GPF(_nr) (S5P6440_GPIO_F_START + (_nr))
  55. #define S5P6440_GPG(_nr) (S5P6440_GPIO_G_START + (_nr))
  56. #define S5P6440_GPH(_nr) (S5P6440_GPIO_H_START + (_nr))
  57. #define S5P6440_GPI(_nr) (S5P6440_GPIO_I_START + (_nr))
  58. #define S5P6440_GPJ(_nr) (S5P6440_GPIO_J_START + (_nr))
  59. #define S5P6440_GPN(_nr) (S5P6440_GPIO_N_START + (_nr))
  60. #define S5P6440_GPP(_nr) (S5P6440_GPIO_P_START + (_nr))
  61. #define S5P6440_GPR(_nr) (S5P6440_GPIO_R_START + (_nr))
  62. /* the end of the S5P6440 specific gpios */
  63. #define S5P6440_GPIO_END (S5P6440_GPR(S5P6440_GPIO_R_NR) + 1)
  64. #define S3C_GPIO_END S5P6440_GPIO_END
  65. /* define the number of gpios we need to the one after the GPR() range */
  66. #define ARCH_NR_GPIOS (S5P6440_GPR(S5P6440_GPIO_R_NR) + \
  67. CONFIG_SAMSUNG_GPIO_EXTRA + 1)
  68. #include <asm-generic/gpio.h>
  69. #endif /* __ASM_ARCH_GPIO_H */