Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp106084imj; Thu, 14 Feb 2019 16:22:17 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib8erf5iM7RZatkBfttbs26ygFemhKSt3AKHrbp0XKf3ydpWG7TCAmdWy8udcisksaNW0lv X-Received: by 2002:a62:5444:: with SMTP id i65mr7050381pfb.193.1550190137217; Thu, 14 Feb 2019 16:22:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550190137; cv=none; d=google.com; s=arc-20160816; b=apaZUr3Jtma5YAwqG+rdD2ES85/1wapNX98YnpA6L6jLTDJ3N3lHJMKsRNylr/nRYO nIYZG5Fuhzj56mIzU3yrLHlxAxC0IU1Z1GPGQTyqE8FYDVktibqGAFF7JckFKc4xSmux DkliYnak7MUXQmeRiUhnsr3N0+9R14nyhX0X5owpfsD6tuCVOW4f19FF+VFCdW4hK8PG aHC+BkOsbuAzNtUMg7LTDwij2cJQl+P4yrnmAFGe+Fr2HSn7JG8sNNn7wFHaA0hGwJJu faL1wS5RTL3wiC2xlaaS1F2h0lIQ6XdlaXBlrdobSMe6HpsgJKAjhOFOX+d7OA/c5bKL R+3Q== 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=M5s8LgF6tZAAsjgatoDHdRTjLQOzD7FAKkqTEC3Dngk=; b=Ha6xlqIuH17OExIGyrAFY6WxwWHQ+9dNfeIJ9MVA0p1+1GapJfgXXqzn5Y35Hn/Wz+ aHejPcJAubQRWnzCxdJKywghOaRTffSckghF/T2K5YKjdGrWvn4NrI0ic2jCCN6/idVm HCPfjmccxWuPTVEp7ezznxHYNf/YBJ37HzPsM+tK7advT3CEJsFPzCa/C9AgI0tQKDyi RhSqNTCO3D9Xo8XiNzSgF9GZPqglE/Be9fxbrzT9pInboSC+nr9ZrIUojEjKtBuk25sS LNaUk9k2fxilD4j7KdlLmyszKUWYcYNyLBvcBoAvdRYtE9zaSsQqI1LaxWPzbbeZimSc Qu4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=BqkA7cFg; 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 i30si3679608pgm.76.2019.02.14.16.22.01; Thu, 14 Feb 2019 16:22:17 -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=BqkA7cFg; 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 S2391300AbfBNO4X (ORCPT + 99 others); Thu, 14 Feb 2019 09:56:23 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42874 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439446AbfBNOwr (ORCPT ); Thu, 14 Feb 2019 09:52:47 -0500 Received: by mail-wr1-f65.google.com with SMTP id q18so6768283wrx.9 for ; Thu, 14 Feb 2019 06:52:46 -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=M5s8LgF6tZAAsjgatoDHdRTjLQOzD7FAKkqTEC3Dngk=; b=BqkA7cFgY5eQZK7myk8BKxWfGkvj9AutRjzEtoyt1z8IetYbkItoh3f7UuvdeqD6K1 sVr784C5j3xCUGprBkB/fQ0iANsaCu/UTxfxE8x8TWP3NYX2PD62Z+IODyAYNYPxK9Dj lqyAwEVKi8jJyOm3JY2uQcl2Yw79QGcJ9IV82PLhySB74KpqPhJJGXHIVHMlrL+UTwvq PHEPHkDaGcO9TQudMMs+RBi3kqhjnmfV5bKV+YCiyhT7xLu5FPAJHmFZ68eIYBbccpm4 IRnUQAPN8WH36JIw6g5eFxBS73Q2quU6joKwBAQIsIqv4+n2YLg9dz4S7JgsiR3Dv3lD K8Kw== 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=M5s8LgF6tZAAsjgatoDHdRTjLQOzD7FAKkqTEC3Dngk=; b=G5K6b/7lYdRmRq/FmpMjbv5rkX+JjqrYM1dz2buJ9ONG03jSpWaYhj8TShzTRy820W qBrH1sp/Xu/9psrKvCOXR7NTtSfc0qfjIufu+BCV98EhBWD+mUvjnE5UKflWeGGSCztC sCEtssm+xTJSL88w4uuc21ObzbUeUCuFB2CWZc4y44DTHAfXXPaLC59opVLwMV4nYm5L ZFNsYVIeO1ZoVMqCYVE5bIYr1JVdo/bIB8F6LfkjU9gQu7fHig4m8B2a++7ZE6RtbkbI mM3ok6Dk9ynzsAth25OJ7jjEHlLgkOQw5xSwlKB2Shj0ShAhdJFCgwXudT+n1cNL04ec ygFw== X-Gm-Message-State: AHQUAuZtWz0FPm5i7sLWUQb/W6kxcAo7Da5PNXi3P8fVr7Hk0LUDa3OD Qx4crY36iaoUAN4LhQjBNiUM1A== X-Received: by 2002:adf:dfca:: with SMTP id q10mr3265081wrn.45.1550155965831; Thu, 14 Feb 2019 06:52:45 -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.52.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 06:52:45 -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 03/37] ARM: davinci: aintc: use irq domain Date: Thu, 14 Feb 2019 15:51:57 +0100 Message-Id: <20190214145231.8750-4-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 We need to create an irq domain if we want to select SPARSE_IRQ. The cp-intc driver already supports it, but aintc doesn't. Use the helpers provided by the generic irq chip abstraction. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/irq.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c index 952dc126c390..efba6dbdfd62 100644 --- a/arch/arm/mach-davinci/irq.c +++ b/arch/arm/mach-davinci/irq.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -40,23 +41,23 @@ #define IRQ_INTPRI0_REG_OFFSET 0x0030 #define IRQ_INTPRI7_REG_OFFSET 0x004C +static struct irq_domain *davinci_irq_domain; + static inline void davinci_irq_writel(unsigned long value, int offset) { __raw_writel(value, davinci_intc_base + offset); } static __init void -davinci_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num) +davinci_irq_setup_gc(void __iomem *base, + unsigned int irq_start, unsigned int num) { struct irq_chip_generic *gc; struct irq_chip_type *ct; - gc = irq_alloc_generic_chip("AINTC", 1, irq_start, base, handle_edge_irq); - if (!gc) { - pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n", - __func__, irq_start); - return; - } + gc = irq_get_domain_generic_chip(davinci_irq_domain, irq_start); + gc->reg_base = base; + gc->irq_base = irq_start; ct = gc->chip_types; ct->chip.irq_ack = irq_gc_ack_set_bit; @@ -74,6 +75,7 @@ void __init davinci_irq_init(void) { unsigned i, j; const u8 *davinci_def_priorities = davinci_soc_info.intc_irq_prios; + int ret, irq_base; davinci_intc_type = DAVINCI_INTC_TYPE_AINTC; davinci_intc_base = ioremap(davinci_soc_info.intc_base, SZ_4K); @@ -110,8 +112,25 @@ void __init davinci_irq_init(void) davinci_irq_writel(pri, i); } + irq_base = irq_alloc_descs(-1, 0, davinci_soc_info.intc_irq_num, 0); + if (WARN_ON(irq_base < 0)) + return; + + davinci_irq_domain = irq_domain_add_legacy(NULL, + davinci_soc_info.intc_irq_num, + irq_base, 0, &irq_domain_simple_ops, + NULL); + if (WARN_ON(!davinci_irq_domain)) + return; + + ret = irq_alloc_domain_generic_chips(davinci_irq_domain, 32, 1, + "AINTC", handle_edge_irq, + IRQ_NOREQUEST | IRQ_NOPROBE, 0, 0); + if (WARN_ON(ret)) + return; + for (i = 0, j = 0; i < davinci_soc_info.intc_irq_num; i += 32, j += 0x04) - davinci_alloc_gc(davinci_intc_base + j, i, 32); + davinci_irq_setup_gc(davinci_intc_base + j, irq_base + i, 32); irq_set_handler(IRQ_TINT1_TINT34, handle_level_irq); } -- 2.20.1