io.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. #endif /* CONFIG_MMU */
  56. /*
  57. * Generic I/O
  58. */
  59. #define readb_relaxed readb
  60. #define readw_relaxed readw
  61. #define readl_relaxed readl
  62. #endif /* __KERNEL__ */
  63. #include <asm-generic/io.h>
  64. #endif /* _XTENSA_IO_H */