Commit | Line | Data |
---|---|---|
9a8fd558 | 1 | /* |
173d6681 | 2 | * include/asm-xtensa/io.h |
9a8fd558 CZ |
3 | * |
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. | |
7 | * | |
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | |
9 | */ | |
10 | ||
11 | #ifndef _XTENSA_IO_H | |
12 | #define _XTENSA_IO_H | |
13 | ||
14 | #ifdef __KERNEL__ | |
9a8fd558 | 15 | #include <asm/byteorder.h> |
c51aea80 | 16 | #include <asm/page.h> |
bfae8ee8 | 17 | #include <linux/bug.h> |
6656920b | 18 | #include <linux/kernel.h> |
9a8fd558 CZ |
19 | |
20 | #include <linux/types.h> | |
9a8fd558 | 21 | |
00c81d23 CZ |
22 | #define XCHAL_KIO_CACHED_VADDR 0xe0000000 |
23 | #define XCHAL_KIO_BYPASS_VADDR 0xf0000000 | |
173d6681 | 24 | #define XCHAL_KIO_PADDR 0xf0000000 |
00c81d23 CZ |
25 | #define XCHAL_KIO_SIZE 0x10000000 |
26 | ||
27 | #define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x)) | |
d38efc1f | 28 | #define IO_SPACE_LIMIT ~0 |
9a8fd558 | 29 | |
d38efc1f | 30 | #ifdef CONFIG_MMU |
9a8fd558 | 31 | /* |
d38efc1f | 32 | * Return the virtual address for the specified bus memory. |
173d6681 | 33 | * Note that we currently don't support any address outside the KIO segment. |
9a8fd558 | 34 | */ |
02f37748 MF |
35 | static inline void __iomem *ioremap_nocache(unsigned long offset, |
36 | unsigned long size) | |
9a8fd558 | 37 | { |
173d6681 | 38 | if (offset >= XCHAL_KIO_PADDR |
02f37748 | 39 | && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE) |
173d6681 | 40 | return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR); |
173d6681 CZ |
41 | else |
42 | BUG(); | |
9a8fd558 CZ |
43 | } |
44 | ||
02f37748 MF |
45 | static inline void __iomem *ioremap_cache(unsigned long offset, |
46 | unsigned long size) | |
9a8fd558 | 47 | { |
173d6681 | 48 | if (offset >= XCHAL_KIO_PADDR |
02f37748 | 49 | && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE) |
173d6681 CZ |
50 | return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR); |
51 | else | |
52 | BUG(); | |
9a8fd558 CZ |
53 | } |
54 | ||
02f37748 MF |
55 | #define ioremap_wc ioremap_nocache |
56 | ||
57 | static inline void __iomem *ioremap(unsigned long offset, unsigned long size) | |
58 | { | |
59 | return ioremap_nocache(offset, size); | |
60 | } | |
61 | ||
62 | static inline void iounmap(volatile void __iomem *addr) | |
9a8fd558 CZ |
63 | { |
64 | } | |
d38efc1f | 65 | #endif /* CONFIG_MMU */ |
9a8fd558 CZ |
66 | |
67 | /* | |
68 | * Generic I/O | |
69 | */ | |
d38efc1f MF |
70 | #define readb_relaxed readb |
71 | #define readw_relaxed readw | |
72 | #define readl_relaxed readl | |
9a8fd558 CZ |
73 | |
74 | #endif /* __KERNEL__ */ | |
75 | ||
d38efc1f MF |
76 | #include <asm-generic/io.h> |
77 | ||
9a8fd558 | 78 | #endif /* _XTENSA_IO_H */ |