Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@free-electrons.com>
Fixes: d8e725dd8311 ("mtd: nand: automate NAND timings selection")
Reported-by: Alexander Dahl <ada@thorsis.com>
Cc: <stable@vger.kernel.org>
Tested-by: Alexander Dahl <ada@thorsis.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>

+3 -1
+3 -1
drivers/mtd/nand/nand_base.c
··· 1131 1131 * Ensure the timing mode has been changed on the chip side 1132 1132 * before changing timings on the controller side. 1133 1133 */ 1134 - if (chip->onfi_version) { 1134 + if (chip->onfi_version && 1135 + (le16_to_cpu(chip->onfi_params.opt_cmd) & 1136 + ONFI_OPT_CMD_SET_GET_FEATURES)) { 1135 1137 u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = { 1136 1138 chip->onfi_timing_mode_default, 1137 1139 };