mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Sun Aug 6 18:59:03 PDT 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=a11bf5ed951f8900d244d09eb03a888b59c7fc82
Commit:     a11bf5ed951f8900d244d09eb03a888b59c7fc82
Parent:     cb25fae18207330caac848d850e11f9cdb500dbf
Author:     Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Mon Jul 31 10:29:56 2017 +0200
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Wed Aug 2 10:26:41 2017 +0200

    mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES
    
    Some ONFI NANDs do not support the SET/GET FEATURES commands, which,
    according to the spec, is perfectly valid.
    
    On these NANDs we can't set a specific timing mode using the "timing
    mode" feature, and we should assume the NAND does not require any setup
    to enter a specific timing mode.
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Fixes: d8e725dd8311 ("mtd: nand: automate NAND timings selection")
    Reported-by: Alexander Dahl <ada at thorsis.com>
    Cc: <stable at vger.kernel.org>
    Tested-by: Alexander Dahl <ada at thorsis.com>
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/nand/nand_base.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5b7c8d0..c6c18b8 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1131,7 +1131,9 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
 	 * Ensure the timing mode has been changed on the chip side
 	 * before changing timings on the controller side.
 	 */
-	if (chip->onfi_version) {
+	if (chip->onfi_version &&
+	    (le16_to_cpu(chip->onfi_params.opt_cmd) &
+	     ONFI_OPT_CMD_SET_GET_FEATURES)) {
 		u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
 			chip->onfi_timing_mode_default,
 		};



More information about the linux-mtd-cvs mailing list