From patchwork Sat Mar 29 13:36:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerhard Sittig X-Patchwork-Id: 334968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 069811400A5 for ; Sun, 30 Mar 2014 00:37:48 +1100 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTtRs-0003ER-87; Sat, 29 Mar 2014 13:37:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTtRk-0007c3-AL; Sat, 29 Mar 2014 13:37:16 +0000 Received: from mail-out.m-online.net ([212.18.0.9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WTtRi-0007ZY-5a for linux-mtd@lists.infradead.org; Sat, 29 Mar 2014 13:37:15 +0000 Received: from frontend1.mail.m-online.net (unknown [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3fx1Dk2KDbz4KK45; Sat, 29 Mar 2014 14:36:38 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3fx1Dk25pVzbbfd; Sat, 29 Mar 2014 14:36:38 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.180]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id LGfD4TiyXnZs; Sat, 29 Mar 2014 14:36:37 +0100 (CET) X-Auth-Info: amVQqP1/gIu1DJFV5SCEGVxhdcq7MzB9LGYNE6dnXt4= Received: from localhost (kons-4d03fcb4.pool.mediaWays.net [77.3.252.180]) by mail.mnet-online.de (Postfix) with ESMTPA; Sat, 29 Mar 2014 14:36:37 +0100 (CET) From: Gerhard Sittig To: linux-mtd@lists.infradead.org Subject: [PATCH v1 3/3] mtd: nand: introduce a READMODE command Date: Sat, 29 Mar 2014 14:36:24 +0100 Message-Id: <1396100184-7110-4-git-send-email-gsi@denx.de> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1396100184-7110-1-git-send-email-gsi@denx.de> References: <1396100184-7110-1-git-send-email-gsi@denx.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140329_093714_379117_39D67244 X-CRM114-Status: GOOD ( 12.96 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.18.0.9 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Gerhard Sittig , Brian Norris , David Woodhouse , Pekon Gupta , Alexander Shiyan X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org the nand_command_lp() implementation derives a "READPAGE" sequence from a passed in READ0 opcode, i.e. emits a sequence of READ0 _and_ READSTART commands in this case introduce a "READMODE" command which sends the READ0 opcode to the chip exclusively and doesn't send the READSTART opcode such a "READMODE" command is useful in the context of on-die-ECC support where a sequence of READ0, READSTART, STATUS, READ0 is required; having support for READMODE in the common nand_command_lp() routine avoids the need for duplication and open coded cmd_ctrl() calls Signed-off-by: Gerhard Sittig Acked-by: Pekon Gupta --- drivers/mtd/nand/nand_base.c | 4 +++- include/linux/mtd/nand.h | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 9ae99c1ba772..9a74bd06004b 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -706,7 +706,8 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command, /* * Program and erase have their own busy handlers status, sequential - * in and status need no delay. + * in and status need no delay, read mode just reverts back to + * data output after a status command and needs no read start. */ switch (command) { @@ -717,6 +718,7 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command, case NAND_CMD_SEQIN: case NAND_CMD_RNDIN: case NAND_CMD_STATUS: + case NAND_CMD_READMODE: return; case NAND_CMD_RESET: diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 32f8612469d8..234c80c1456a 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -106,6 +106,17 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); #define NAND_CMD_NONE -1 +/* + * Pseudo commands, which map to the above "real" commands for the NAND chip + * yet involve slightly different behaviour in related software layers + * + * READMODE switches back from status output to data output after a + * previously emitted sequence of READ0, READSTART, and STATUS commands; + * actually it's a mere READ0 without the address specs and without the + * READSTART command which the READ0 convenience logic would imply + */ +#define NAND_CMD_READMODE 0x100 + /* Status bits */ #define NAND_STATUS_FAIL 0x01 #define NAND_STATUS_FAIL_N1 0x02