summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacpaul Lin <macpaul@andestech.com>2011-09-23 18:00:13 +0800
committerMacpaul Lin <macpaul@andestech.com>2011-11-18 17:26:26 +0800
commitd21f6e583bfaae9ca8b19c5d4baccdc3be3b8b56 (patch)
tree2d2a2dad97ec643268b594797c88fe60d62101a8
parentb9016034f52e68d149cc523c91aef5a0801f9bbe (diff)
nds32: enhance io.h for compatibility with periphals
Enhance io.h for periphals origin design on x86 systems. For example, pci, ide, etc. Signed-off-by: Macpaul Lin <macpaul@andestech.com>
-rw-r--r--arch/nds32/include/asm/io.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h
index 2c105f7fabc..39c3dc8d92e 100644
--- a/arch/nds32/include/asm/io.h
+++ b/arch/nds32/include/asm/io.h
@@ -165,6 +165,24 @@ static inline unsigned int readl(unsigned int *addr)
#define __raw_base_readw(base, off) __arch_base_getw(base, off)
#define __raw_base_readl(base, off) __arch_base_getl(base, off)
+#define out_arch(type, endian, a, v) __raw_write##type(cpu_to_##endian(v), a)
+#define in_arch(type, endian, a) endian##_to_cpu(__raw_read##type(a))
+
+#define out_le32(a, v) out_arch(l, le32, a, v)
+#define out_le16(a, v) out_arch(w, le16, a, v)
+
+#define in_le32(a) in_arch(l, le32, a)
+#define in_le16(a) in_arch(w, le16, a)
+
+#define out_be32(a, v) out_arch(l, be32, a, v)
+#define out_be16(a, v) out_arch(w, be16, a, v)
+
+#define in_be32(a) in_arch(l, be32, a)
+#define in_be16(a) in_arch(w, be16, a)
+
+#define out_8(a, v) __raw_writeb(v, a)
+#define in_8(a) __raw_readb(a)
+
/*
* Now, pick up the machine-defined IO definitions
* #include <asm/arch/io.h>