]>
git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - arch/xtensa/include/asm/io.h
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.
14 #include <asm/byteorder.h>
16 #include <asm/vectors.h>
17 #include <linux/bug.h>
18 #include <linux/kernel.h>
20 #include <linux/types.h>
22 #define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
23 #define IO_SPACE_LIMIT ~0
27 void __iomem
*xtensa_ioremap_nocache(unsigned long addr
, unsigned long size
);
28 void __iomem
*xtensa_ioremap_cache(unsigned long addr
, unsigned long size
);
29 void xtensa_iounmap(volatile void __iomem
*addr
);
32 * Return the virtual address for the specified bus memory.
34 static inline void __iomem
*ioremap_nocache(unsigned long offset
,
37 if (offset
>= XCHAL_KIO_PADDR
38 && offset
- XCHAL_KIO_PADDR
< XCHAL_KIO_SIZE
)
39 return (void*)(offset
-XCHAL_KIO_PADDR
+XCHAL_KIO_BYPASS_VADDR
);
41 return xtensa_ioremap_nocache(offset
, size
);
44 static inline void __iomem
*ioremap_cache(unsigned long offset
,
47 if (offset
>= XCHAL_KIO_PADDR
48 && offset
- XCHAL_KIO_PADDR
< XCHAL_KIO_SIZE
)
49 return (void*)(offset
-XCHAL_KIO_PADDR
+XCHAL_KIO_CACHED_VADDR
);
51 return xtensa_ioremap_cache(offset
, size
);
53 #define ioremap_cache ioremap_cache
54 #define ioremap_nocache ioremap_nocache
56 #define ioremap_wc ioremap_nocache
57 #define ioremap_wt ioremap_nocache
59 static inline void __iomem
*ioremap(unsigned long offset
, unsigned long size
)
61 return ioremap_nocache(offset
, size
);
64 static inline void iounmap(volatile void __iomem
*addr
)
66 unsigned long va
= (unsigned long) addr
;
68 if (!(va
>= XCHAL_KIO_CACHED_VADDR
&&
69 va
- XCHAL_KIO_CACHED_VADDR
< XCHAL_KIO_SIZE
) &&
70 !(va
>= XCHAL_KIO_BYPASS_VADDR
&&
71 va
- XCHAL_KIO_BYPASS_VADDR
< XCHAL_KIO_SIZE
))
75 #define virt_to_bus virt_to_phys
76 #define bus_to_virt phys_to_virt
78 #endif /* CONFIG_MMU */
80 #include <asm-generic/io.h>
82 #endif /* _XTENSA_IO_H */