aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-08-26 01:02:39 +0900
committerTom Rini <trini@konsulko.com>2017-09-12 18:02:23 -0400
commit6c06f8dc4ab02890ef93b50dac129c2b43cc9ea3 (patch)
treededeecaa9e167dc6523c0c8d7fe9f454f2f49829 /include/linux
parentb27af39935855c88ef2203dcfc1ff54e013237c4 (diff)
downloadu-boot-6c06f8dc4ab02890ef93b50dac129c2b43cc9ea3.zip
u-boot-6c06f8dc4ab02890ef93b50dac129c2b43cc9ea3.tar.gz
u-boot-6c06f8dc4ab02890ef93b50dac129c2b43cc9ea3.tar.bz2
linux/io.h: import generic ioread* / iowrite* accessors from Linux
Some drivers in Linux (ex. drivers/mtd/nand/denali.c) use ioread*/iowrite* accessors. Import them to make drivers more synced. I copied code from include/asm-generic/io.h of Linux. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/io.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/linux/io.h b/include/linux/io.h
index a104b7e..bf1ddbb 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -9,6 +9,50 @@
#include <linux/types.h>
#include <asm/io.h>
+static inline u8 ioread8(const volatile void __iomem *addr)
+{
+ return readb(addr);
+}
+
+static inline u16 ioread16(const volatile void __iomem *addr)
+{
+ return readw(addr);
+}
+
+static inline u32 ioread32(const volatile void __iomem *addr)
+{
+ return readl(addr);
+}
+
+#ifdef CONFIG_64BIT
+static inline u64 ioread64(const volatile void __iomem *addr)
+{
+ return readq(addr);
+}
+#endif /* CONFIG_64BIT */
+
+static inline void iowrite8(u8 value, volatile void __iomem *addr)
+{
+ writeb(value, addr);
+}
+
+static inline void iowrite16(u16 value, volatile void __iomem *addr)
+{
+ writew(value, addr);
+}
+
+static inline void iowrite32(u32 value, volatile void __iomem *addr)
+{
+ writel(value, addr);
+}
+
+#ifdef CONFIG_64BIT
+static inline void iowrite64(u64 value, volatile void __iomem *addr)
+{
+ writeq(value, addr);
+}
+#endif /* CONFIG_64BIT */
+
#ifndef CONFIG_HAVE_ARCH_IOREMAP
static inline void __iomem *ioremap(resource_size_t offset,
resource_size_t size)