Re: [PATCH v2 11/35] nds32: Device specific operations
From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-11-27 14:51:36
Also in:
linux-arch, linux-devicetree, linux-serial, lkml
From: Arnd Bergmann <arnd@arndb.de>
Date: 2017-11-27 14:51:36
Also in:
linux-arch, linux-devicetree, linux-serial, lkml
On Mon, Nov 27, 2017 at 1:27 PM, Greentime Hu [off-list ref] wrote:
From: Greentime Hu <redacted> This patch introduces ioremap implementations. Signed-off-by: Vincent Chen <redacted> Signed-off-by: Greentime Hu <redacted> --- arch/nds32/include/asm/io.h | 25 +++++++++++++++ arch/nds32/mm/ioremap.c | 75 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 arch/nds32/include/asm/io.h create mode 100644 arch/nds32/mm/ioremap.cdiff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h new file mode 100644 index 0000000..b83dea1 --- /dev/null +++ b/arch/nds32/include/asm/io.h@@ -0,0 +1,25 @@
+#ifndef __ASM_NDS32_IO_H +#define __ASM_NDS32_IO_H + +#ifdef __KERNEL__ +void iounmap(void __iomem * addr); +#include <asm-generic/io.h> + +#endif /* __KERNEL__ */ +#endif /* __ASM_NDS32_IO_H */
Here, you should define a lot of the I/O accessor functions,
dereferencing a pointer
is generally not enough to guarantee an atomic MMIO operation. You need to
force the access to use the correct size to prevent the compiler from issuing
byte-sized operations when it thinks the pointer might be unaligned, and
there should be barriers that ensure a memory access is synchronized with
a DMA that might be triggered by a writel, or claimed to be completed after
a readl. Please see the risc-v header for this, it has many good explanations.
Arnd