diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2014-05-22 08:56:52 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-05-28 16:27:37 -0400 |
commit | b7e460624f0f3c31150f3b09e75b0d009e22ba5f (patch) | |
tree | 947dc4817749334cd72ef634f77a1a705eb7b42d /drivers/mtd | |
parent | 2913aae5f9eae2f857cdeff5388bb22d0751aa08 (diff) |
mtd: pxa3xx_nand: make the driver work on big-endian systems
The pxa3xx_nand driver currently uses __raw_writel() and __raw_readl()
to access I/O registers. However, those functions do not do any
endianness swapping, which means that they won't work when the CPU
runs in big-endian but the I/O registers are little endian, which is
the common situation for ARM systems running big endian.
Since __raw_writel() and __raw_readl() do not include any memory
barriers and the pxa3xx_nand driver can only be compiled for ARM
platforms, the closest I/o accessors functions that do endianess
swapping are writel_relaxed() and readl_relaxed().
This patch has been verified to work on Armada XP GP: without the
patch, the NAND is not detected when the kernel runs big endian while
it is properly detected when the kernel runs little endian. With the
patch applied, the NAND is properly detected in both situations
(little and big endian).
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: <stable@vger.kernel.org> # v3.13+
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/pxa3xx_nand.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 2a9add06c2d5..96b0b1d27df1 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -127,10 +127,10 @@ | |||
127 | 127 | ||
128 | /* macros for registers read/write */ | 128 | /* macros for registers read/write */ |
129 | #define nand_writel(info, off, val) \ | 129 | #define nand_writel(info, off, val) \ |
130 | __raw_writel((val), (info)->mmio_base + (off)) | 130 | writel_relaxed((val), (info)->mmio_base + (off)) |
131 | 131 | ||
132 | #define nand_readl(info, off) \ | 132 | #define nand_readl(info, off) \ |
133 | __raw_readl((info)->mmio_base + (off)) | 133 | readl_relaxed((info)->mmio_base + (off)) |
134 | 134 | ||
135 | /* error code and state */ | 135 | /* error code and state */ |
136 | enum { | 136 | enum { |