[PATCH v2 45/46] mtd: nandsim: Always answer all 8 bytes from NAND_CMD_READID
Daniel Walter
dwalter at sigma-star.at
Wed Sep 21 02:57:42 PDT 2016
From: Richard Weinberger <richard at nod.at>
nand base reads the full 8 byte NAND ID, no matter
how many id bytes we have configured.
So, instead of getting confused return all bytes
even when they are not configured (0xff).
Fixes error messages such as:
nandsim: unexpected data output cycle, state is STATE_READY return 0x0
Signed-off-by: Richard Weinberger <richard at nod.at>
---
drivers/mtd/nand/nandsim.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 5d82a0a..b901155 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -56,8 +56,6 @@
#define NANDSIM_FIRST_ID_BYTE 0x98
#define NANDSIM_SECOND_ID_BYTE 0x39
-#define NANDSIM_THIRD_ID_BYTE 0xFF /* No byte */
-#define NANDSIM_FOURTH_ID_BYTE 0xFF /* No byte */
#define NANDSIM_ACCESS_DELAY 25
#define NANDSIM_PROGRAMM_DELAY 200
#define NANDSIM_ERASE_DELAY 2
@@ -87,9 +85,7 @@ static unsigned int bch;
static u_char id_bytes[8] = {
[0] = NANDSIM_FIRST_ID_BYTE,
[1] = NANDSIM_SECOND_ID_BYTE,
- [2] = NANDSIM_THIRD_ID_BYTE,
- [3] = NANDSIM_FOURTH_ID_BYTE,
- [4 ... 7] = 0xFF,
+ [2 ... 7] = 0xFF,
};
static bool defaults = true;
@@ -3064,14 +3060,7 @@ struct mtd_info *ns_new_instance(struct nandsim_params *nsparam)
* Perform minimum nandsim structure initialization to handle
* the initial ID read command correctly
*/
- if (id_bytes[6] != 0xFF || id_bytes[7] != 0xFF)
- nand->geom.idbytes = 8;
- else if (id_bytes[4] != 0xFF || id_bytes[5] != 0xFF)
- nand->geom.idbytes = 6;
- else if (id_bytes[2] != 0xFF || id_bytes[3] != 0xFF)
- nand->geom.idbytes = 4;
- else
- nand->geom.idbytes = 2;
+ nand->geom.idbytes = sizeof(id_bytes);
nand->regs.status = NS_STATUS_OK(nand);
nand->nxstate = STATE_UNKNOWN;
nand->options |= OPT_PAGE512; /* temporary value */
--
2.8.3
More information about the linux-mtd
mailing list