summaryrefslogtreecommitdiff
path: root/arch/nds32/include/asm/io.h
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-07-25 08:22:08 -0400
committerTom Rini <trini@ti.com>2013-07-25 08:51:51 -0400
commitaaf5e825606a70ddc8fca8e366d8c16a6fd3cc7c (patch)
tree64eaea4d396dce4e0a30bb955b8240d4b199cdca /arch/nds32/include/asm/io.h
parent0b17998e509e5614633aee0a3c5d6248f8bc580b (diff)
parentc54fd3efa497876a33cc3c6e7df514ae53abc729 (diff)
downloadu-boot-imx-aaf5e825606a70ddc8fca8e366d8c16a6fd3cc7c.zip
u-boot-imx-aaf5e825606a70ddc8fca8e366d8c16a6fd3cc7c.tar.gz
u-boot-imx-aaf5e825606a70ddc8fca8e366d8c16a6fd3cc7c.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-nds32
Diffstat (limited to 'arch/nds32/include/asm/io.h')
-rw-r--r--arch/nds32/include/asm/io.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h
index 39c3dc8..04708e9 100644
--- a/arch/nds32/include/asm/io.h
+++ b/arch/nds32/include/asm/io.h
@@ -7,9 +7,7 @@
* Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
* Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * SPDX-License-Identifier: GPL-2.0
*
* Modifications:
* 16-Sep-1996 RMK Inlined the inx/outx functions & optimised for both
@@ -184,6 +182,43 @@ static inline unsigned int readl(unsigned int *addr)
#define in_8(a) __raw_readb(a)
/*
+ * Clear and set bits in one shot. These macros can be used to clear and
+ * set multiple bits in a register using a single call. These macros can
+ * also be used to set a multiple-bit bit pattern using a mask, by
+ * specifying the mask in the 'clear' parameter and the new bit pattern
+ * in the 'set' parameter.
+ */
+
+#define clrbits(type, addr, clear) \
+ out_##type((addr), in_##type(addr) & ~(clear))
+
+#define setbits(type, addr, set) \
+ out_##type((addr), in_##type(addr) | (set))
+
+#define clrsetbits(type, addr, clear, set) \
+ out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
+
+#define clrbits_be32(addr, clear) clrbits(be32, addr, clear)
+#define setbits_be32(addr, set) setbits(be32, addr, set)
+#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set)
+
+#define clrbits_le32(addr, clear) clrbits(le32, addr, clear)
+#define setbits_le32(addr, set) setbits(le32, addr, set)
+#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
+
+#define clrbits_be16(addr, clear) clrbits(be16, addr, clear)
+#define setbits_be16(addr, set) setbits(be16, addr, set)
+#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set)
+
+#define clrbits_le16(addr, clear) clrbits(le16, addr, clear)
+#define setbits_le16(addr, set) setbits(le16, addr, set)
+#define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, set)
+
+#define clrbits_8(addr, clear) clrbits(8, addr, clear)
+#define setbits_8(addr, set) setbits(8, addr, set)
+#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
+
+/*
* Now, pick up the machine-defined IO definitions
* #include <asm/arch/io.h>
*/