gpio-fns.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. /* s3c2410_gpio_irqfilter
  47. *
  48. * set the irq filtering on the given pin
  49. *
  50. * on = 0 => disable filtering
  51. * 1 => enable filtering
  52. *
  53. * config = S3C2410_EINTFLT_PCLK or S3C2410_EINTFLT_EXTCLK orred with
  54. * width of filter (0 through 63)
  55. *
  56. *
  57. */
  58. extern int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
  59. unsigned int config);
  60. /* s3c2410_gpio_pullup
  61. *
  62. * This call should be replaced with s3c_gpio_setpull().
  63. *
  64. * As a note, there is currently no distinction between pull-up and pull-down
  65. * in the s3c24xx series devices with only an on/off configuration.
  66. */
  67. /* s3c2410_gpio_pullup
  68. *
  69. * configure the pull-up control on the given pin
  70. *
  71. * to = 1 => disable the pull-up
  72. * 0 => enable the pull-up
  73. *
  74. * eg;
  75. *
  76. * s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
  77. * s3c2410_gpio_pullup(S3C2410_GPE(8), 0);
  78. */
  79. extern void s3c2410_gpio_pullup(unsigned int pin, unsigned int to);
  80. extern void s3c2410_gpio_setpin(unsigned int pin, unsigned int to);
  81. extern unsigned int s3c2410_gpio_getpin(unsigned int pin);
  82. #endif /* __MACH_GPIO_FNS_H */