From patchwork Fri Mar 29 07:28:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161396 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1696369jan; Fri, 29 Mar 2019 00:29:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzu5+tdfWQCmJU+lxIoZVXq75FEOQUoF/zZ/Bv7koQpArQ4Li21j8kQ7H+tYAnRwWffaLEV X-Received: by 2002:aa7:9211:: with SMTP id 17mr45342953pfo.220.1553844545522; Fri, 29 Mar 2019 00:29:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553844545; cv=none; d=google.com; s=arc-20160816; b=m3fLUXo2Xg0riAZtbRHsHlbGIr79M34gZnZPw8oW3JHo2F5OrCVwdpsQeKY86Ktm+X rT0vPH+k5vkIMulMigwyo0XQcExNkAsGC4XoJBZNoT0XWLRfVLuCKtpeC7OB0UrXie9i jYyDbDRxOeBmf9OG2dGpWp8pim85SatkYkRnxpfBkrVEWoA3d5lnMPpZ6xfJP7fV0WxM mrYVEKNMMEasIxEcDneKRbxED8WfXgGSe+TIRd5OZ3hGEZ1z+hOJbW4kanSzjXnKH4Cp Hasum4K7jXYQvb561cBxDZRjuuhmZ+PAm6qWN+z0wlUp0jmJDXlydnoSEMaJSol+mtzR k7yw== 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=Rba8lziz4wyTHCRmPohWBX9w7VMq9yjc8vChPYioEqg=; b=jV/aa3sb3gJ+K3a1Xmre6sBtt0OsZzlntALBj6Uae87DR6itUizfEDY5Im76X7pS8T zndDCc6KWAUw7wnrlJ0KFhi4bfBBGMZ72TNu+ZkPlIMZ0C8hj24TArZcDCipkUEjypJD 04EdP+/poXlIBy0cP2xc9M20iZ3Yu8YKMPxbKi4zvBIKy9FZ6e/O5bTlYTFIlZKkWz2r XpcUoYTcPzEQc+cprEAOrhRRNKNzAUi0AnCe+Sji/2wR1sOvxfeMIhKQrztP2J+lpiyA V7FJGyvZbX+29sKh+0DjhynTnvAQNtNTe1y1507ZhWNF2XduJLi7iq68JDJvCJ4tZbj1 XVeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=quKsbt+F; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=th8r1i2+; 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 q6si1214738pgv.344.2019.03.29.00.29.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2019 00:29:05 -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=quKsbt+F; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=th8r1i2+; 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=Rba8lziz4wyTHCRmPohWBX9w7VMq9yjc8vChPYioEqg=; b=quKsbt+FddIoSeWi6Q5HoLbmnE kOFHbEM3gM4SU4RABSq8DEm3N+1zpjatZ3IGWnFIR2kx7QZ0D9Oxr3Yh+z5/1pujvhVy5OFGa8cPS CQDEjzoT7gbg6g8UVhxMuxPf8wlK2QOMqVb0jIW4uITtX2cz6rolRZEgXL0GeolxZIyVsVtGMGnBf NLdOm+ofD4A0RlP4D3QufcDnRbH+T7029W5EyVZlTWYHk8Xv2ETw5mfBRS55Za1OpzclygIe3ocFC 6E7xK5MKLOYU2WCdPQu/gMYNVmQLEdLhMxJVk4bThhspm+Lnk30KDbZ0kQHAPhRPHXW0SdgM9aWfV RvZEDbpQ==; 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 1h9lwb-0004SG-If; Fri, 29 Mar 2019 07:28:53 +0000 Received: from conuserg-10.nifty.com ([210.131.2.77]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9lwY-0004Q3-3Q for linux-mtd@lists.infradead.org; Fri, 29 Mar 2019 07:28:51 +0000 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-10.nifty.com with ESMTP id x2T7SQaF002537; Fri, 29 Mar 2019 16:28:35 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com x2T7SQaF002537 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1553844516; bh=P6nAEpSTptxVwF6npdz1nlZ/dvqEunlZJ0obGeCKvZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=th8r1i2+a2zln0j9kTQYqaeuf4y0Z1EB5HdND9w8CxVyYXnX/MRnjLuukzhQhyVaJ Tywo013QZOiJjFaokK7B8U/dFcWE0TqO90yJmcw1qSTsYRtK4MWcPGratgKJL5Cc5T sO6cxmLNWL5vXTPKsE+mnXGiy63XHtv7HWwmo2HPY1xGwLcFt7BFg1Lr9TO7TDz/fR Th9PEMpzum3noSK2q3A/zIcYfb01138vdRNJ46zMl2YPzzyI62iP8U4lihkOp9RO+n g76iALn9B8ReI1QbCw8jey5BlW/h6v7Wt6hXwZADS02grSJ4bVrX4UJd0GeccDWgHt 1chK/wGUKn6kQ== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Subject: [PATCH v4 8/9] mtd: rawnand: denali: remove DENALI_NR_BANKS macro Date: Fri, 29 Mar 2019 16:28:20 +0900 Message-Id: <1553844501-7119-9-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553844501-7119-1-git-send-email-yamada.masahiro@socionext.com> References: <1553844501-7119-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190329_002850_449255_81FCD24F X-CRM114-Status: GOOD ( 10.22 ) 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.77 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 , Boris Brezillon , 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 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 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 687feab..6d0ee5e 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;