sh-gpio.h 1018 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Generic GPIO API and pinmux table support
  3. *
  4. * Copyright (c) 2008 Magnus Damm
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #ifndef __ASM_ARCH_GPIO_H
  11. #define __ASM_ARCH_GPIO_H
  12. #include <linux/kernel.h>
  13. #include <linux/errno.h>
  14. #include <linux/io.h>
  15. /*
  16. * FIXME !!
  17. *
  18. * current gpio frame work doesn't have
  19. * the method to control only pull up/down/free.
  20. * this function should be replaced by correct gpio function
  21. */
  22. static inline void __init gpio_direction_none(void __iomem * addr)
  23. {
  24. __raw_writeb(0x00, addr);
  25. }
  26. static inline void __init gpio_request_pullup(void __iomem * addr)
  27. {
  28. u8 data = __raw_readb(addr);
  29. data &= 0x0F;
  30. data |= 0xC0;
  31. __raw_writeb(data, addr);
  32. }
  33. static inline void __init gpio_request_pulldown(void __iomem * addr)
  34. {
  35. u8 data = __raw_readb(addr);
  36. data &= 0x0F;
  37. data |= 0xA0;
  38. __raw_writeb(data, addr);
  39. }
  40. #endif /* __ASM_ARCH_GPIO_H */