From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933260AbcIUJ5s (ORCPT ); Wed, 21 Sep 2016 05:57:48 -0400 Received: from mail.sigma-star.at ([95.130.255.111]:45997 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933205AbcIUJ5p (ORCPT ); Wed, 21 Sep 2016 05:57:45 -0400 From: Daniel Walter To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, computersforpeace@gmail.com, dwmw2@infradead.org, boris.brezillon@free-electrons.com, Richard Weinberger Subject: [PATCH v2 45/46] mtd: nandsim: Always answer all 8 bytes from NAND_CMD_READID Date: Wed, 21 Sep 2016 11:57:42 +0200 Message-Id: X-Mailer: git-send-email 2.8.3 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Richard Weinberger 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 --- 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