Commit | Line | Data |
---|---|---|
6b8baec4 LFT |
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 | ||
61810325 | 14 | #include <linux/types.h> |
6b8baec4 | 15 | #include <asm/pgtable-bits.h> |
6b8baec4 LFT |
16 | |
17 | /* PCI is not supported in nios2, set this to 0. */ | |
18 | #define IO_SPACE_LIMIT 0 | |
19 | ||
20 | #define readb_relaxed(addr) readb(addr) | |
21 | #define readw_relaxed(addr) readw(addr) | |
22 | #define readl_relaxed(addr) readl(addr) | |
23 | ||
24 | #define writeb_relaxed(x, addr) writeb(x, addr) | |
25 | #define writew_relaxed(x, addr) writew(x, addr) | |
26 | #define writel_relaxed(x, addr) writel(x, addr) | |
27 | ||
5ace77e0 | 28 | void __iomem *ioremap(unsigned long physaddr, unsigned long size); |
6b8baec4 LFT |
29 | extern void __iounmap(void __iomem *addr); |
30 | ||
6b8baec4 LFT |
31 | static inline void iounmap(void __iomem *addr) |
32 | { | |
33 | __iounmap(addr); | |
34 | } | |
35 | ||
5ace77e0 CH |
36 | #define ioremap_nocache ioremap |
37 | #define ioremap_wc ioremap | |
38 | #define ioremap_wt ioremap | |
76367a52 | 39 | |
6b8baec4 | 40 | /* Pages to physical address... */ |
568f6ba0 | 41 | #define page_to_phys(page) virt_to_phys(page_to_virt(page)) |
6b8baec4 LFT |
42 | |
43 | /* Macros used for converting between virtual and physical mappings. */ | |
568f6ba0 | 44 | #define phys_to_virt(vaddr) \ |
6b8baec4 LFT |
45 | ((void *)((unsigned long)(vaddr) | CONFIG_NIOS2_KERNEL_REGION_BASE)) |
46 | /* Clear top 3 bits */ | |
568f6ba0 | 47 | #define virt_to_phys(vaddr) \ |
6b8baec4 LFT |
48 | ((unsigned long)((unsigned long)(vaddr) & ~0xE0000000)) |
49 | ||
065a1134 LFT |
50 | #include <asm-generic/io.h> |
51 | ||
6b8baec4 | 52 | #endif /* _ASM_NIOS2_IO_H */ |