From patchwork Fri Sep 7 07:28:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 146183 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp840097ljw; Fri, 7 Sep 2018 00:29:57 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYaD1d/DG5VQLCsubtrUJc7v5MKuquI3ULnj89gqP2aRCz42HXhhfl0/hCsrpweMTnvtqI1 X-Received: by 2002:a17:902:e20b:: with SMTP id ce11-v6mr6715779plb.136.1536305397546; Fri, 07 Sep 2018 00:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536305397; cv=none; d=google.com; s=arc-20160816; b=A92rjzrPaJObSJL/4X1kOSskbAhgJYJdEn69QucGy7HWyja2hhqzSHx3jkVvYkoJOz 6Qe3YNIiPD7vDxcgPeXfO1e5//XIaCxcVaCE555qTFqQqpMUmVzr2Qdi6nbIPq6IVnvB aSRmqGNWom/+4OTppRPtwuFhWcQVPrjBwZHWo7Yim8jEp8c2X7CtPbPRR0hdOUp2l0YI vXUQxZGbxhzfKsqpENhA9H4ccjoQifR/3TxtFkr1wCVQD6sg6sKIafXZj3Z4cpMuknjE zvye23G1S8PqiXGbuOVUKFMWahFQmJIftAQyrCZN0EvM6abb4j5GsBIHFRWOcfH7YnlR zWvQ== 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; bh=KQdclzS4zFQy2sqvZb0xH+gxF/VTFFwLJxI3WSWYkRE=; b=ByXFfwNUPH+JnEJwUSndMgfiumr7lEs+GoxnDKOeCmk18hbgGSeXP0hMUB2ocxZQ37 EJDR6XxmD0pJZ7YgSwKQR0gcnLJXPG6PlUL1VpUEfC0LnjS3Fm4U7smLnY3LKtAGP2Tq K68olXh/DUtWIyTIesLZ22YvArTutp3I+XKoDVZntkbI+u0rzoML2cCaV9xiyeAgSq2y k0yH0qOSkxVAN9iJRhHTBQ5hT7B7zcL0SLfaHmAsaZ3PZTFIQE0HYsnx8UsN7ScSyy5M 6qEzEooksmBGxHgu6pvFVqRcz1x1LEGOSFHOYa77sqIUcVoO8ZsfN7aAJFmR0fjw0+Ax wazQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=QEEfS0ux; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=StSHcmxl; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 198.137.202.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. [198.137.202.133]) by mx.google.com with ESMTPS id 185-v6si7643246pgj.511.2018.09.07.00.29.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Sep 2018 00:29:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 198.137.202.133 as permitted sender) client-ip=198.137.202.133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=QEEfS0ux; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=StSHcmxl; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 198.137.202.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=KQdclzS4zFQy2sqvZb0xH+gxF/VTFFwLJxI3WSWYkRE=; b=QEEfS0uxwWsuS/vuEizU114NUv dHLp5Pbr1zR+ObysD//96UiBhVZ8NFTvnCVAT79zAxPxao2MEbE3FBDSHoBpEdvqUB4CtcA2rMnI0 QJOw1NUwF800FhSa+f0dk2V/2pYyU5eVWAUsYMUgYfK3nUAsMSMTdOyjW4t45rurGixycrihT09wp MZlWjv25KokW8lrB94DV1fe00SNPjoHeYol/utQDLy6GGaqN2hhNwrC9dG192LXO5zcx4vMLmsfC2 k5HPIWRrUclx7F3ZfHTDUbLp4IVd+jB7oGgQ+7FIxN5ru/tqimuyOsRhzyjN1AaqiHP3ZGWe2K07v YYaXA9NQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyBD5-0004Cd-DG; Fri, 07 Sep 2018 07:29:43 +0000 Received: from conuserg-09.nifty.com ([210.131.2.76]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fyBCf-00049e-UW for linux-mtd@lists.infradead.org; Fri, 07 Sep 2018 07:29:20 +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 w877Sg40001106; Fri, 7 Sep 2018 16:28:44 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w877Sg40001106 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1536305324; bh=flu3fp1o58/XFwJIPc3xfkUEHKLiSuaT8QXkx1DBVyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=StSHcmxlR/gB9a3vbwTen17SA+Vjdz1l6JHLdpEGPE8PDH6wi47WGSt+C/2JqId4R gL5oispWOEzOxXt/Uc0KgNS5YAmHmAhJiEoW7vJA5PHt2gySsZWlmRRUxosW7awJ2P 0/jKYcAksmLj5767+ZAm9j48Y+0mNBU+JMOBhjiEYhTX18ASTmWi0rN6rKDRDqA/tu C+tYcXD6ckp8eTNj46n+GPgG0PJXq5G9OCykfNECWq/PcbRUKMd7i5RP52FxvKAprE OX7EEM4T4fKoRRMSgMXsACfTySQEnflvKslrbyWGeNZEVdhpsI5ey/QFVoyx/wVvGY 1xCrUOyqZELyg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Boris Brezillon , Miquel Raynal Subject: [PATCH 2/2] mtd: rawnand: denali: remove denali_reset_banks() Date: Fri, 7 Sep 2018 16:28:29 +0900 Message-Id: <1536305309-28026-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1536305309-28026-1-git-send-email-yamada.masahiro@socionext.com> References: <1536305309-28026-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180907_002918_343974_A738A7DE X-CRM114-Status: GOOD ( 12.77 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [210.131.2.76 listed in list.dnswl.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 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: Marek Vasut , Richard Weinberger , linux-kernel@vger.kernel.org, Masahiro Yamada , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org In nand_scan_ident(), the controller driver resets every NAND chip. This is done by sending NAND_CMD_RESET. The Denali IP provides another way to do the equivalent thing; if a bit is set in the DEVICE_RESET register, the controller sends the RESET command to the corresponding device. denali_reset_banks() uses it to reset all devices beforehand. This redundant reset sequence was needed to know the actual number of chips before calling nand_scan_ident(); if DEVICE_RESET fails, there is no chip in that chip select. Then, denali_reset_banks() sets denali->max_banks to the number of detected chips. As commit f486287d2372 ("mtd: nand: denali: fix bank reset function to detect the number of chips") explained, nand_scan_ident() issued Set Features (0xEF) command to all CS lines, some of which may not be connected with a chip. Then, the driver would wait for R/B# response, which never happens. This problem was solved by commit 107b7d6a7ad4 ("mtd: rawnand: avoid setting again the timings to mode 0 after a reset"). In the current code, nand_setup_data_interface() is called from nand_scan_tail(), which is invoked after the chip detection. Now, we can really remove the redundant denali_nand_banks() by simply passing the maximum number of chip selects supported by this IP (typically 4 or 8) to nand_scan(). Let's leave all the chip detection process to nand_scan_ident(). Signed-off-by: Masahiro Yamada --- drivers/mtd/nand/raw/denali.c | 29 ----------------------------- 1 file changed, 29 deletions(-) -- 2.7.4 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index f069184..d1ae968 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -1040,29 +1040,6 @@ static int denali_setup_data_interface(struct mtd_info *mtd, int chipnr, return 0; } -static void denali_reset_banks(struct denali_nand_info *denali) -{ - u32 irq_status; - int i; - - for (i = 0; i < denali->max_banks; i++) { - denali->active_bank = i; - - denali_reset_irq(denali); - - iowrite32(DEVICE_RESET__BANK(i), - denali->reg + DEVICE_RESET); - - irq_status = denali_wait_for_irq(denali, - INTR__RST_COMP | INTR__INT_ACT | INTR__TIME_OUT); - if (!(irq_status & INTR__INT_ACT)) - break; - } - - dev_dbg(denali->dev, "%d chips connected\n", i); - denali->max_banks = i; -} - static void denali_hw_init(struct denali_nand_info *denali) { /* @@ -1311,12 +1288,6 @@ int denali_init(struct denali_nand_info *denali) } denali_enable_irq(denali); - denali_reset_banks(denali); - if (!denali->max_banks) { - /* Error out earlier if no chip is found for some reasons. */ - ret = -ENODEV; - goto disable_irq; - } denali->active_bank = DENALI_INVALID_BANK;