[PATCH 2/2] mtd: atmel-quadspi: add driver for Atmel QSPI controller
arnd at arndb.de
Tue Jul 19 03:42:42 PDT 2016
On Tuesday, July 19, 2016 12:03:11 PM CEST Cyrille Pitchen wrote:
> Indeed I added the ARM dependency for the COMPILE_TEST case only for
> _memcpy_toio() and _memcpy_fromio(). I thought it would be enough.
> Also, I use _memcpy_toio() and _memcpy_fromio() on purpose as opposed to
> memcpy_toio() and mempcy_fromio(). I've tested the two latest functions quite
> a long time ago and it didn't work. If I remember, on our architecture,
> memcpy_toio() and memcpy_fromio() are simply implemented with the regular
They are implemented using "mmiocpy" when CONFIG_BIG_ENDIAN is not set.
mmiocpy is an alias for the out-of-line memcpy() implementation, but it's
different from calling memcpy() as the compiler can decide to replace
small memcpy with a pointer dereference, and that can be unaligned on
ARMv7 for non-MMIO pointers.
> The additional memory barriers inserted by readb() and writeb() seems to be
> needed to guarantee the IO accesses are not reordered on the system bus.
Those barriers should not be needed at all, I've never seen an I/O bus
that reorders consecutive reads to the same address range.
> In the atmel-quadspi.c driver, there is a comment on the use of memcpy():
> /* Then fallback to a PIO transfer (memcpy() DOES NOT work!) */
Please try again, I think this was fixed with
Author: Russell King <rmk+kernel at arm.linux.org.uk>
Date: Fri Jul 3 15:22:54 2015 +0100
ARM: avoid unwanted GCC memset()/memcpy() optimisations for IO variants
We don't want GCC optimising our memset_io(), memcpy_fromio() or
memcpy_toio() variants, so we must not call one of the standard
functions. Provide a separate name for our assembly memcpy() and
memset() functions, and use that instead, thereby bypassing GCC's
ability to optimise these operations.
GCCs optimisation may introduce unaligned accesses which are invalid
for device mappings.
Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
More information about the linux-mtd