mtd: nand: fix GET/SET_FEATURES address on 16-bit devices

David Mosberger davidm at egauge.net
Fri Mar 21 18:05:10 EDT 2014


linux-next almost works out of the box for us except that GET_FEATURES
and SET_FEATURES also need byte-addressing.  With the attached patch,
our board boots fine (save for on-die ECC patch, which I'll submit
separately).  The only oddity is that the devices is reported as being
SLC, when it's most definitely not:

nand: 512MiB, SLC, page size: 2048, OOB size: 64

   --david



GET_FEATURES and SET_FEATURES also need byte-addressing on 16-bit devices.

Signed-off-by: David Mosberger <davidm at egauge.net>

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 0747fef..29a23bb 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -925,7 +929,16 @@ static inline bool nand_is_slc(struct nand_chip *chip)
  */
 static inline int nand_opcode_8bits(unsigned int command)
 {
-	return command == NAND_CMD_READID || command == NAND_CMD_PARAM;
+	switch (command) {
+	case NAND_CMD_READID:
+	case NAND_CMD_PARAM:
+	case NAND_CMD_GET_FEATURES:
+	case NAND_CMD_SET_FEATURES:
+		return 1;
+	default:
+		break;
+	}
+	return 0;
 }
 
 /* return the supported JEDEC features. */



More information about the linux-mtd mailing list