c5cf8ea12ef8c0610a5e9c807780bf14d50b8133
[deliverable/linux.git] / arch / nios2 / include / asm / io.h
1 /*
2 * Copyright (C) 2014 Altera Corporation
3 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
4 * Copyright (C) 2004 Microtronix Datacom Ltd.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11 #ifndef _ASM_NIOS2_IO_H
12 #define _ASM_NIOS2_IO_H
13
14 #include <asm/pgtable-bits.h>
15
16 /* PCI is not supported in nios2, set this to 0. */
17 #define IO_SPACE_LIMIT 0
18
19 #define readb_relaxed(addr) readb(addr)
20 #define readw_relaxed(addr) readw(addr)
21 #define readl_relaxed(addr) readl(addr)
22
23 #define writeb_relaxed(x, addr) writeb(x, addr)
24 #define writew_relaxed(x, addr) writew(x, addr)
25 #define writel_relaxed(x, addr) writel(x, addr)
26
27 extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
28 unsigned long cacheflag);
29 extern void __iounmap(void __iomem *addr);
30
31 static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
32 {
33 return __ioremap(physaddr, size, 0);
34 }
35
36 static inline void __iomem *ioremap_nocache(unsigned long physaddr,
37 unsigned long size)
38 {
39 return __ioremap(physaddr, size, 0);
40 }
41
42 static inline void iounmap(void __iomem *addr)
43 {
44 __iounmap(addr);
45 }
46
47 /* Pages to physical address... */
48 #define page_to_phys(page) virt_to_phys(page_to_virt(page))
49 #define page_to_bus(page) page_to_virt(page)
50
51 /* Macros used for converting between virtual and physical mappings. */
52 #define phys_to_virt(vaddr) \
53 ((void *)((unsigned long)(vaddr) | CONFIG_NIOS2_KERNEL_REGION_BASE))
54 /* Clear top 3 bits */
55 #define virt_to_phys(vaddr) \
56 ((unsigned long)((unsigned long)(vaddr) & ~0xE0000000))
57
58 #include <asm-generic/io.h>
59
60 #endif /* _ASM_NIOS2_IO_H */
This page took 0.034739 seconds and 4 git commands to generate.