Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp99296imj; Thu, 14 Feb 2019 16:12:14 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia8TCYINr+/2kvYo1KN+gjx4iALjbP9bOzRln/CibXqd5nD57V0d9CCutqwqW+5bcmkYtVo X-Received: by 2002:a63:d54a:: with SMTP id v10mr2565565pgi.154.1550189534391; Thu, 14 Feb 2019 16:12:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550189534; cv=none; d=google.com; s=arc-20160816; b=AL+VesGnjAPV7W8nUOriObAGlPYFHzQRpIXKe+ULDiuEH2B1ksdNjlRe65OUX5aSZK bQcfkoiarRX3fpyXax508AnJKntfdTBmw66t68lmtt+sPyZhk5ROdB5x0ZEwsta3pM8+ u1DoCPfMLm7w9k3JDZ196oKGmKCFtaSDzOuJohxPOVp9nMoEPt1/FkvUgM1b8PqpjxXz h/JUPyXdOl3uzkEuD3ehFqXXV7sc1BcC0kkeEn4SvQQ2HyCbSMi1Zu7rRdcH4VHl+BZb YFVATR2NvcnnBcW1+V6wTLOkUmAXmMbJsydLaMqEtzoml/QcKm07kkEXGQa85aSZ++Hu 55QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YW/+k9BvoNkqcFFu2Jlt+OYGUXl4uq4KzMp9XtY9tko=; b=d9zp3N1gl7mvj1kpGMiIL2Oi/JW0CfSo1xsyFxIFffWTJgL9cbbTP5nxhJJbsLuOmU 5BYsYk5u8MGy3X4zBiPk2uahohvwpz0XUiBTPyWMaLqiVcP34lcAct1DmJ4tTBOEOY3O CnzwMz0Sbsnc54END25AfwiyHVMgzj0TyCaxGXypORUq1o/wtK0XhrjpDkWwxsREry/Y u36pNgY/tJyvSsdKme963Um3Ykh68bOpKgRdIDmOWIo3yxnPRcp9adzdq56uLpfEtLAg +4dR1KaqRq81Gc1doNlQr9NaImj1pOzQ6q0P9+OYUWwzfq8vLrBwCfd1km9lFNCm73Px e/ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="UBL/tSBs"; 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 b36si3726352pgl.596.2019.02.14.16.11.58; Thu, 14 Feb 2019 16:12:14 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="UBL/tSBs"; 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 S2439594AbfBNOxI (ORCPT + 99 others); Thu, 14 Feb 2019 09:53:08 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38029 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439561AbfBNOxF (ORCPT ); Thu, 14 Feb 2019 09:53:05 -0500 Received: by mail-wr1-f66.google.com with SMTP id v13so6788669wrw.5 for ; Thu, 14 Feb 2019 06:53:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YW/+k9BvoNkqcFFu2Jlt+OYGUXl4uq4KzMp9XtY9tko=; b=UBL/tSBs2kHJLlwyUxariLSuGxmgox+exDxh+8JIxWAsBdF1DR39dLNEcuitbXAAQQ FmQSeSFBfP9NE3opMKrGTX5k1rUAvyZCuORWLEIYCeEcyIbOVVBwHUmB785nlDR+L47C J8uTQANVhBdLEjLQQkgI5eI+FNS5O08MP7IyQrcyKECy9knF2cM0bkh5jLZHQwu2mwJY sXLwQyi33AEuiAov/LCsD6m8TnZAvW5oWGuEhv77o6/4MVBlBa9+pFbeCu3pfNO+uPQ8 LgPDy3BVeezHqyIy9eG9IYhIM+i8Gx3VzJXxcuMsl/E5XVRllmoeC8ERSFFr3VnH6V9B IumA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YW/+k9BvoNkqcFFu2Jlt+OYGUXl4uq4KzMp9XtY9tko=; b=UyJiQoLucVV4+BOKVFwGTlev7JBQyI6uCbnbyPuP+zf0Tek0htV1zdXjyo0h0EkYtu CPeXzjFywdN1eMa6rYp0NKi/fQ8O2CA2UgseNlkTmPRtkMnclouWil9HimPBmcvJ8MXf Q+9U5oGcIjJYPYGsCXz10urRLYWL4naRiPSm8bocricwZy7x92Wje6mUiTkScKDa6Lp9 uM8aVzTb6V3z1UJkzjKM9obq9vLeGwh55lpUGRH78q576qw5O7qlOap4oyaSPhsdNkCF z8hnQcGNuFJeYxg7BSLT2H6saW31jJtj5ABlpNwgokgaZ9pH4K5mG0ieHOSBnD1wzBDp YrvQ== X-Gm-Message-State: AHQUAub1z5T07/cutyUg3X+bvBhLdmENwxSolbQnJrUXeISZ18h3A7g8 cUTuBwQOds+4tvrjEOEzR/PEfw== X-Received: by 2002:a5d:540f:: with SMTP id g15mr3372516wrv.126.1550155983630; Thu, 14 Feb 2019 06:53:03 -0800 (PST) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id y20sm4181005wra.51.2019.02.14.06.53.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 06:53:03 -0800 (PST) From: Bartosz Golaszewski To: Dmitry Torokhov , Sekhar Nori , Kevin Hilman , Thomas Gleixner , Jason Cooper , Marc Zyngier , David Lechner Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 17/37] ARM: davinci: aintc: use the new config structure Date: Thu, 14 Feb 2019 15:52:11 +0100 Message-Id: <20190214145231.8750-18-brgl@bgdev.pl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214145231.8750-1-brgl@bgdev.pl> References: <20190214145231.8750-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski Modify the aintc driver to take all its configuration from the new config structure. Stop referencing davinci_soc_info in any way. Move the declaration for davinci_aintc_init() to irq-davinci-aintc.h and make it take the new config structure as parameter. Convert all users to the new version. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/dm355.c | 2 +- arch/arm/mach-davinci/dm365.c | 2 +- arch/arm/mach-davinci/dm644x.c | 2 +- arch/arm/mach-davinci/dm646x.c | 2 +- arch/arm/mach-davinci/include/mach/common.h | 2 -- arch/arm/mach-davinci/irq.c | 39 +++++++++++---------- include/linux/irqchip/irq-davinci-aintc.h | 2 ++ 7 files changed, 26 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index ff79c1a17fae..c7cd765114af 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c @@ -805,7 +805,7 @@ static const struct davinci_aintc_config dm355_aintc_config = { void __init dm355_init_irq(void) { - davinci_aintc_init(); + davinci_aintc_init(&dm355_aintc_config); } static int __init dm355_init_devices(void) diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index 44dc3ca94dd3..bde3c3b94cc9 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c @@ -1064,7 +1064,7 @@ static const struct davinci_aintc_config dm365_aintc_config = { void __init dm365_init_irq(void) { - davinci_aintc_init(); + davinci_aintc_init(&dm365_aintc_config); } static int __init dm365_init_devices(void) diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 0b0ecac36486..6d3498058283 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c @@ -741,7 +741,7 @@ static const struct davinci_aintc_config dm644x_aintc_config = { void __init dm644x_init_irq(void) { - davinci_aintc_init(); + davinci_aintc_init(&dm644x_aintc_config); } void __init dm644x_init_devices(void) diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 4e871d00e4e9..a0a8b336c1a4 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c @@ -702,7 +702,7 @@ static const struct davinci_aintc_config dm646x_aintc_config = { void __init dm646x_init_irq(void) { - davinci_aintc_init(); + davinci_aintc_init(&dm646x_aintc_config); } static int __init dm646x_init_devices(void) diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h index 8c9c011f96f6..14e0e1c40611 100644 --- a/arch/arm/mach-davinci/include/mach/common.h +++ b/arch/arm/mach-davinci/include/mach/common.h @@ -24,8 +24,6 @@ void davinci_timer_init(struct clk *clk); -extern void davinci_aintc_init(void); - struct davinci_timer_instance { u32 base; u32 bottom_irq; diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c index 509be44eda22..1b2eeddfabd1 100644 --- a/arch/arm/mach-davinci/irq.c +++ b/arch/arm/mach-davinci/irq.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -82,13 +83,14 @@ davinci_aintc_handle_irq(struct pt_regs *regs) } /* ARM Interrupt Controller Initialization */ -void __init davinci_aintc_init(void) +void __init davinci_aintc_init(const struct davinci_aintc_config *config) { - unsigned i, j; - const u8 *davinci_def_priorities = davinci_soc_info.intc_irq_prios; + unsigned int irq_off, reg_off, prio, shift; int ret, irq_base; + const u8 *prios; - davinci_aintc_base = ioremap(davinci_soc_info.intc_base, SZ_4K); + davinci_aintc_base = ioremap(config->reg.start, + resource_size(&config->reg)); if (WARN_ON(!davinci_aintc_base)) return; @@ -114,23 +116,21 @@ void __init davinci_aintc_init(void) davinci_aintc_writel(~0x0, DAVINCI_AINTC_IRQ_REG0); davinci_aintc_writel(~0x0, DAVINCI_AINTC_IRQ_REG1); - for (i = DAVINCI_AINTC_IRQ_INTPRI0_REG; - i <= DAVINCI_AINTC_IRQ_INTPRI7_REG; i += 4) { - u32 pri; - - for (j = 0, pri = 0; j < 32; j += 4, davinci_def_priorities++) - pri |= (*davinci_def_priorities & 0x07) << j; - davinci_aintc_writel(pri, i); + prios = config->prios; + for (reg_off = DAVINCI_AINTC_IRQ_INTPRI0_REG; + reg_off <= DAVINCI_AINTC_IRQ_INTPRI7_REG; reg_off += 4) { + for (shift = 0, prio = 0; shift < 32; shift += 4, prios++) + prio |= (*prios & 0x07) << shift; + davinci_aintc_writel(prio, reg_off); } - irq_base = irq_alloc_descs(-1, 0, davinci_soc_info.intc_irq_num, 0); + irq_base = irq_alloc_descs(-1, 0, config->num_irqs, 0); if (WARN_ON(irq_base < 0)) return; davinci_aintc_irq_domain = irq_domain_add_legacy(NULL, - davinci_soc_info.intc_irq_num, - irq_base, 0, &irq_domain_simple_ops, - NULL); + config->num_irqs, irq_base, 0, + &irq_domain_simple_ops, NULL); if (WARN_ON(!davinci_aintc_irq_domain)) return; @@ -140,10 +140,11 @@ void __init davinci_aintc_init(void) if (WARN_ON(ret)) return; - for (i = 0, j = 0; i < davinci_soc_info.intc_irq_num; - i += 32, j += 0x04) - davinci_aintc_setup_gc(davinci_aintc_base + j, - irq_base + i, 32); + for (irq_off = 0, reg_off = 0; + irq_off < config->num_irqs; + irq_off += 32, reg_off += 0x04) + davinci_aintc_setup_gc(davinci_aintc_base + reg_off, + irq_base + irq_off, 32); irq_set_handler(DAVINCI_INTC_IRQ(IRQ_TINT1_TINT34), handle_level_irq); set_handle_irq(davinci_aintc_handle_irq); diff --git a/include/linux/irqchip/irq-davinci-aintc.h b/include/linux/irqchip/irq-davinci-aintc.h index 2b2ace3c1b22..ea4e087fac98 100644 --- a/include/linux/irqchip/irq-davinci-aintc.h +++ b/include/linux/irqchip/irq-davinci-aintc.h @@ -22,4 +22,6 @@ struct davinci_aintc_config { u8 *prios; }; +void davinci_aintc_init(const struct davinci_aintc_config *config); + #endif /* _LINUX_IRQ_DAVINCI_AINTC_ */ -- 2.20.1