From 6e72ee196f8859a99f40de6993f577adacb1e9fb Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 5 Sep 2017 14:28:36 +0200 Subject: mtd: nand: nand_mxs: Don't call get/set features on chips which do not support it 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 --- drivers/mtd/nand/nand_mxs.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c index b5890858a6..337748af48 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); -- cgit v1.2.3