aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/mach-common/mach
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2012-03-29 03:05:10 -0400
committerPaul Mundt <lethal@linux-sh.org>2012-03-29 03:05:10 -0400
commitb7e68d6876dfbab087bc3859211a9efc74cbe30c (patch)
tree25186c33a579a88116fbef38ba4849cc59c2d498 /arch/sh/include/mach-common/mach
parent5e047fa159cf40733c627002d0443fddff3183c7 (diff)
sh: Support I/O space swapping where needed.
This adopts a trimmed down version of the MIPS port mangling interface limited to the I/O swabbing for platforms that can't use little endian accessors. For platforms with mixed I/O spaces involving PCI it will still be necessary to enable byte swapping at the host controller level. Attention needs to be paid to all of host controller endianness, CPU endianness, and whether I/O accesses are explicitly swapped or not via SWAP_IO_SPACE. Fortunately the platforms that need this are in the minority. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/mach-common/mach')
-rw-r--r--arch/sh/include/mach-common/mach/mangle-port.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/sh/include/mach-common/mach/mangle-port.h b/arch/sh/include/mach-common/mach/mangle-port.h
new file mode 100644
index 000000000000..4ca1769a0f12
--- /dev/null
+++ b/arch/sh/include/mach-common/mach/mangle-port.h
@@ -0,0 +1,49 @@
1/*
2 * SH version cribbed from the MIPS copy:
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) 2003, 2004 Ralf Baechle
9 */
10#ifndef __MACH_COMMON_MANGLE_PORT_H
11#define __MACH_COMMON_MANGLE_PORT_H
12
13/*
14 * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
15 * less sane hardware forces software to fiddle with this...
16 *
17 * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
18 * you can't have the numerical value of data and byte addresses within
19 * multibyte quantities both preserved at the same time. Hence two
20 * variations of functions: non-prefixed ones that preserve the value
21 * and prefixed ones that preserve byte addresses. The latters are
22 * typically used for moving raw data between a peripheral and memory (cf.
23 * string I/O functions), hence the "__mem_" prefix.
24 */
25#if defined(CONFIG_SWAP_IO_SPACE)
26
27# define ioswabb(x) (x)
28# define __mem_ioswabb(x) (x)
29# define ioswabw(x) le16_to_cpu(x)
30# define __mem_ioswabw(x) (x)
31# define ioswabl(x) le32_to_cpu(x)
32# define __mem_ioswabl(x) (x)
33# define ioswabq(x) le64_to_cpu(x)
34# define __mem_ioswabq(x) (x)
35
36#else
37
38# define ioswabb(x) (x)
39# define __mem_ioswabb(x) (x)
40# define ioswabw(x) (x)
41# define __mem_ioswabw(x) cpu_to_le16(x)
42# define ioswabl(x) (x)
43# define __mem_ioswabl(x) cpu_to_le32(x)
44# define ioswabq(x) (x)
45# define __mem_ioswabq(x) cpu_to_le32(x)
46
47#endif
48
49#endif /* __MACH_COMMON_MANGLE_PORT_H */