mtd: nand_base: Only use GET/SET FEATURES command on chips that support them.
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Mon Aug 5 16:59:03 EDT 2013
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d914c932d7764bf9633af974940aee9390adf20d
Commit: d914c932d7764bf9633af974940aee9390adf20d
Parent: 64ddba4d8a381b65bebee24c8da4eb80080c64a4
Author: David Mosberger <dmosberger at gmail.com>
AuthorDate: Wed May 29 15:30:13 2013 +0300
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Aug 5 20:49:04 2013 +0100
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 at gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/nand/nand_base.c | 8 ++++++--
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 edc7663..1cbacff 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2709,7 +2709,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);
@@ -2730,7 +2732,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/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 38535eb4..0745a42 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -217,6 +217,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' */
More information about the linux-mtd-cvs
mailing list