Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / xtensa / include / asm / io.h
blob74944207167eccfb0f6e122ad7418d5728d4a2b7
1 /*
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
6 * for more details.
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
11 #ifndef _XTENSA_IO_H
12 #define _XTENSA_IO_H
14 #ifdef __KERNEL__
15 #include <asm/byteorder.h>
16 #include <asm/page.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
26 #ifdef CONFIG_MMU
28 #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY && defined(CONFIG_OF)
29 extern unsigned long xtensa_kio_paddr;
31 static inline unsigned long xtensa_get_kio_paddr(void)
33 return xtensa_kio_paddr;
35 #endif
38 * Return the virtual address for the specified bus memory.
39 * Note that we currently don't support any address outside the KIO segment.
41 static inline void __iomem *ioremap_nocache(unsigned long offset,
42 unsigned long size)
44 if (offset >= XCHAL_KIO_PADDR
45 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
46 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
47 else
48 BUG();
51 static inline void __iomem *ioremap_cache(unsigned long offset,
52 unsigned long size)
54 if (offset >= XCHAL_KIO_PADDR
55 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
56 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
57 else
58 BUG();
61 #define ioremap_wc ioremap_nocache
63 static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
65 return ioremap_nocache(offset, size);
68 static inline void iounmap(volatile void __iomem *addr)
72 #define virt_to_bus virt_to_phys
73 #define bus_to_virt phys_to_virt
75 #endif /* CONFIG_MMU */
78 * Generic I/O
80 #define readb_relaxed readb
81 #define readw_relaxed readw
82 #define readl_relaxed readl
84 #endif /* __KERNEL__ */
86 #include <asm-generic/io.h>
88 #endif /* _XTENSA_IO_H */