gpio.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * OpenRISC Linux
  3. *
  4. * Linux architectural port borrowing liberally from similar works of
  5. * others. All original copyrights apply as per the original source
  6. * declaration.
  7. *
  8. * OpenRISC implementation:
  9. * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
  10. * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
  11. * et al.
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version.
  17. */
  18. #ifndef __ASM_OPENRISC_GPIO_H
  19. #define __ASM_OPENRISC_GPIO_H
  20. #include <linux/errno.h>
  21. #include <asm-generic/gpio.h>
  22. #ifdef CONFIG_GPIOLIB
  23. /*
  24. * OpenRISC (or1k) does not have on-chip GPIO's so there is not really
  25. * any standardized implementation that makes sense here. If passing
  26. * through gpiolib becomes a bottleneck then it may make sense, on a
  27. * case-by-case basis, to implement these inlined/rapid versions.
  28. *
  29. * Just call gpiolib.
  30. */
  31. static inline int gpio_get_value(unsigned int gpio)
  32. {
  33. return __gpio_get_value(gpio);
  34. }
  35. static inline void gpio_set_value(unsigned int gpio, int value)
  36. {
  37. __gpio_set_value(gpio, value);
  38. }
  39. static inline int gpio_cansleep(unsigned int gpio)
  40. {
  41. return __gpio_cansleep(gpio);
  42. }
  43. /*
  44. * Not implemented, yet.
  45. */
  46. static inline int gpio_to_irq(unsigned int gpio)
  47. {
  48. return -ENOSYS;
  49. }
  50. static inline int irq_to_gpio(unsigned int irq)
  51. {
  52. return -EINVAL;
  53. }
  54. #endif /* CONFIG_GPIOLIB */
  55. #endif /* __ASM_OPENRISC_GPIO_H */