gpio.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * arch/arm/mach-ixp4xx/include/mach/gpio.h
  3. *
  4. * IXP4XX GPIO wrappers for arch-neutral GPIO calls
  5. *
  6. * Written by Milan Svoboda <msvoboda@ra.rockwell.com>
  7. * Based on PXA implementation by Philipp Zabel <philipp.zabel@gmail.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. */
  24. #ifndef __ASM_ARCH_IXP4XX_GPIO_H
  25. #define __ASM_ARCH_IXP4XX_GPIO_H
  26. #include <linux/kernel.h>
  27. #include <mach/hardware.h>
  28. static inline int gpio_request(unsigned gpio, const char *label)
  29. {
  30. return 0;
  31. }
  32. static inline void gpio_free(unsigned gpio)
  33. {
  34. might_sleep();
  35. return;
  36. }
  37. static inline int gpio_direction_input(unsigned gpio)
  38. {
  39. gpio_line_config(gpio, IXP4XX_GPIO_IN);
  40. return 0;
  41. }
  42. static inline int gpio_direction_output(unsigned gpio, int level)
  43. {
  44. gpio_line_set(gpio, level);
  45. gpio_line_config(gpio, IXP4XX_GPIO_OUT);
  46. return 0;
  47. }
  48. static inline int gpio_get_value(unsigned gpio)
  49. {
  50. int value;
  51. gpio_line_get(gpio, &value);
  52. return value;
  53. }
  54. static inline void gpio_set_value(unsigned gpio, int value)
  55. {
  56. gpio_line_set(gpio, value);
  57. }
  58. #include <asm-generic/gpio.h> /* cansleep wrappers */
  59. extern int gpio_to_irq(int gpio);
  60. extern int irq_to_gpio(unsigned int irq);
  61. #endif