From patchwork Thu Oct 6 21:11:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 4560 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5182723DEC for ; Thu, 6 Oct 2011 21:11:19 +0000 (UTC) Received: from mail-gx0-f180.google.com (mail-gx0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 098DAA18DDE for ; Thu, 6 Oct 2011 21:11:18 +0000 (UTC) Received: by ggni2 with SMTP id i2so3235855ggn.11 for ; Thu, 06 Oct 2011 14:11:18 -0700 (PDT) Received: by 10.223.5.3 with SMTP id 3mr5956697fat.4.1317935478159; Thu, 06 Oct 2011 14:11:18 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.23.170 with SMTP id n10cs144524laf; Thu, 6 Oct 2011 14:11:17 -0700 (PDT) Received: by 10.68.36.99 with SMTP id p3mr8361942pbj.61.1317935476574; Thu, 06 Oct 2011 14:11:16 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id f2si7713908pbh.69.2011.10.06.14.11.15; Thu, 06 Oct 2011 14:11:16 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.33; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.33 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm2.samsung.com (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LSN0038DXIF0Q10@mailout3.samsung.com> for patches@linaro.org; Fri, 07 Oct 2011 06:11:14 +0900 (KST) X-AuditID: cbfee61b-b7b7fae000005864-be-4e8e19725f7e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id 03.83.22628.2791E8E4; Fri, 07 Oct 2011 06:11:14 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp1.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTPA id <0LSN0021GXIH8X80@mmp1.samsung.com> for patches@linaro.org; Fri, 07 Oct 2011 06:11:14 +0900 (KST) From: Thomas Abraham To: devicetree-discuss@lists.ozlabs.org Cc: grant.likely@secretlab.ca, rob.herring@calxeda.com, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, linux-arm-kernel@lists.infradead.org, patches@linaro.org Subject: [PATCH 2/2] arm: exynos4: add support for dt irq specifier to linux virq conversion Date: Fri, 07 Oct 2011 02:41:43 +0530 Message-id: <1317935503-11756-3-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1317935503-11756-1-git-send-email-thomas.abraham@linaro.org> References: <1317935503-11756-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== Add support for conversion of device tree interrupt specifier to linux virq domain for GIC and Interrupt combiner controllers. Cc: Rob Herring Cc: Grant Likely Signed-off-by: Thomas Abraham --- arch/arm/mach-exynos4/cpu.c | 20 ++++++++++++++- arch/arm/mach-exynos4/irq-combiner.c | 44 ++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c index 1c5e803..9898f9c 100644 --- a/arch/arm/mach-exynos4/cpu.c +++ b/arch/arm/mach-exynos4/cpu.c @@ -10,6 +10,8 @@ #include #include +#include +#include #include #include @@ -38,6 +40,8 @@ unsigned int gic_bank_offset __read_mostly; extern int combiner_init(unsigned int combiner_nr, void __iomem *base, unsigned int irq_start); extern void combiner_cascade_irq(unsigned int combiner_nr, unsigned int irq); +extern void combiner_init_dt(struct device_node *node, + struct device_node *parent); /* Initial IO mappings */ static struct map_desc exynos4_iodesc[] __initdata = { @@ -218,13 +222,27 @@ static void exynos4_gic_irq_fix_base(struct irq_data *d) (gic_bank_offset * smp_processor_id()); } +#ifdef CONFIG_OF +static const struct of_device_id exynos4_dt_irq_match[] = { + { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, }, + { .compatible = "samsung,exynos4-combiner", .data = combiner_init_dt, }, + {}, +}; +#endif + void __init exynos4_init_irq(void) { int irq; gic_bank_offset = soc_is_exynos4412() ? 0x4000 : 0x8000; - gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU); +#ifdef CONFIG_OF + if (of_have_populated_dt()) + of_irq_init(exynos4_dt_irq_match); + else +#endif + gic_init(0, IRQ_PPI(0), S5P_VA_GIC_DIST, S5P_VA_GIC_CPU); + gic_arch_extn.irq_eoi = exynos4_gic_irq_fix_base; gic_arch_extn.irq_unmask = exynos4_gic_irq_fix_base; gic_arch_extn.irq_mask = exynos4_gic_irq_fix_base; diff --git a/arch/arm/mach-exynos4/irq-combiner.c b/arch/arm/mach-exynos4/irq-combiner.c index 5a2758a..d2d143a 100644 --- a/arch/arm/mach-exynos4/irq-combiner.c +++ b/arch/arm/mach-exynos4/irq-combiner.c @@ -13,6 +13,10 @@ */ #include +#include +#include +#include +#include #include @@ -122,3 +126,43 @@ void __init combiner_init(unsigned int combiner_nr, void __iomem *base, set_irq_flags(i, IRQF_VALID | IRQF_PROBE); } } + +#ifdef CONFIG_OF +/* Translate dt irq specifier to linux virq for interrupt combiner controller */ +static int exynos4_irq_domain_combiner_dt_translate(struct irq_domain *d, + struct device_node *controller, + const u32 *intspec, unsigned int intsize, + unsigned long *out_hwirq, unsigned int *out_type) +{ + if (d->of_node != controller) + return -EINVAL; + if (intsize < 2) + return -EINVAL; + + *out_hwirq = COMBINER_IRQ(intspec[0], intspec[1]); + *out_type = IRQ_TYPE_NONE; + return 0; +} + +static struct irq_domain_ops exynos4_irq_domain_combiner_ops = { + .dt_translate = exynos4_irq_domain_combiner_dt_translate, +}; + +void __init combiner_init_dt(struct device_node *node, + struct device_node *parent) +{ + struct irq_domain *domain; + + if (WARN(!node, "combiner_init_dt: invalid node in parameter\n")) + return; + + domain = kzalloc(sizeof(*domain), GFP_KERNEL); + if (domain) { + domain->of_node = node; + domain->ops = &exynos4_irq_domain_combiner_ops; + irq_domain_add(domain); + } else { + WARN_ON(1); + } +} +#endif