io.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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/arch/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 __mem_isa(a) (a)
  20. #define __ioaddr(p) __io_pci(p)
  21. /*
  22. * Generic virtual read/write
  23. */
  24. #define __arch_getb(a) (*(volatile unsigned char *)(a))
  25. #define __arch_getl(a) (*(volatile unsigned int *)(a))
  26. static inline unsigned int __arch_getw(unsigned long a)
  27. {
  28. unsigned int value;
  29. __asm__ __volatile__("ldr%?h %0, [%1, #0] @ getw"
  30. : "=&r" (value)
  31. : "r" (a));
  32. return value;
  33. }
  34. #define __arch_putb(v,a) (*(volatile unsigned char *)(a) = (v))
  35. #define __arch_putl(v,a) (*(volatile unsigned int *)(a) = (v))
  36. static inline void __arch_putw(unsigned int value, unsigned long a)
  37. {
  38. __asm__ __volatile__("str%?h %0, [%1, #0] @ putw"
  39. : : "r" (value), "r" (a));
  40. }
  41. /*
  42. * Translated address IO functions
  43. *
  44. * IO address has already been translated to a virtual address
  45. */
  46. #define outb_t(v,p) (*(volatile unsigned char *)(p) = (v))
  47. #define inb_t(p) (*(volatile unsigned char *)(p))
  48. #define outw_t(v,p) (*(volatile unsigned int *)(p) = (v))
  49. #define inw_t(p) (*(volatile unsigned int *)(p))
  50. #define outl_t(v,p) (*(volatile unsigned long *)(p) = (v))
  51. #define inl_t(p) (*(volatile unsigned long *)(p))
  52. /*
  53. * FIXME - These are to allow for linking. On all the other
  54. * ARM platforms, the entire IO space is contiguous.
  55. * The 7200 has three separate IO spaces. The below
  56. * macros will eventually become more involved. Use
  57. * with caution and don't be surprised by kernel oopses!!!
  58. */
  59. #define inb(p) inb_t(p)
  60. #define inw(p) inw_t(p)
  61. #define inl(p) inl_t(p)
  62. #define outb(v,p) outb_t(v,p)
  63. #define outw(v,p) outw_t(v,p)
  64. #define outl(v,p) outl_t(v,p)
  65. #endif