From patchwork Wed Jun 7 11:52:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 103245 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1715504obh; Wed, 7 Jun 2017 04:57:34 -0700 (PDT) X-Received: by 10.99.114.11 with SMTP id n11mr31931938pgc.4.1496836654773; Wed, 07 Jun 2017 04:57:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496836654; cv=none; d=google.com; s=arc-20160816; b=Trp+456j4ZvUS4dPXkGM/ki0TRUXyQsRxiLX6hK3Gkda0Tm8zRwbiV9p11kQLjWO1w fQHvwCvf83Y/sw8ie5CyapqhoSfRot9lDG9Mty+YZrJMkvt3m0hfWGlYtLcdvy42Zkt0 omAYrEnO0eGDTDshD2jNYzCFMYGgVHSIIY8dgEJAmmU9kJbTpBRtW8NHqNZef40mT4gS bu1YCWa11beFnTncFKoroCpTOuLbMuUR7VyI/P2dsyQMnv53y5j7TcfSZhZLUH+tEx0N aZcMPYYoFeOySR0IR6BNYNQh45eJNxcdSTc2pn3J3Xz69IPndvM21XkheMFziwU8UsBB L/Cg== 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=71SlKkvfQGUSE++RNn1+MWQXj5rQ91VX6rRiTCO+YV8=; b=jYADdp5PZHwahrPQWhNBN/lty+JSTtOzuQz2yhtHoZAv9SoV44o/oxYt7pV13sBgXL MoKHkOw06TZ6Ubajlz/9/8NNv9aS0jpCKNq/0hAPya8nixYVedLfUSxhvY/5mkzQaxyA C54dFpeCbLOD9ozGnMC0kZM9Mac/KNUjREDN49XCQOBFJAnTlTsVZPEtrQy/WLbdNgtv icHPLfdSiS7jMVStRv5xDjuyFrQgfEsgJdSKQcdrkda7tIXtAw/sgRbMOlMzJ6RI/jAx zOlRaTzRtesOjO93FQjkF85v94PPy84nY5UeyrIoOX3K5hWkrjnCL+CIzO3I1pkGVmBr 1phQ== 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 p68si1629467pfi.108.2017.06.07.04.57.34; Wed, 07 Jun 2017 04:57:34 -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 S1751861AbdFGL5C (ORCPT + 25 others); Wed, 7 Jun 2017 07:57:02 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:42683 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751642AbdFGLza (ORCPT ); Wed, 7 Jun 2017 07:55:30 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id v57BqjZa014276; Wed, 7 Jun 2017 20:52:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com v57BqjZa014276 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1496836380; bh=71SlKkvfQGUSE++RNn1+MWQXj5rQ91VX6rRiTCO+YV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iNky5i7KOsTnUH7kaklbqcRRLYEFZkqRyYn+0MJtteKWdJrI738YxhH5lNVP2kXBS kA8BZbzcEHCPrHE3bmE1wlmGCIhMggxrmwGhsDkGGmgIXmgzQuWlBTHbii1Vmt3Ak+ x99cqzYWbDUCCQt3aIjgUmGcwJ0SWdkORp8chHfOKqiyDETmR4hfFFKSKj0U9wBFE9 vZjuQFvGh/GLAyrJ4Rl/S01Nm9eWC0y5TdaZtQsCMcxmXHrZ4UQECG8JSBbiBa9E0n zHzID6mf7ovXXNQqFZv/AS0MsB8L4zU5ZS9+jZnh7MKd433xyh6pGTFb8lSuODYFbJ NPNT4POpGtvbg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Cc: Enrico Jorns , Artem Bityutskiy , Dinh Nguyen , Boris Brezillon , Marek Vasut , David Woodhouse , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , Masahiro Yamada , Cyrille Pitchen , linux-kernel@vger.kernel.org, Brian Norris , Richard Weinberger Subject: [PATCH v5 11/23] mtd: nand: denali: fix NAND_CMD_STATUS handling Date: Wed, 7 Jun 2017 20:52:20 +0900 Message-Id: <1496836352-8016-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496836352-8016-1-git-send-email-yamada.masahiro@socionext.com> References: <1496836352-8016-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 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 diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 62798e6d7009..94beab57c145 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: