mtd: spinand: Handle the case where PROGRAM LOAD does not reset the cache
authorBoris Brezillon <bbrezillon@kernel.org>
Thu, 24 Jan 2019 14:20:07 +0000 (15:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Feb 2019 07:10:10 +0000 (08:10 +0100)
commitb3ce77578374ae79e6cb5eea340c4d1607ecb84d
tree5d4eb7a35daac1aa940552f93e02e02228482d94
parent3ca59bf1fb7c4af12321ccbc80c735312be18506
mtd: spinand: Handle the case where PROGRAM LOAD does not reset the cache

commit 13c15e07eedf26092054c8c71f2f47edb8388310 upstream.

Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset
the cache content to 0xFF (depends on vendor implementation), so we
must fill the page cache entirely even if we only want to program the
data portion of the page, otherwise we might corrupt the BBM or user
data previously programmed in OOB area.

Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Reported-by: Stefan Roese <sr@denx.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <bbrezillon@kernel.org>
Tested-by: Stefan Roese <sr@denx.de>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/spi/core.c