io.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * include/asm-xtensa/io.h
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 2001 - 2005 Tensilica Inc.
  9. */
  10. #ifndef _XTENSA_IO_H
  11. #define _XTENSA_IO_H
  12. #ifdef __KERNEL__
  13. #include <asm/byteorder.h>
  14. #include <asm/page.h>
  15. #include <linux/bug.h>
  16. #include <linux/kernel.h>
  17. #include <linux/types.h>
  18. #define XCHAL_KIO_CACHED_VADDR 0xe0000000
  19. #define XCHAL_KIO_BYPASS_VADDR 0xf0000000
  20. #define XCHAL_KIO_PADDR 0xf0000000
  21. #define XCHAL_KIO_SIZE 0x10000000
  22. #define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
  23. #define IO_SPACE_LIMIT ~0
  24. #ifdef CONFIG_MMU
  25. /*
  26. * Return the virtual address for the specified bus memory.
  27. * Note that we currently don't support any address outside the KIO segment.
  28. */
  29. static inline void __iomem *ioremap_nocache(unsigned long offset,
  30. unsigned long size)
  31. {
  32. if (offset >= XCHAL_KIO_PADDR
  33. && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
  34. return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
  35. else
  36. BUG();
  37. }
  38. static inline void __iomem *ioremap_cache(unsigned long offset,
  39. unsigned long size)
  40. {
  41. if (offset >= XCHAL_KIO_PADDR
  42. && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
  43. return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
  44. else
  45. BUG();
  46. }
  47. #define ioremap_wc ioremap_nocache
  48. static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
  49. {
  50. return ioremap_nocache(offset, size);
  51. }
  52. static inline void iounmap(volatile void __iomem *addr)
  53. {
  54. }
  55. #define virt_to_bus virt_to_phys
  56. #define bus_to_virt phys_to_virt
  57. #endif /* CONFIG_MMU */
  58. /*
  59. * Generic I/O
  60. */
  61. #define readb_relaxed readb
  62. #define readw_relaxed readw
  63. #define readl_relaxed readl
  64. #endif /* __KERNEL__ */
  65. #include <asm-generic/io.h>
  66. #endif /* _XTENSA_IO_H */