mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program
authorKamal Dasu <kdasu.kdev@gmail.com>
Fri, 3 Mar 2017 21:16:53 +0000 (16:16 -0500)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 25 Apr 2017 12:18:42 +0000 (14:18 +0200)
commit9dea837728ff5972efdb752ee6326999c7cc4f64
tree08104bffea7783a3211f338b5c7cacdc2aa1cd08
parent803390bf32c3e968d740399d91f373f222eb0621
mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program

On brcmnand controller v6.x and v7.x, the #WP pin is controlled through
the NAND_WP bit in CS_SELECT register.

The driver currently assumes that toggling the #WP pin is
instantaneously enabling/disabling write-protection, but it actually
takes some time to propagate the new state to the internal NAND chip
logic. This behavior is sometime causing data corruptions when an
erase/program operation is executed before write-protection has really
been disabled.

Fixes: 62e6a48907d5 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/brcmnand/brcmnand.c