From patchwork Thu Mar 23 00:17:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 95855 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp493736qgd; Wed, 22 Mar 2017 17:20:01 -0700 (PDT) X-Received: by 10.99.211.69 with SMTP id u5mr1801366pgi.82.1490228401388; Wed, 22 Mar 2017 17:20:01 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [65.50.211.133]) by mx.google.com with ESMTPS id c65si2503521pfb.25.2017.03.22.17.20.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 17:20:01 -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=UKtfrG7XXA3OwuoFWTnjMase7f2uIx6lASDXgyATDSo=; b=WYYecwImxDw0vaKlS2vLqqBrXE CDnCL6riwumFBM5YYedH0za6C4vFVFRhQ13Qr4Eb4bC6kmWF6vNsOsvi1HiMdCgPwxFsREJKD51g4 zYGT1ow/RQ8ngEWrTRHjcNyDT7Ebx7BGv1ledlZ/Up0ai84TVp8Z1lZ9Jq99z08mihbVvMgovzBZc 7iDvoWuxmhsocBvgvFSrY1fzAxSO+bA+mKCnuup6epjYyquLZhdW6xGxa8G2PHZbOQ3IrmV3GzwLg XL4rpmsoibSO1lnVgkh0QyF038qrUk0qCzJXV11nQ6vPzsrCe5o6OjarYF75M80IUxxbeOEH/8PXS p3vkNnPg==; 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 1cqqTu-0005NJ-0r; Thu, 23 Mar 2017 00:19:58 +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 1cqqT6-0004Zv-Am for linux-mtd@lists.infradead.org; Thu, 23 Mar 2017 00:19:15 +0000 Received: from grover.sesame (FL1-111-169-71-157.osk.mesh.ad.jp [111.169.71.157]) (authenticated) by conuserg-09.nifty.com with ESMTP id v2N0I4bo008011; Thu, 23 Mar 2017 09:18:19 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com v2N0I4bo008011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1490228300; bh=E9HpmHNHXl+27J5zZatPZMQdvqbYlqZJ9S/PsdEoHzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlgiwkTT2qq8RMYELtPtWagbGGvFxjLx7Od4o+wSiRE5o+MQsraJXPgnfDz2Vc8Ry CRbLO/y8I1BbX1VJvBQJekwmQSNEAy4oWqhyTPY1KwOeRSFlonyR990Z5hvf/RING+ 1v0d9Hwde/oa6uRp9FlEabDJ+rJLJXcsbk1fMW6hsAyyWWo/0nyzmVNXZuU1nXCGnw sFBdDp5HeidHy+vqWkpkg5VKJeuzvkEgcRca5SOqvLpfr2R8Ke54j8QtfgEqceE5qv rWDkULFqWQIWyvUlpmD8NDMiYrzDXgNsCNQs3lB5elupZj+C3sverrICNhY5uzMSSI zGO70reS5MPwA== X-Nifty-SrcIP: [111.169.71.157] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [RESEND PATCH v2 38/53] mtd: nand: denali: fix NAND_CMD_STATUS handling Date: Thu, 23 Mar 2017 09:17:47 +0900 Message-Id: <1490228282-10805-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490228282-10805-1-git-send-email-yamada.masahiro@socionext.com> References: <1490228282-10805-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170322_171908_861800_E1827173 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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: laurent.monat@idquantique.com, Boris Brezillon , thorsten.christiansson@idquantique.com, Dinh Nguyen , Enrico Jorns , Artem Bityutskiy , Marek Vasut , Masahiro Yamada , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Brian Norris , David Woodhouse , Rob Herring , Graham Moore 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 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 5aafa59..275f1fa 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) { @@ -857,7 +842,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: