linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nand_base: fix for ONFI chips that do not support GET/SET FEATURES
@ 2013-05-07 15:08 David Mosberger-Tang
  2013-05-08  2:11 ` Huang Shijie
  0 siblings, 1 reply; 2+ messages in thread
From: David Mosberger-Tang @ 2013-05-07 15:08 UTC (permalink / raw)
  To: David Woodhouse, Artem Bityutskiy, Brian Norris, Huang Shijie,
	linux-mtd@lists.infradead.org

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

I not seen any ACK that this patch has been queued for merging, so I'm
re-sending.  Please let me know what you intend to do with it.

Thanks,

  --david

[-- Attachment #2: nand_base-features-fix-v2.diff.txt --]
[-- Type: text/plain, Size: 1628 bytes --]

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>

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index dfcd0a5..13bdb96 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2720,7 +2720,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);
@@ -2741,7 +2743,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 ab63634..9b98af8 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'  */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nand_base: fix for ONFI chips that do not support GET/SET FEATURES
  2013-05-07 15:08 [PATCH] nand_base: fix for ONFI chips that do not support GET/SET FEATURES David Mosberger-Tang
@ 2013-05-08  2:11 ` Huang Shijie
  0 siblings, 0 replies; 2+ messages in thread
From: Huang Shijie @ 2013-05-08  2:11 UTC (permalink / raw)
  To: David Mosberger-Tang
  Cc: Artem Bityutskiy, Brian Norris, linux-mtd@lists.infradead.org,
	David Woodhouse

于 2013年05月07日 23:08, David Mosberger-Tang 写道:
> I not seen any ACK that this patch has been queued for merging, so I'm
> re-sending.  Please let me know what you intend to do with it.
>
I can not git-am your patch. I think you'd better create a patch with 
git-format-patch,
and send it out with git-send-email.

You can add my
Reviewed-by: Huang Shijie <b32955@freescale.com>


thanks
Huang Shijie

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-08  2:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-07 15:08 [PATCH] nand_base: fix for ONFI chips that do not support GET/SET FEATURES David Mosberger-Tang
2013-05-08  2:11 ` Huang Shijie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).