The kernel also provides helper routines for the memset() and memcpy() operations when using MMIO. Note that you must use the following helpers:
#include linux/io.h
void memset_io(volatile void __iomem *addr, int value, size_t size);
This will set the I/O memory from the start address, addr (an MMIO location), to the value specified by the value parameter for size bytes.
For the purpose of copying memory, two helper routines are available, depending on the direction of the memory transfer:
void memcpy_fromio(void *buffer, const volatile void __iomem *addr, size_t size);
void memcpy_toio(volatile void __iomem *addr, const void *buffer, size_t size);
The first copies memory from the MMIO location addr to the (kernel-space) destination buffer (buffer) for size bytes; the second routine copies memory from the (kernel-space) source buffer (buffer) to the destination MMIO location addr for size bytes. Again...