aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/io.h')
-rw-r--r--include/asm-mips/io.h36
1 files changed, 33 insertions, 3 deletions
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 5a4c8a54b8f4..ba1d7bbc15d2 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -4,7 +4,7 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1994, 1995 Waldorf GmbH 6 * Copyright (C) 1994, 1995 Waldorf GmbH
7 * Copyright (C) 1994 - 2000 Ralf Baechle 7 * Copyright (C) 1994 - 2000, 06 Ralf Baechle
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved. 9 * Copyright (C) 2004, 2005 MIPS Technologies, Inc. All rights reserved.
10 * Author: Maciej W. Rozycki <macro@mips.com> 10 * Author: Maciej W. Rozycki <macro@mips.com>
@@ -103,8 +103,20 @@
103 */ 103 */
104extern const unsigned long mips_io_port_base; 104extern const unsigned long mips_io_port_base;
105 105
106#define set_io_port_base(base) \ 106/*
107 do { * (unsigned long *) &mips_io_port_base = (base); } while (0) 107 * Gcc will generate code to load the value of mips_io_port_base after each
108 * function call which may be fairly wasteful in some cases. So we don't
109 * play quite by the book. We tell gcc mips_io_port_base is a long variable
110 * which solves the code generation issue. Now we need to violate the
111 * aliasing rules a little to make initialization possible and finally we
112 * will need the barrier() to fight side effects of the aliasing chat.
113 * This trickery will eventually collapse under gcc's optimizer. Oh well.
114 */
115static inline void set_io_port_base(unsigned long base)
116{
117 * (unsigned long *) &mips_io_port_base = base;
118 barrier();
119}
108 120
109/* 121/*
110 * Thanks to James van Artsdalen for a better timing-fix than 122 * Thanks to James van Artsdalen for a better timing-fix than
@@ -283,6 +295,24 @@ static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
283 __ioremap_mode((offset), (size), _CACHE_UNCACHED) 295 __ioremap_mode((offset), (size), _CACHE_UNCACHED)
284 296
285/* 297/*
298 * ioremap_cachable - map bus memory into CPU space
299 * @offset: bus address of the memory
300 * @size: size of the resource to map
301 *
302 * ioremap_nocache performs a platform specific sequence of operations to
303 * make bus memory CPU accessible via the readb/readw/readl/writeb/
304 * writew/writel functions and the other mmio helpers. The returned
305 * address is not guaranteed to be usable directly as a virtual
306 * address.
307 *
308 * This version of ioremap ensures that the memory is marked cachable by
309 * the CPU. Also enables full write-combining. Useful for some
310 * memory-like regions on I/O busses.
311 */
312#define ioremap_cachable(offset, size) \
313 __ioremap_mode((offset), (size), PAGE_CACHABLE_DEFAULT)
314
315/*
286 * These two are MIPS specific ioremap variant. ioremap_cacheable_cow 316 * These two are MIPS specific ioremap variant. ioremap_cacheable_cow
287 * requests a cachable mapping, ioremap_uncached_accelerated requests a 317 * requests a cachable mapping, ioremap_uncached_accelerated requests a
288 * mapping using the uncached accelerated mode which isn't supported on 318 * mapping using the uncached accelerated mode which isn't supported on