gpio-fns.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* arch/arm/mach-s3c2410/include/mach/gpio-fns.h
  2. *
  3. * Copyright (c) 2003-2009 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. *
  6. * S3C2410 - hardware
  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 __MACH_GPIO_FNS_H
  13. #define __MACH_GPIO_FNS_H __FILE__
  14. /* These functions are in the to-be-removed category and it is strongly
  15. * encouraged not to use these in new code. They will be marked deprecated
  16. * very soon.
  17. *
  18. * Most of the functionality can be either replaced by the gpiocfg calls
  19. * for the s3c platform or by the generic GPIOlib API.
  20. *
  21. * As of 2.6.35-rc, these will be removed, with the few drivers using them
  22. * either replaced or given a wrapper until the calls can be removed.
  23. */
  24. #include <plat/gpio-cfg.h>
  25. static inline void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int cfg)
  26. {
  27. /* 1:1 mapping between cfgpin and setcfg calls at the moment */
  28. s3c_gpio_cfgpin(pin, cfg);
  29. }
  30. /* external functions for GPIO support
  31. *
  32. * These allow various different clients to access the same GPIO
  33. * registers without conflicting. If your driver only owns the entire
  34. * GPIO register, then it is safe to ioremap/__raw_{read|write} to it.
  35. */
  36. extern unsigned int s3c2410_gpio_getcfg(unsigned int pin);
  37. /* s3c2410_gpio_getirq
  38. *
  39. * turn the given pin number into the corresponding IRQ number
  40. *
  41. * returns:
  42. * < 0 = no interrupt for this pin
  43. * >=0 = interrupt number for the pin
  44. */
  45. extern int s3c2410_gpio_getirq(unsigned int pin);
  46. #ifdef CONFIG_CPU_S3C2400
  47. extern int s3c2400_gpio_getirq(unsigned int pin);
  48. #endif /* CONFIG_CPU_S3C2400 */
  49. /* s3c2410_gpio_irqfilter
  50. *
  51. * set the irq filtering on the given pin
  52. *
  53. * on = 0 => disable filtering
  54. * 1 => enable filtering
  55. *
  56. * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
  57. * width of filter (0 through 63)
  58. *
  59. *
  60. */
  61. extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
  62. unsigned int config);
  63. /* s3c2410_gpio_pullup
  64. *
  65. * This call should be replaced with s3c_gpio_setpull().
  66. *
  67. * As a note, there is currently no distinction between pull-up and pull-down
  68. * in the s3c24xx series devices with only an on/off configuration.
  69. */
  70. /* s3c2410_gpio_pullup
  71. *
  72. * configure the pull-up control on the given pin
  73. *
  74. * to = 1 => disable the pull-up
  75. * 0 => enable the pull-up
  76. *
  77. * eg;
  78. *
  79. * s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
  80. * s3c2410_gpio_pullup(S3C2410_GPE(8), 0);
  81. */
  82. extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
  83. extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
  84. extern unsigned int s3c2410_gpio_getpin(unsigned int pin);
  85. #endif /* __MACH_GPIO_FNS_H */