* [U-Boot] [PATCH] linux/io.h: import generic ioread* / iowrite* accessors from Linux
@ 2017-08-25 16:02 Masahiro Yamada
2017-09-13 2:29 ` [U-Boot] " Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2017-08-25 16:02 UTC (permalink / raw)
To: u-boot
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>
---
include/linux/io.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/include/linux/io.h b/include/linux/io.h
index a104b7e69f7c..bf1ddbbaa671 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)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] linux/io.h: import generic ioread* / iowrite* accessors from Linux
2017-08-25 16:02 [U-Boot] [PATCH] linux/io.h: import generic ioread* / iowrite* accessors from Linux Masahiro Yamada
@ 2017-09-13 2:29 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2017-09-13 2:29 UTC (permalink / raw)
To: u-boot
On Sat, Aug 26, 2017 at 01:02:39AM +0900, Masahiro Yamada wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170912/6e4fe124/attachment.sig>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-13 2:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-25 16:02 [U-Boot] [PATCH] linux/io.h: import generic ioread* / iowrite* accessors from Linux Masahiro Yamada
2017-09-13 2:29 ` [U-Boot] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox