io.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 <asm/vectors.h>
  16. #include <linux/bug.h>
  17. #include <linux/kernel.h>
  18. #include <linux/types.h>
  19. #define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
  20. #define IO_SPACE_LIMIT ~0
  21. #ifdef CONFIG_MMU
  22. #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF)
  23. extern unsigned long xtensa_kio_paddr;
  24. static inline unsigned long xtensa_get_kio_paddr(void)
  25. {
  26. return xtensa_kio_paddr;
  27. }
  28. #endif
  29. /*
  30. * Return the virtual address for the specified bus memory.
  31. * Note that we currently don't support any address outside the KIO segment.
  32. */
  33. static inline void __iomem *ioremap_nocache(unsigned long offset,
  34. unsigned long size)
  35. {
  36. if (offset >= XCHAL_KIO_PADDR
  37. && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
  38. return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
  39. else
  40. BUG();
  41. }
  42. static inline void __iomem *ioremap_cache(unsigned long offset,
  43. unsigned long size)
  44. {
  45. if (offset >= XCHAL_KIO_PADDR
  46. && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
  47. return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
  48. else
  49. BUG();
  50. }
  51. #define ioremap_wc ioremap_nocache
  52. static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
  53. {
  54. return ioremap_nocache(offset, size);
  55. }
  56. static inline void iounmap(volatile void __iomem *addr)
  57. {
  58. }
  59. #define virt_to_bus virt_to_phys
  60. #define bus_to_virt phys_to_virt
  61. #endif /* CONFIG_MMU */
  62. /*
  63. * Generic I/O
  64. */
  65. #define readb_relaxed readb
  66. #define readw_relaxed readw
  67. #define readl_relaxed readl
  68. #endif /* __KERNEL__ */
  69. #include <asm-generic/io.h>
  70. #endif /* _XTENSA_IO_H */