diff options
author | David Mosberger <dmosberger@gmail.com> | 2013-05-29 08:30:13 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:06:00 -0400 |
commit | b4fd7e86732df4883ae9282e8f9119e1d08c8a02 (patch) | |
tree | de13534aab25aaf4afa83e025464523999a34a13 | |
parent | cbca4c75212da1ea82c10c054bbca36145cd13d8 (diff) |
mtd: nand_base: Only use GET/SET FEATURES command on chips that support them.
Spansion's S34MLx chips support ONFI but not the GET/SET FEATURES calls.
Signed-off-by: David Mosberger <dmosberger@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 8 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index d18cae55357c..59eac401e1a8 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -2716,7 +2716,9 @@ static int nand_onfi_set_features(struct mtd_info *mtd, struct nand_chip *chip, | |||
2716 | { | 2716 | { |
2717 | int status; | 2717 | int status; |
2718 | 2718 | ||
2719 | if (!chip->onfi_version) | 2719 | if (!chip->onfi_version || |
2720 | !(le16_to_cpu(chip->onfi_params.opt_cmd) | ||
2721 | & ONFI_OPT_CMD_SET_GET_FEATURES)) | ||
2720 | return -EINVAL; | 2722 | return -EINVAL; |
2721 | 2723 | ||
2722 | chip->cmdfunc(mtd, NAND_CMD_SET_FEATURES, addr, -1); | 2724 | chip->cmdfunc(mtd, NAND_CMD_SET_FEATURES, addr, -1); |
@@ -2737,7 +2739,9 @@ static int nand_onfi_set_features(struct mtd_info *mtd, struct nand_chip *chip, | |||
2737 | static int nand_onfi_get_features(struct mtd_info *mtd, struct nand_chip *chip, | 2739 | static int nand_onfi_get_features(struct mtd_info *mtd, struct nand_chip *chip, |
2738 | int addr, uint8_t *subfeature_param) | 2740 | int addr, uint8_t *subfeature_param) |
2739 | { | 2741 | { |
2740 | if (!chip->onfi_version) | 2742 | if (!chip->onfi_version || |
2743 | !(le16_to_cpu(chip->onfi_params.opt_cmd) | ||
2744 | & ONFI_OPT_CMD_SET_GET_FEATURES)) | ||
2741 | return -EINVAL; | 2745 | return -EINVAL; |
2742 | 2746 | ||
2743 | /* clear the sub feature parameters */ | 2747 | /* clear the sub feature parameters */ |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 05c5f9a0e5cc..a8d6623f18f7 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -217,6 +217,9 @@ struct nand_chip; | |||
217 | /* ONFI subfeature parameters length */ | 217 | /* ONFI subfeature parameters length */ |
218 | #define ONFI_SUBFEATURE_PARAM_LEN 4 | 218 | #define ONFI_SUBFEATURE_PARAM_LEN 4 |
219 | 219 | ||
220 | /* ONFI optional commands SET/GET FEATURES supported? */ | ||
221 | #define ONFI_OPT_CMD_SET_GET_FEATURES (1 << 2) | ||
222 | |||
220 | struct nand_onfi_params { | 223 | struct nand_onfi_params { |
221 | /* rev info and features block */ | 224 | /* rev info and features block */ |
222 | /* 'O' 'N' 'F' 'I' */ | 225 | /* 'O' 'N' 'F' 'I' */ |