From patchwork Tue Apr 2 04:03:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161596 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1256964jan; Mon, 1 Apr 2019 21:04:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIT0k4ICrEID9CzdwC7/jCxYkvM9QQWmcyEwe2dfWXGh+TnYG08qAOVtskgH1eHeGl8iWd X-Received: by 2002:a65:5303:: with SMTP id m3mr63817157pgq.292.1554177840411; Mon, 01 Apr 2019 21:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554177840; cv=none; d=google.com; s=arc-20160816; b=pOgALCmQYHkSgg5cFYkdwggbJye7BJBPHL1Upk03TgBZe7DhhyvOGxzRCJk4wbIbZw ttPfZuE206xT4pr1zE+5EDlpoT72jvrY1MBuwgcunrGqm3bTybLJY2CxIyXaQKZqo2CU i3zQNIfxUvvMCres/kEzULfoYBdmGGMxBm5KbMgBGYgncYF8J1PmAyyrMvQFQl2xDqJV RwDUOQ6imMfMk1qqwLjJd0l4fyS+Tg7YVswsmDSbCgJF/2KrwqIMchRulEI3OGD15v0Q 5vC6ER/h75Y2IaTfuXB+rOUfh/y6wKTwrlYNsZ8wQSwElh0k+qPkhMjrAMeL475I3kNz aEww== 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=KuLN6APH1MF5Hkl5JzpcFN3fazN8KpVqneRw7+8p+rs=; b=Hup31cPJd2PSlL5+a28Q2eGFobjfEqnfBk0SfvLt4dO6GXc1Jubvfrx9iFzVIzXjSH sbYQSJXF3Ks7WTjBSkrzuJD72SkVVGR6CanDfnPITJhQvAh64NKXbH4cjm76RRg9dNue vl8AHzdpamyLT8PWw72CB6Ba/R7y+dOIgS5g3gzfvBFbRN5mnw+hg2LH39A9nItPVHXZ Ho6DHCit7+6tdYp2bkA4Uxe78UafUNpQ4QYuigAw/iZxXdQFK4fJoASc9ch7cdpplalg NhSYY7gvqmte1QG2MySUEsEQk55jTNmkFZ4HrfVweP46TEmpp3YIFoZ50b7nzwEVbfWX J23g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=aQhH9WKF; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=dA8jCy2Y; 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 n18si10467448pgb.91.2019.04.01.21.04.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Apr 2019 21:04:00 -0700 (PDT) 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=aQhH9WKF; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=dA8jCy2Y; 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=KuLN6APH1MF5Hkl5JzpcFN3fazN8KpVqneRw7+8p+rs=; b=aQhH9WKFgRM8CnBgjMZhlQaOw9 qDcMabduAilioeTeFc2Xp4tDjPFhgPoJ23RoO5qRfhsGDC08KUXlK9rVxVOoIClmB9CKH6aHnHGwf FsgeEGOlZF83aIgegCCTwz8RprAu9yvl1WDO4AyPPq/+gbGv+31lFugdt7hTO5m4srWyAMU7WgoX2 p3w92YpxCy7uEr27f+ILdY5Sq3bkzyVs+kCBEUiGqdZJBpx7E8af+Ff1CGGWcuQs/plZB/A05gTmy HbxrcX9kzx0v49j9annXd8FcVpDQbTgtNALXAl4VwuKd9TTxvnMKuiLbiYd82yu7/gUkrrX7oRCd3 NS+2v9CQ==; 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 1hBAeK-0008FN-DL; Tue, 02 Apr 2019 04:03:48 +0000 Received: from conuserg-07.nifty.com ([210.131.2.74]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBAeG-0008Cw-1C for linux-mtd@lists.infradead.org; Tue, 02 Apr 2019 04:03:45 +0000 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id x3243Hab021871; Tue, 2 Apr 2019 13:03:25 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x3243Hab021871 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554177807; bh=980FdvUomFNwVGg8bn0Nn0Bzbo9qhxxbdHbHtPN2Q0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dA8jCy2YPFzHxOwZ/7ESGIRn1rQ/xdG3j2V8+/X3yfXZGxWtBrgjYRpNID9LREdPL mcTfJzqzY7MJwNDZEcJ+lAoBIwGrFSESjIeTnFB9E0N0negwEbFHqXY9mjpSTcQcfD VPNCtft9gVeyuEUgH5DNoU3mcvXogF0WB0/PDxiyzQyx+YVTCS62WnVPAvmkKzOuo/ LpRVTj30ZDR5pfHx6wZKPPcg0QO1aMSOhMgd4O+bLKwyX0RBHvAOuCOjrm5NR/4x+m JhnWezias5Cdk+BkljMsnPgubEohKJrcEoobIvB7V8QFjnp6JULIB3Ypc/gQKbuTxG pwgtfd/jn+rEw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v5 8/9] mtd: rawnand: denali: remove DENALI_NR_BANKS macro Date: Tue, 2 Apr 2019 13:03:08 +0900 Message-Id: <1554177789-15414-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> References: <1554177789-15414-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_210344_365956_5088C824 X-CRM114-Status: GOOD ( 10.85 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 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 https://www.dnswl.org/, no trust [210.131.2.74 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [210.131.2.74 listed in wl.mailspike.net] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -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: Masahiro Yamada , Richard Weinberger , Boris Brezillon , linux-kernel@vger.kernel.org, Marek Vasut , Brian Norris , David Woodhouse MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org Use the runtime-detected denali->nbanks instead of hard-coded DENALI_NR_BANKS (=4). The actual number of banks depends on the IP configuration, and can be less than DENALI_NR_BANKS. It is pointless to touch registers of unsupported banks. Signed-off-by: Masahiro Yamada --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/denali.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 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 8722762..e918c3d 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -40,7 +40,6 @@ #define DENALI_BANK(denali) ((denali)->active_bank << 24) #define DENALI_INVALID_BANK -1 -#define DENALI_NR_BANKS 4 static struct denali_chip *to_denali_chip(struct nand_chip *chip) { @@ -92,7 +91,7 @@ static void denali_enable_irq(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) iowrite32(U32_MAX, denali->reg + INTR_EN(i)); iowrite32(GLOBAL_INT_EN_FLAG, denali->reg + GLOBAL_INT_ENABLE); } @@ -101,7 +100,7 @@ static void denali_disable_irq(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) iowrite32(0, denali->reg + INTR_EN(i)); iowrite32(0, denali->reg + GLOBAL_INT_ENABLE); } @@ -117,7 +116,7 @@ static void denali_clear_irq_all(struct denali_controller *denali) { int i; - for (i = 0; i < DENALI_NR_BANKS; i++) + for (i = 0; i < denali->nbanks; i++) denali_clear_irq(denali, i, U32_MAX); } @@ -130,7 +129,7 @@ static irqreturn_t denali_isr(int irq, void *dev_id) spin_lock(&denali->irq_lock); - for (i = 0; i < DENALI_NR_BANKS; i++) { + for (i = 0; i < denali->nbanks; i++) { irq_status = ioread32(denali->reg + INTR_STATUS(i)); if (irq_status) ret = IRQ_HANDLED;