summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorMiquel Raynal <miquel.raynal@bootlin.com>2018-03-19 14:47:21 +0100
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-03-20 09:47:46 +0100
commit993447b746820259e21b6c7962523631128d5ca6 (patch)
treedc1553cec3bc2b9c92762a9c3c0488cfb3f2db73 /drivers/mtd/nand
parent97baea1e6b74c73973fa0922252f880ab15450ea (diff)
downloadop-kernel-dev-993447b746820259e21b6c7962523631128d5ca6.zip
op-kernel-dev-993447b746820259e21b6c7962523631128d5ca6.tar.gz
mtd: rawnand: handle differently chip/controller errors about timings
Usually, the source of the error when setting/getting features does not matter (if the controller does not support sending the command or if the chip does not support the operation). When it comes to timings, if the controller fails it is an error while if the chip does not support the operation, it can be silently supposed that it already works with the maximum supported timings. Introduce some logic in nand_setup_data_interface() to handle that difference. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/raw/nand_base.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index d344dcb..2109fc2 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -1272,11 +1272,13 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
if (!chip->setup_data_interface)
return 0;
- /* Change the mode on the chip side */
- ret = nand_set_features(chip, ONFI_FEATURE_ADDR_TIMING_MODE,
- tmode_param);
- if (ret)
- return ret;
+ /* Change the mode on the chip side (if supported by the NAND chip) */
+ if (nand_supports_set_get_features(chip)) {
+ ret = nand_set_features(chip, ONFI_FEATURE_ADDR_TIMING_MODE,
+ tmode_param);
+ if (ret)
+ return ret;
+ }
/* Change the mode on the controller side */
return chip->setup_data_interface(mtd, chipnr, &chip->data_interface);
OpenPOWER on IntegriCloud