diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-09-08 08:41:18 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-09-08 08:41:18 +0200 |
commit | e251caecd708edc6fe9fd6b8daf1914b00d15fe0 (patch) | |
tree | f5561bfe232445df3ca5096f490dba55e2c24bb2 | |
parent | 36db84bb10758e2f160c197d267aad3f03e57045 (diff) | |
parent | 6e72ee196f8859a99f40de6993f577adacb1e9fb (diff) | |
download | barebox-e251caecd708edc6fe9fd6b8daf1914b00d15fe0.tar.gz barebox-e251caecd708edc6fe9fd6b8daf1914b00d15fe0.tar.xz |
Merge branch 'for-next/mtd'
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 8 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_mxs.c | 26 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 3 |
3 files changed, 24 insertions, 13 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index d9f79474cd..b321c59180 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -2839,7 +2839,9 @@ static int nand_onfi_set_features(struct mtd_info *mtd, struct nand_chip *chip, { int status; - if (!chip->onfi_version) + if (!chip->onfi_version || + !(le16_to_cpu(chip->onfi_params.opt_cmd) + & ONFI_OPT_CMD_SET_GET_FEATURES)) return -EINVAL; chip->cmdfunc(mtd, NAND_CMD_SET_FEATURES, addr, -1); @@ -2860,7 +2862,9 @@ static int nand_onfi_set_features(struct mtd_info *mtd, struct nand_chip *chip, static int nand_onfi_get_features(struct mtd_info *mtd, struct nand_chip *chip, int addr, uint8_t *subfeature_param) { - if (!chip->onfi_version) + if (!chip->onfi_version || + !(le16_to_cpu(chip->onfi_params.opt_cmd) + & ONFI_OPT_CMD_SET_GET_FEATURES)) return -EINVAL; /* clear the sub feature parameters */ diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c index cba0beedbb..337748af48 100644 --- a/drivers/mtd/nand/nand_mxs.c +++ b/drivers/mtd/nand/nand_mxs.c @@ -459,7 +459,7 @@ static void mxs_nand_cmd_ctrl(struct mtd_info *mtd, int data, unsigned int ctrl) /* Execute the DMA chain. */ ret = mxs_dma_go(channel); if (ret) - printf("MXS NAND: Error sending command\n"); + printf("MXS NAND: Error sending command (%d)\n", ret); mxs_nand_return_dma_descs(nand_info); @@ -815,7 +815,7 @@ static int __mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand /* Execute the DMA chain. */ ret = mxs_dma_go(channel); if (ret) { - printf("MXS NAND: DMA read error\n"); + printf("MXS NAND: DMA read error (ecc)\n"); goto rtn; } @@ -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) { + + /* [1] send SET FEATURE commond to NAND */ + feature[0] = mode; - ret = nand->onfi_set_features(mtd, nand, + 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); diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 27538c3f42..88a8fe9756 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -222,6 +222,9 @@ struct nand_chip; /* ONFI subfeature parameters length */ #define ONFI_SUBFEATURE_PARAM_LEN 4 +/* ONFI optional commands SET/GET FEATURES supported? */ +#define ONFI_OPT_CMD_SET_GET_FEATURES (1 << 2) + struct nand_onfi_params { /* rev info and features block */ /* 'O' 'N' 'F' 'I' */ |