From patchwork Wed Nov 28 05:27:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 152178 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp678866ljp; Tue, 27 Nov 2018 21:28:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/VUBi9HXi/5/41WxJam7O4Vc1dmVTjRHNiD3Pp2FgQ5upqQ1v8/1Wq7OALbFSFM7ogSmthV X-Received: by 2002:a17:902:a9c4:: with SMTP id b4mr35578552plr.298.1543382909149; Tue, 27 Nov 2018 21:28:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543382909; cv=none; d=google.com; s=arc-20160816; b=dg0j0NQzWcaYraVk71z2UX4Yh046ffpRMrdmLRs4YnZFG9srQbmy8KGIkwaGZkfMHP jwSTCFV/g/opPfn0a4Bik5OoLUjRaHAdbbNwfF2b/xFusAov4sTh2R4e03f13nkw+c1P tLV8Y9dgmOHZF2MI6p3poI0ebC2IrbZfA2oVBag0jso6vMbCqXUQz8eyRlBtP9kOPrNx J2AFMth81agokb+xug2PSCGyVudOIyZ0IG+5Xdp21kjBd3WrEH80dQ4X+S+cZTik/KcP rD7u16Hm30jiia7bumQOZorrZGmH2fvdq1qyyX65YVXhDbEQUXzhx03E2Hcq72ZRS5FV 1p9Q== 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=PK15yTZFFz9oZlK/GEKhnkjbK2U8L6RtqYqGu1gMXhM=; b=lK0+ndRYmd7nkoUPvdYrOgGautA2/dheZwazYmMrCEJDM0pH7FL/2WHxM5lrAexn1d eWvPLTdXiK7aPgTTAgHLdI9gdL8J3tWQQThpWGm5NN5xZ8PDHX6mTgoRAX6QCCydGPQG vBShgRx/ZTBkMReXphvYMKF13cl7T5p6Q4T89FlxdvkRWYIh0U2/UgQRXQuAx+nKramo nWkAz9BwS2ACNYv8kg3fXhDAZZLxtPzJt9gZUvpujPKKmJpPwGlSe6zApyPp8uIU3fvP V4OAu6KBWlxBlu6XXcaTQ0fnU9h8PohQQnqeePSC4DxTej8eAuFNwZCOvSucBeKZgVci p41A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=nPRckEC1; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b="P00Y/blW"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::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. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id y7si5827967plk.275.2018.11.27.21.28.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Nov 2018 21:28:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=nPRckEC1; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b="P00Y/blW"; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::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=PK15yTZFFz9oZlK/GEKhnkjbK2U8L6RtqYqGu1gMXhM=; b=nPRckEC195a4uB0DFYnogdlmkV Xe/X13XsSGGFwMho2NGpRRyAkJTlbLZ2irHx+Chpf7jGUBYWhXjpMuEsTMJgyf0WQvKPEdT6GdDds 3oDj58ovcknjj+tuokDvvwrnGLfxK2ii4U8FyxpqdCs1DjwztK/0OckYso/Bn8xMlBCUDHGM4hM0t qSrRye5hlLzCZowzeR9N1MXD8J6TuhCD9QvN5iUvPoSLR+WrhDLl3Lww00j2984WQr+tnfW8v8Lqk 7vWmwRQdBO806xEZC1LlBNc9fVzKnOKtfHPZYcOMwaC/BhUDobVyXUeE7BlLYE+S0fMDSaDguciS5 REXNE78A==; 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 1gRsOY-0004bK-Ty; Wed, 28 Nov 2018 05:28:18 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gRsOW-0004aM-5x for linux-mtd@lists.infradead.org; Wed, 28 Nov 2018 05:28:18 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id wAS5RnF5025853; Wed, 28 Nov 2018 14:27:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com wAS5RnF5025853 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1543382872; bh=/RxbxpNU/Lt1yZysKIu6X8rRWnyhVqc9ghtqFZ+IFik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P00Y/blWCmUgBgzQp0Rx1kGot6VVVMgHlAPy7fRXUU00sfohEY85HZdFMIQNU3d4D j+Jy7KNaPKEVBuBDxuytiN4ReqhX//cFNoenbE+9YiB8tp9RJA2nkA2DYgKf+sQ3Km ha6dx+T5dHrhes87t/vo/qbFCTeQDmRr1sp9aqDw1HoCL/efqFq/5N1B7Ignzc5uPL VV3CVk4Pr/ocWACqOM2ARVGPIu198D9Qu7V0FRYQkOUHTEuCkFvKzcyCMli9GpyARi wEWz4kAUbQaouuWXsNYcx1z8su91SxzXLsZP1Uur8HExzMeCTqCezjaHUANnrv9SQI l/1X+pDT0KmFA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Boris Brezillon , Miquel Raynal Subject: [PATCH v2 2/2] mtd: rawnand: denali: remove denali_reset_banks() Date: Wed, 28 Nov 2018 14:27:37 +0900 Message-Id: <1543382857-30827-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1543382857-30827-1-git-send-email-yamada.masahiro@socionext.com> References: <1543382857-30827-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181127_212816_567146_E85C51BE X-CRM114-Status: GOOD ( 13.11 ) X-Spam-Score: 3.7 (+++) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (3.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 2.7 RCVD_IN_PSBL RBL: Received via a relay in PSBL [210.131.2.75 listed in psbl.surriel.com] 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 --- Changes in v2: None 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 ead6e60..2302010 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -1045,29 +1045,6 @@ static int denali_setup_data_interface(struct nand_chip *chip, 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) { /* @@ -1321,12 +1298,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;