Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966544AbdIZDlp (ORCPT ); Mon, 25 Sep 2017 23:41:45 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:44765 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933685AbdIZDlo (ORCPT ); Mon, 25 Sep 2017 23:41:44 -0400 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v8Q3dRT8030041 X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Cc: Masahiro Yamada , Cyrille Pitchen , linux-kernel@vger.kernel.org, Boris Brezillon , Marek Vasut , Brian Norris , Richard Weinberger , David Woodhouse Subject: [PATCH] mtd: nand: wait for tWHR after NAND_CMD_STATUS / NAND_CMD_READID Date: Tue, 26 Sep 2017 12:39:24 +0900 Message-Id: <1506397164-3648-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1322 Lines: 47 Read Status and Read ID require tWHR before reading the first data. Insert a very short wait to make sure to meet the spec. I have not seen any problem report for now, but nand_command() and nand_command_lP() are generic hooks, so it makes sense to implement fail-safe code here. Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/nand_base.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index b1cf32c..55c0ba5 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -742,9 +742,12 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, case NAND_CMD_ERASE1: case NAND_CMD_ERASE2: case NAND_CMD_SEQIN: + case NAND_CMD_SET_FEATURES: + return; + case NAND_CMD_STATUS: case NAND_CMD_READID: - case NAND_CMD_SET_FEATURES: + ndelay(200); /* tWHR */ return; case NAND_CMD_RESET: @@ -871,9 +874,12 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command, case NAND_CMD_ERASE1: case NAND_CMD_ERASE2: case NAND_CMD_SEQIN: + case NAND_CMD_SET_FEATURES: + return; + case NAND_CMD_STATUS: case NAND_CMD_READID: - case NAND_CMD_SET_FEATURES: + ndelay(200); /* tWHR */ return; case NAND_CMD_RNDIN: -- 2.7.4