mtd: rawnand: micron: handle on-die "ECC-off" devices correctly
authorMarco Felsch <m.felsch@pengutronix.de>
Tue, 30 Jul 2019 13:44:07 +0000 (15:44 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Aug 2019 17:08:16 +0000 (19:08 +0200)
commitb88a3fe40b1f10ec3d3b3d2b8d6f8ecda35eb927
tree5cd6fa5a7a05651e704bf9785c97d3f2c1fc06ea
parentfcb4d250ab4938e714c26ad6c4838a7bc667d071
mtd: rawnand: micron: handle on-die "ECC-off" devices correctly

commit 8493b2a06fc5b77ef5c579dc32b12761f7b7a84c upstream.

Some devices are not supposed to support on-die ECC but experience
shows that internal ECC machinery can actually be enabled through the
"SET FEATURE (EFh)" command, even if a read of the "READ ID Parameter
Tables" returns that it is not.

Currently, the driver checks the "READ ID Parameter" field directly
after having enabled the feature. If the check fails it returns
immediately but leaves the ECC on. When using buggy chips like
MT29F2G08ABAGA and MT29F2G08ABBGA, all future read/program cycles will
go through the on-die ECC, confusing the host controller which is
supposed to be the one handling correction.

To address this in a common way we need to turn off the on-die ECC
directly after reading the "READ ID Parameter" and before checking the
"ECC status".

Cc: stable@vger.kernel.org
Fixes: dbc44edbf833 ("mtd: rawnand: micron: Fix on-die ECC detection logic")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mtd/nand/raw/nand_micron.c