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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Jul 2017 12:40:31 +0000 (14:40 +0200)
commita4bfcab30928b1ef1a19b379f8d08efe10853a42
tree01052f6d41690b30629aea0d51df18c516f7cf7a
parentde5862335ed7c465b0900774fbd869bf91a23c58
mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program

commit 9d2ee0a60b8bd9bef2a0082c533736d6a7b39873 upstream.

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: 27c5b17cd1b1 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/brcmnand/brcmnand.c