[PATCH 2/2] mtd: nand: nand_mxs: Don't call get/set features on chips which do not support it
Sascha Hauer
s.hauer at pengutronix.de
Tue Sep 5 05:28:36 PDT 2017
Older versions of the ONFI spec do not support get/set features, so
do not call these commands when they are not available.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/mtd/nand/nand_mxs.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index cba0beedbb..110334d256 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -2030,19 +2030,23 @@ static int mxs_nand_enable_edo_mode(struct mxs_nand_info *info)
nand->select_chip(mtd, 0);
- /* [1] send SET FEATURE commond to NAND */
- feature[0] = mode;
+ if (le16_to_cpu(nand->onfi_params.opt_cmd)
+ & ONFI_OPT_CMD_SET_GET_FEATURES) {
- ret = nand->onfi_set_features(mtd, nand,
+ /* [1] send SET FEATURE commond to NAND */
+ feature[0] = mode;
+
+ ret = nand->onfi_set_features(mtd, nand,
ONFI_FEATURE_ADDR_TIMING_MODE, feature);
- if (ret)
- goto err_out;
+ if (ret)
+ goto err_out;
- /* [2] send GET FEATURE command to double-check the timing mode */
- ret = nand->onfi_get_features(mtd, nand,
+ /* [2] send GET FEATURE command to double-check the timing mode */
+ ret = nand->onfi_get_features(mtd, nand,
ONFI_FEATURE_ADDR_TIMING_MODE, feature);
- if (ret || feature[0] != mode)
- goto err_out;
+ if (ret || feature[0] != mode)
+ goto err_out;
+ }
nand->select_chip(mtd, -1);
--
2.11.0
More information about the barebox
mailing list