mtd: nand: sunxi: fix OOB handling in ->write_xxx() functions
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Mon, 14 Sep 2015 08:41:03 +0000 (10:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Oct 2015 21:43:22 +0000 (14:43 -0700)
commit1a693d9cb531a2d869d767796f1f3934bb951d78
tree555f9c68fadc34442a09a1bfa6b0897a00eeef1a
parent43c20144a4b4bd84d49bc1f5819481db9c000b34
mtd: nand: sunxi: fix OOB handling in ->write_xxx() functions

commit 03a0e8a7c5ea29b5c4e72dfd64900b47a8fb6f2d upstream.

The USER_DATA register cannot be accessed using byte accessors on A13
SoCs, thus triggering a bug when using memcpy_toio on this register.
Declare an helper macros to convert an OOB buffer into a suitable
USER_DATA value and vice-versa.

This patch also fixes an error in the oob_required logic (some OOB data
are not written even if the user required it) by removing the
oob_required condition, which is perfectly valid since the core already
fill ->oob_poi with FFs when oob_required is false.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: 1fef62c1423b ("mtd: nand: add sunxi NAND flash controller support")
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/sunxi_nand.c