From patchwork Mon Jun 5 23:21:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 103100 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1008420obh; Mon, 5 Jun 2017 16:25:26 -0700 (PDT) X-Received: by 10.98.207.132 with SMTP id b126mr22512210pfg.167.1496705126689; Mon, 05 Jun 2017 16:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496705126; cv=none; d=google.com; s=arc-20160816; b=mMq8iBaIYVNDNgmB47SLk3bdqIr3C4g21Pywr+mtQcC0L31a7T/vutxHtTG4afZyFF cw3dDfPDzfJXIFAMuRZ+mo80kFSmWg9vS4YVpdPbhG/Yufs68sMSY2LuadN3q1ROH4FJ QGVdSRWzTK3ozQaqv5yjZYtCEZmoCUC7pTeK9plQUVbwWbRMzxfJpYBL97D0+ryUuWN6 /AuMTJP2FhhJwGQcSR9iGwlI5pM6w90BDEJWzajvUnh7CO3vbED18JvhQ6bAOUq0v2v9 57HadrVBrFzyGw2rkUeXZhWWDFnaUkoN1CzFjc423g/HDMIIGi9ikbFWwPLZ7NoampOl Ae3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=NtSvSeVv15pVY2ZikNkM95O6qOU+MOA0wssg7wKIZo8=; b=p4AyjyuS6Fx+gGICLei05o1vmMEt1WiNB+/uvya8Bnvu8GdSH8zRnCTLTvE1prNpUv sa+VXg++iCahOlt5KfrFMCJXIBsoauQEvo5rDyJiLOLQBBItNjTPwix9V27VLkietdiC dzYOHWXtTZBP6PlQEJVGWxqC2qcji+SdlL1r4pTMFcmapAD9Zs80p4kxfxwRIKEVNybK XcQpOyJMtGfQwOxukP9yWMiHf1K3MfPhTh25AtGbCUEX5iUdG2ZkOOnIMqDruiTvO7bR Js4EDg06AoI44G2svwKktdHmapIYrzALN+6+uSUP3Z0Rxd2HjWrqb2+28qHunwnwcXnQ i30w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3si8432971plb.504.2017.06.05.16.25.26; Mon, 05 Jun 2017 16:25:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751361AbdFEXZX (ORCPT + 25 others); Mon, 5 Jun 2017 19:25:23 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:32120 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbdFEXZQ (ORCPT ); Mon, 5 Jun 2017 19:25:16 -0400 Received: from grover.sesame (FL1-118-110-19-204.osk.mesh.ad.jp [118.110.19.204]) (authenticated) by conuserg-10.nifty.com with ESMTP id v55NMD5m004412; Tue, 6 Jun 2017 08:22:41 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com v55NMD5m004412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1496704962; bh=NtSvSeVv15pVY2ZikNkM95O6qOU+MOA0wssg7wKIZo8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6kFUAuBElgybqKb8+gJ6/LpXqRt+nr0AfHNdrc6Vk2xHt/ko0i0y6WJApQhgeDuv dSuuXNwc1S9sF2OPHagxLtZK5SQxv2RB7rvLeprO0SULk5c1ziToFtwgLwx6Mhtwt3 CVuostdSY6ekvyDf/ziLxQeCYra0d8q55SUfhDb6MIXF0VAUt7rSc80SoNAYI/SYwV edaXD0GRdKDr2wTNObIeQtnMnyyLfjZSymJZGOoxaxyP5zbDQKFDYNryl8R4Wtksxn rgPQ5OcfUQe6rGQs95ZBRVHCBYSi/WEnvhDOEsPdeePdAkynFY7PNPQROX5H7lwGw5 bH3fBdqc/zY6Q== X-Nifty-SrcIP: [118.110.19.204] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Cc: Enrico Jorns , Artem Bityutskiy , Dinh Nguyen , Boris Brezillon , Marek Vasut , Graham Moore , David Woodhouse , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Masahiro Yamada , Cyrille Pitchen , linux-kernel@vger.kernel.org, Brian Norris , Richard Weinberger Subject: [PATCH v4 12/23] mtd: nand: denali: fix NAND_CMD_STATUS handling Date: Tue, 6 Jun 2017 08:21:51 +0900 Message-Id: <1496704922-12261-13-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496704922-12261-1-git-send-email-yamada.masahiro@socionext.com> References: <1496704922-12261-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current NAND_CMD_STATUS handling is weird; it just reads the WRITE_PROTECT register, and returns NAND_STATUS_WP if it is set. It does not send Read Status (0x70) command, so it is not helpful for checking the current device status. Signed-off-by: Masahiro Yamada --- Changes in v4: None Changes in v3: None Changes in v2: - Newly added drivers/mtd/nand/denali.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) -- 2.7.4 diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index e8e6667..372c871 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c @@ -107,21 +107,6 @@ static void write_byte_to_buf(struct denali_nand_info *denali, uint8_t byte) denali->buf.buf[denali->buf.tail++] = byte; } -/* reads the status of the device */ -static void read_status(struct denali_nand_info *denali) -{ - uint32_t cmd; - - /* initialize the data buffer to store status */ - reset_buf(denali); - - cmd = ioread32(denali->flash_reg + WRITE_PROTECT); - if (cmd) - write_byte_to_buf(denali, NAND_STATUS_WP); - else - write_byte_to_buf(denali, 0); -} - /* Reset the flash controller */ static uint16_t denali_nand_reset(struct denali_nand_info *denali) { @@ -893,7 +878,11 @@ static void denali_cmdfunc(struct mtd_info *mtd, unsigned int cmd, int col, switch (cmd) { case NAND_CMD_STATUS: - read_status(denali); + reset_buf(denali); + addr = MODE_11 | BANK(denali->flash_bank); + index_addr(denali, addr | 0, cmd); + index_addr_read_data(denali, addr | 2, &id); + write_byte_to_buf(denali, id); break; case NAND_CMD_READID: case NAND_CMD_PARAM: