io.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * linux/include/asm-arm/arch-l7200/io.h
  3. *
  4. * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
  5. *
  6. * Changelog:
  7. * 03-21-2000 SJH Created from linux/include/asm-arm/arch-nexuspci/io.h
  8. * 08-31-2000 SJH Added in IO functions necessary for new drivers
  9. */
  10. #ifndef __ASM_ARM_ARCH_IO_H
  11. #define __ASM_ARM_ARCH_IO_H
  12. #include <asm/hardware.h>
  13. #define IO_SPACE_LIMIT 0xffffffff
  14. /*
  15. * There are not real ISA nor PCI buses, so we fake it.
  16. */
  17. #define __io_pci(a) ((void __iomem *)(PCIO_BASE + (a)))
  18. #define __mem_pci(a) (a)
  19. #define __ioaddr(p) __io_pci(p)
  20. /*
  21. * Generic virtual read/write
  22. */
  23. #define __arch_getb(a) (*(volatile unsigned char *)(a))
  24. #define __arch_getl(a) (*(volatile unsigned int *)(a))
  25. static inline unsigned int __arch_getw(unsigned long a)
  26. {
  27. unsigned int value;
  28. __asm__ __volatile__("ldr%?h %0, [%1, #0] @ getw"
  29. : "=&r" (value)
  30. : "r" (a));
  31. return value;
  32. }
  33. #define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v))
  34. #define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))
  35. static inline void __arch_putw(unsigned int value, unsigned long a)
  36. {
  37. __asm__ __volatile__("str%?h %0, [%1, #0] @ putw"
  38. : : "r" (value), "r" (a));
  39. }
  40. /*
  41. * Translated address IO functions
  42. *
  43. * IO address has already been translated to a virtual address
  44. */
  45. #define outb_t(v,p) (*(volatile unsigned char *)(p) = (v))
  46. #define inb_t(p) (*(volatile unsigned char *)(p))
  47. #define outw_t(v,p) (*(volatile unsigned int *)(p) = (v))
  48. #define inw_t(p) (*(volatile unsigned int *)(p))
  49. #define outl_t(v,p) (*(volatile unsigned long *)(p) = (v))
  50. #define inl_t(p) (*(volatile unsigned long *)(p))
  51. /*
  52. * FIXME - These are to allow for linking. On all the other
  53. * ARM platforms, the entire IO space is contiguous.
  54. * The 7200 has three separate IO spaces. The below
  55. * macros will eventually become more involved. Use
  56. * with caution and don't be surprised by kernel oopses!!!
  57. */
  58. #define inb(p) inb_t(p)
  59. #define inw(p) inw_t(p)
  60. #define inl(p) inl_t(p)
  61. #define outb(v,p) outb_t(v,p)
  62. #define outw(v,p) outw_t(v,p)
  63. #define outl(v,p) outl_t(v,p)
  64. #endif