io.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * DaVinci IO address definitions
  3. *
  4. * Copied from include/asm/arm/arch-omap/io.h
  5. *
  6. * 2007 (c) MontaVista Software, Inc. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #ifndef __ASM_ARCH_IO_H
  12. #define __ASM_ARCH_IO_H
  13. #define IO_SPACE_LIMIT 0xffffffff
  14. /*
  15. * ----------------------------------------------------------------------------
  16. * I/O mapping
  17. * ----------------------------------------------------------------------------
  18. */
  19. #define IO_PHYS 0x01c00000
  20. #define IO_OFFSET 0xfd000000 /* Virtual IO = 0xfec00000 */
  21. #define IO_SIZE 0x00400000
  22. #define IO_VIRT (IO_PHYS + IO_OFFSET)
  23. #define io_v2p(va) ((va) - IO_OFFSET)
  24. #define __IO_ADDRESS(x) ((x) + IO_OFFSET)
  25. /*
  26. * We don't actually have real ISA nor PCI buses, but there is so many
  27. * drivers out there that might just work if we fake them...
  28. */
  29. #define PCIO_BASE 0
  30. #define __io(a) ((void __iomem *)(PCIO_BASE + (a)))
  31. #define __mem_pci(a) (a)
  32. #define __mem_isa(a) (a)
  33. #define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa))
  34. #ifdef __ASSEMBLER__
  35. #define IOMEM(x) x
  36. #else
  37. #define IOMEM(x) ((void __force __iomem *)(x))
  38. /*
  39. * Functions to access the DaVinci IO region
  40. *
  41. * NOTE: - Use davinci_read/write[bwl] for physical register addresses
  42. * - Use __raw_read/write[bwl]() for virtual register addresses
  43. * - Use IO_ADDRESS(phys_addr) to convert registers to virtual addresses
  44. * - DO NOT use hardcoded virtual addresses to allow changing the
  45. * IO address space again if needed
  46. */
  47. #define davinci_readb(a) __raw_readb(IO_ADDRESS(a))
  48. #define davinci_readw(a) __raw_readw(IO_ADDRESS(a))
  49. #define davinci_readl(a) __raw_readl(IO_ADDRESS(a))
  50. #define davinci_writeb(v, a) __raw_writeb(v, IO_ADDRESS(a))
  51. #define davinci_writew(v, a) __raw_writew(v, IO_ADDRESS(a))
  52. #define davinci_writel(v, a) __raw_writel(v, IO_ADDRESS(a))
  53. #endif /* __ASSEMBLER__ */
  54. #endif /* __ASM_ARCH_IO_H */