aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-xtensa/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-xtensa/io.h')
-rw-r--r--include/asm-xtensa/io.h64
1 files changed, 32 insertions, 32 deletions
diff --git a/include/asm-xtensa/io.h b/include/asm-xtensa/io.h
index 556e5eed34f5..31ffc3f119c1 100644
--- a/include/asm-xtensa/io.h
+++ b/include/asm-xtensa/io.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/include/asm-xtensa/io.h 2 * include/asm-xtensa/io.h
3 * 3 *
4 * This file is subject to the terms and conditions of the GNU General Public 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 5 * License. See the file "COPYING" in the main directory of this archive
@@ -15,10 +15,11 @@
15#include <asm/byteorder.h> 15#include <asm/byteorder.h>
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/fixmap.h>
19
20#define _IO_BASE 0
21 18
19#define XCHAL_KIO_CACHED_VADDR 0xf0000000
20#define XCHAL_KIO_BYPASS_VADDR 0xf8000000
21#define XCHAL_KIO_PADDR 0xf0000000
22#define XCHAL_KIO_SIZE 0x08000000
22 23
23/* 24/*
24 * swap functions to change byte order from little-endian to big-endian and 25 * swap functions to change byte order from little-endian to big-endian and
@@ -42,40 +43,43 @@ static inline unsigned int _swapl (unsigned int v)
42 43
43static inline unsigned long virt_to_phys(volatile void * address) 44static inline unsigned long virt_to_phys(volatile void * address)
44{ 45{
45 return PHYSADDR((unsigned long)address); 46 return __pa(address);
46} 47}
47 48
48static inline void * phys_to_virt(unsigned long address) 49static inline void * phys_to_virt(unsigned long address)
49{ 50{
50 return (void*) CACHED_ADDR(address); 51 return __va(address);
51} 52}
52 53
53/* 54/*
54 * IO bus memory addresses are also 1:1 with the physical address 55 * virt_to_bus and bus_to_virt are deprecated.
55 */ 56 */
56 57
57static inline unsigned long virt_to_bus(volatile void * address) 58#define virt_to_bus(x) virt_to_phys(x)
58{ 59#define bus_to_virt(x) phys_to_virt(x)
59 return PHYSADDR((unsigned long)address);
60}
61
62static inline void * bus_to_virt (unsigned long address)
63{
64 return (void *) CACHED_ADDR(address);
65}
66 60
67/* 61/*
68 * Change "struct page" to physical address. 62 * Return the virtual (cached) address for the specified bus memory.
63 * Note that we currently don't support any address outside the KIO segment.
69 */ 64 */
70 65
71static inline void *ioremap(unsigned long offset, unsigned long size) 66static inline void *ioremap(unsigned long offset, unsigned long size)
72{ 67{
73 return (void *) CACHED_ADDR_IO(offset); 68 if (offset >= XCHAL_KIO_PADDR
69 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)
70 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
71
72 else
73 BUG();
74} 74}
75 75
76static inline void *ioremap_nocache(unsigned long offset, unsigned long size) 76static inline void *ioremap_nocache(unsigned long offset, unsigned long size)
77{ 77{
78 return (void *) BYPASS_ADDR_IO(offset); 78 if (offset >= XCHAL_KIO_PADDR
79 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE)
80 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
81 else
82 BUG();
79} 83}
80 84
81static inline void iounmap(void *addr) 85static inline void iounmap(void *addr)
@@ -121,9 +125,6 @@ static inline void __raw_writel(__u32 b, volatile void __iomem *addr)
121 *(__force volatile __u32 *)(addr) = b; 125 *(__force volatile __u32 *)(addr) = b;
122} 126}
123 127
124
125
126
127/* These are the definitions for the x86 IO instructions 128/* These are the definitions for the x86 IO instructions
128 * inb/inw/inl/outb/outw/outl, the "string" versions 129 * inb/inw/inl/outb/outw/outl, the "string" versions
129 * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions 130 * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions
@@ -131,11 +132,11 @@ static inline void __raw_writel(__u32 b, volatile void __iomem *addr)
131 * The macros don't do byte-swapping. 132 * The macros don't do byte-swapping.
132 */ 133 */
133 134
134#define inb(port) readb((u8 *)((port)+_IO_BASE)) 135#define inb(port) readb((u8 *)((port)))
135#define outb(val, port) writeb((val),(u8 *)((unsigned long)(port)+_IO_BASE)) 136#define outb(val, port) writeb((val),(u8 *)((unsigned long)(port)))
136#define inw(port) readw((u16 *)((port)+_IO_BASE)) 137#define inw(port) readw((u16 *)((port)))
137#define outw(val, port) writew((val),(u16 *)((unsigned long)(port)+_IO_BASE)) 138#define outw(val, port) writew((val),(u16 *)((unsigned long)(port)))
138#define inl(port) readl((u32 *)((port)+_IO_BASE)) 139#define inl(port) readl((u32 *)((port)))
139#define outl(val, port) writel((val),(u32 *)((unsigned long)(port))) 140#define outl(val, port) writel((val),(u32 *)((unsigned long)(port)))
140 141
141#define inb_p(port) inb((port)) 142#define inb_p(port) inb((port))
@@ -180,14 +181,13 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
180 181
181 182
182/* 183/*
183 * * Convert a physical pointer to a virtual kernel pointer for /dev/mem 184 * Convert a physical pointer to a virtual kernel pointer for /dev/mem access
184 * * access 185 */
185 * */
186#define xlate_dev_mem_ptr(p) __va(p) 186#define xlate_dev_mem_ptr(p) __va(p)
187 187
188/* 188/*
189 * * Convert a virtual cached pointer to an uncached pointer 189 * Convert a virtual cached pointer to an uncached pointer
190 * */ 190 */
191#define xlate_dev_kmem_ptr(p) p 191#define xlate_dev_kmem_ptr(p) p
192 192
193 193