From patchwork Fri Feb 8 08:08:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 157816 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1664691jaa; Fri, 8 Feb 2019 00:10:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IY12dDR0W7DUle/Qu3oqN8r6Zb1kYnWB5LNadn2A/sJy3/n9M/yy0xX0PIhwzjm4JyRw9IK X-Received: by 2002:a62:1d0c:: with SMTP id d12mr910841pfd.126.1549613456739; Fri, 08 Feb 2019 00:10:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549613456; cv=none; d=google.com; s=arc-20160816; b=gNBLYbIAWIC3tiXOXAawYS05gRKMxPfxBX6zKUJemcNKTMQWomdhSwKbJGUxRzthtu 5/b8ClWB/2ZUyxBTVypLbToS/3Iv5Jjf8oVs0qOMV2rA00rR46mJNLvfo8P0OzhfIhra rD5itnfK7GRYBca28pIC3auDrCHKJFfOm8FcQ/Z4aCdpoYrN+Wm/B/h5IEPip9tlrmn6 5uP9g0bppiUsc+Nk15cUkt7wbbctKihrs8p+HCyrV0GIoKyrwqF77ONB0ZhG9uM4QqO3 7d3Ub7xIE7hB++4yNchff2MRm9+Vl0ajvd/AaCXH/XP+4K78b5eY3cW0uuNEQTflq4E4 X7pA== 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; bh=4zRVCkg/JqYATaz8w/n52lDPh+nyy/86YNhKn3aIKXA=; b=xtcOnVW0kN1RCepvDcRPSDWcTvsqHpS6rsQTIrW9MBv4dvwjSBOnxQdAVAVfl3iuYD GtkmYtwzDQcaUSZGquRixJlHELwgd9PU3WYasl3t1rJohZ8HTkA9zOO1oisAvZN0MgDH COtlv7MgxVNVuatwQUKlFG8gPYNBE8kaiseRPGnZJAKVvbYZORBrRclQBr9a/bRkPM73 71iNOU1bxmvfX3k0O8ZRDas8LGeERwE8mjKsghzYDMbioSuRMLBKtbtLU45hFWQuc2UC 8NmiFU5U+tvnVS9Sy9KznIkUElmxolro1SctEgHs0GisWZ1QsoP08ZMP8N/Gy/efHe/7 7kFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=1AlivkQe; 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 g10si1547771plq.371.2019.02.08.00.10.56; Fri, 08 Feb 2019 00:10:56 -0800 (PST) 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 header.s=dec2015msa header.b=1AlivkQe; 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 S1727475AbfBHIKu (ORCPT + 31 others); Fri, 8 Feb 2019 03:10:50 -0500 Received: from conuserg-07.nifty.com ([210.131.2.74]:62766 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727447AbfBHIKr (ORCPT ); Fri, 8 Feb 2019 03:10:47 -0500 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 x188902J007241; Fri, 8 Feb 2019 17:09:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com x188902J007241 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1549613351; bh=4zRVCkg/JqYATaz8w/n52lDPh+nyy/86YNhKn3aIKXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1AlivkQeB0sqZjn/QVpg2ses5Md81TmQiFxy8v0qYX8DNda0iSLNKnKh/BdUGS/Ng PvioLXEseYNivXfAcgoozn/yul2ZYHBdVfoo42iXYIRSZZ4rhGwWF1e+0hfpPbyYW4 LvhAIhhdgCAMvPTWnSuJ2M/shuqrOwZ09PyzljFReunCDc0Y30DXikWlqjXdsVZc2n M2d8BmpHSMUQNwiUp70osAcftlAbskNGvQIln1uPI9DtVe7qwLCZOenNFAik4vGTIo absSn3pdCamgM+dPVuZ+whP71kTt3gmkd2fm1CoIWiZZPwumXFnuodI9eETzo6nDea +qLQzggiCgelw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org, Miquel Raynal Cc: Boris Brezillon , Masahiro Yamada , Brian Norris , linux-kernel@vger.kernel.org, Marek Vasut , Richard Weinberger , David Woodhouse Subject: [PATCH 10/11] mtd: rawnand: denali: remove DENALI_NR_BANKS macro Date: Fri, 8 Feb 2019 17:08:54 +0900 Message-Id: <1549613335-30319-11-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549613335-30319-1-git-send-email-yamada.masahiro@socionext.com> References: <1549613335-30319-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 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 --- drivers/mtd/nand/raw/denali.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index 84dac9f..ce3a4bb 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_stat = ioread32(denali->reg + INTR_STATUS(i)); if (irq_stat) ret = IRQ_HANDLED;