From patchwork Tue Jun 13 05:03:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 103687 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp235761qgd; Mon, 12 Jun 2017 22:06:23 -0700 (PDT) X-Received: by 10.99.169.26 with SMTP id u26mr61900446pge.177.1497330383049; Mon, 12 Jun 2017 22:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497330383; cv=none; d=google.com; s=arc-20160816; b=JJBGLB6IZNuJeMAf7h7CAk9GcshKOzTO0C/rO6yY6xillPeq8asYXg9cCmWOAhryvw B0l1Y69HgZKerB4GKzuwpErqxsW+OtyvzsLp3d3j50BDRVj+8sjjOT44trHLEELNKf9I v4mhhOy3dQmsVeifReXZgSxBcIuRcuN6kArbvfFRrJxWdI6Y+rhAbEEGoDkiXscQ6KYA 0SArnK3vFl/gPverLuEYT8/PZ9TlUerc+jW0Ky9Rk6puwkMgYLZdKeMrUSfRyl+MmGUN DjRUNmu3TuiBCDHhyMU6alISzXgWEZHo6Q5cULiaz6UFOA5NpjgkCaFcw165T/+3CMzU mqdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature :arc-authentication-results; bh=5+DXaJQKSXDK5vowROIsgh68qvL0Re6U51yTLMRQn9w=; b=e8GtCkYLF+NY57sGPIjQgJ0k7Z7G7aQTm/1cuBj1dKV7Q1PU+0912La3rpuJCLHtG3 qbJ3LHNKJPcduaEutpy6oFvMXdew/Ft91eGt/s+aXWksgM43refnJBQvQzoPmsPQcRgx Fjao4RkNPXo5Il7uWwDZPG0kZq+b47PyQYwRKR5kDdksDD2MR1GsKQ71WyE6PqDhWIEr YXQnTUwtyS/gAR8IILC+atMvXp1p8j8s76odTXBuac4h/9O32FGjVWSpdt8zavpowQ+J HIqDxdJviXBpJ5T0STe9Q7AzBESOZtEfwZjLX+NkGw4igT/I9Tut5LmDX7lP5RvYK9Ly MYfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id v2si8396377plk.471.2017.06.12.22.06.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2017 22:06:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) client-ip=65.50.211.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 65.50.211.133 as permitted sender) smtp.mailfrom=linux-mtd-bounces+patch=linaro.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=5+DXaJQKSXDK5vowROIsgh68qvL0Re6U51yTLMRQn9w=; b=UpvotOrP1g+P4oXtzFsXKo4CQe LrBJ98FXxt3i5IYAaEN9RhST8KvG8vpy9IWB8/HaPas2Aah6AtKJN1TfbZxUZnx4jBe3ce01kByVL +CJKy2l4clSYDygMZQwN/zG2oRMg4E7aEpZ8+i10zYeuQ8PRqTn0wUBfvMgJ5VB7OC6quvoMzsgI5 jVEfFiHK1MN2qzVl7E03k24QrGuzCsueQtkjSM2GzALxWU6V0+4ExXhbcwOMugqNGxNrbkldoSGhP Mok555axA8ia1eBsQeOA7MtJvBzpwFhBTr6wyxzMLqLe32wKnRkheiWW6lcM02ypEvKwba6Aepwa9 f+L2YAVQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dKe1w-0007iS-BH; Tue, 13 Jun 2017 05:06:16 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dKe0t-0005xD-R9 for linux-mtd@lists.infradead.org; Tue, 13 Jun 2017 05:05:15 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id v5D54ENj023096; Tue, 13 Jun 2017 14:04:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v5D54ENj023096 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1497330261; bh=gc9iRZU8GbdNl4h+G7cJNgIT3hiiT3JLsaUmeFq6P18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MhFzM3T0aRMHXMt/HY708lH51sY0R8lXweT35inr+qw+ie/W+ZRL9b3v/8A8Y0eWx vjjfBrGVboL14zkVMRfQPoMKJK6L/aR9UeNaMFa9rYZbrsgsLstVPCi7p5uSDPNixD kc7r4ewFMYASijkysBi2QJbOEw9V8KlqFOPjfedcY1yu8tjzeQX1B/CZ3E9wIu0zsT GiqKzX4MNsQL4ZOhU+Xs2oV6TKQEqUt/lpT8Nl2Ts7YKmGo7T89lZwUo4B+mkZbINS mg+EQ4CrfdD0Km2qrj6yXRGZVcXj6o7wspB5bx8FTXyz6mLxxeTbh2cupgcfbq6Zv/ o2pwaVPLsrrBg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v6 05/18] mtd: nand: denali: fix NAND_CMD_STATUS handling Date: Tue, 13 Jun 2017 14:03:57 +0900 Message-Id: <1497330250-17348-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497330250-17348-1-git-send-email-yamada.masahiro@socionext.com> References: <1497330250-17348-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170612_220512_329867_76E6D019 X-CRM114-Status: GOOD ( 11.54 ) X-Spam-Score: -1.2 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Cyrille Pitchen , Richard Weinberger , Marek Vasut , Masahiro Yamada , Artem Bityutskiy , Dinh Nguyen , linux-kernel@vger.kernel.org, Enrico Jorns , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.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 v6: None Changes in v5: None 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 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index d7e7555a3d73..4bf93232ca30 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: