2 * include/asm-xtensa/io.h
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
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
15 #include <asm/byteorder.h>
17 #include <asm/vectors.h>
18 #include <linux/bug.h>
19 #include <linux/kernel.h>
21 #include <linux/types.h>
23 #define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
24 #define IO_SPACE_LIMIT ~0
28 void __iomem *xtensa_ioremap_nocache(unsigned long addr, unsigned long size);
29 void __iomem *xtensa_ioremap_cache(unsigned long addr, unsigned long size);
30 void xtensa_iounmap(volatile void __iomem *addr);
33 * Return the virtual address for the specified bus memory.
35 static inline void __iomem *ioremap_nocache(unsigned long offset,
38 if (offset >= XCHAL_KIO_PADDR
39 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
40 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
42 return xtensa_ioremap_nocache(offset, size);
45 static inline void __iomem *ioremap_cache(unsigned long offset,
48 if (offset >= XCHAL_KIO_PADDR
49 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
50 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
52 return xtensa_ioremap_cache(offset, size);
54 #define ioremap_cache ioremap_cache
55 #define ioremap_nocache ioremap_nocache
57 #define ioremap_wc ioremap_nocache
58 #define ioremap_wt ioremap_nocache
60 static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
62 return ioremap_nocache(offset, size);
65 static inline void iounmap(volatile void __iomem *addr)
67 unsigned long va = (unsigned long) addr;
69 if (!(va >= XCHAL_KIO_CACHED_VADDR &&
70 va - XCHAL_KIO_CACHED_VADDR < XCHAL_KIO_SIZE) &&
71 !(va >= XCHAL_KIO_BYPASS_VADDR &&
72 va - XCHAL_KIO_BYPASS_VADDR < XCHAL_KIO_SIZE))
76 #define virt_to_bus virt_to_phys
77 #define bus_to_virt phys_to_virt
79 #endif /* CONFIG_MMU */
81 #endif /* __KERNEL__ */
83 #include <asm-generic/io.h>
85 #endif /* _XTENSA_IO_H */