From patchwork Wed Feb 22 12:14:18 2012 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: 6884 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 0DF6F1CCAC5 for ; Wed, 22 Feb 2012 12:08:12 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id C2BFDA186DE for ; Wed, 22 Feb 2012 12:08:11 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id z7so14332530iab.11 for ; Wed, 22 Feb 2012 04:08:11 -0800 (PST) Received: from mr.google.com ([10.42.131.129]) by 10.42.131.129 with SMTP id z1mr31825083ics.53.1329912491624 (num_hops = 1); Wed, 22 Feb 2012 04:08:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.131.129 with SMTP id z1mr25498309ics.53.1329912491556; Wed, 22 Feb 2012 04:08:11 -0800 (PST) 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.231.11.10 with SMTP id r10csp133318ibr; Wed, 22 Feb 2012 04:08:11 -0800 (PST) Received: by 10.68.72.138 with SMTP id d10mr73166496pbv.15.1329912490895; Wed, 22 Feb 2012 04:08:10 -0800 (PST) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id t9si28568541pbv.115.2012.02.22.04.08.10; Wed, 22 Feb 2012 04:08:10 -0800 (PST) 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 epcpsbgm1.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 <0LZS001Z0N0P8LB0@mailout3.samsung.com> for patches@linaro.org; Wed, 22 Feb 2012 21:08:09 +0900 (KST) X-AuditID: cbfee61a-b7b78ae000001ceb-32-4f44daa90f79 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (MMPCPMTA) with SMTP id D7.25.07403.9AAD44F4; Wed, 22 Feb 2012 21:08:09 +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 <0LZS00GJLN166U60@mmp1.samsung.com> for patches@linaro.org; Wed, 22 Feb 2012 21:08:09 +0900 (KST) From: Thomas Abraham To: linux-samsung-soc@vger.kernel.org Cc: devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, grant.likely@secretlab.ca, rob.herring@calxeda.com, kgene.kim@samsung.com, patches@linaro.org Subject: [PATCH v3 4/4] ARM: Exynos4: Add device tree support for gpio wakeup interrupt controller Date: Wed, 22 Feb 2012 17:44:18 +0530 Message-id: <1329912858-32750-5-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1329912858-32750-1-git-send-email-thomas.abraham@linaro.org> References: <1329912858-32750-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== X-Gm-Message-State: ALoCoQlEr0CB4bWdXVRZUhq/ad82ZsTQzFymVh3K+7/iHBx18IXOQn/48qyYhz/U4jle8NQm0Buy Add device tree support for gpio wakeup source interrupt controller on Exynos4. Cc: Rob Herring Cc: Grant Likely Signed-off-by: Thomas Abraham Acked-by: Rob Herring --- .../bindings/arm/samsung/wakeup-eint.txt | 37 +++++++++++++++++ arch/arm/mach-exynos/common.c | 43 +++++++++++++------ 2 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt diff --git a/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt b/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt new file mode 100644 index 0000000..ac9db41 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/samsung/wakeup-eint.txt @@ -0,0 +1,37 @@ +* Samsung Exynos4 GPIO Wakeup Interrupt Source Controller + +Samsung Exynos4 processor supports 32 external wakeup interrupt sources. First +16 of these interrupts are directly connected to GIC and the rest 16 of the +interrupts are grouped together to deliver a single interrupt to GIC. + +Required properties: + +- compatible: should be "samsung,exynos4210-wakeup-eint". +- interrupt-controller: Identifies the node as an interrupt controller. +- interrupt-cells: Specifies the number of cells required to specify the + interrupt source number. The value of should be <2>. The first cell + represents the wakeup interrupt source number and the second cell + should be zero (currently unused). +- interrupts: List of interrupts generated by the gpio wakeup interrupt + controller which are connected to a parent interrupt controller. The + format of the interrupt specifier depends on the interrupt parent + controller. + +Optional properties: +- interrupt-parent: phandle of the parent interrupt controller, required if + not inheriting the interrupt parent from the parent node. + +Example: + + The following example is from the Exynos4210 dtsi file. + + wakeup_eint: interrupt-controller-wakeup-eint { + compatible = "samsung,exynos4210-wakeup-eint"; + #interrupt-cells = <2>; + interrupt-controller; + interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>, + <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>, + <0 24 0>, <0 25 0>, <0 26 0>, <0 27 0>, + <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>, + <0 32 0>; + }; diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c index 888e703..615168e 100644 --- a/arch/arm/mach-exynos/common.c +++ b/arch/arm/mach-exynos/common.c @@ -49,6 +49,9 @@ #include "common.h" +static int exynos4_init_irq_eint(struct device_node *np, + struct device_node *parent); + static const char name_exynos4210[] = "EXYNOS4210"; static const char name_exynos4212[] = "EXYNOS4212"; static const char name_exynos4412[] = "EXYNOS4412"; @@ -81,8 +84,6 @@ static struct cpu_table cpu_ids[] __initdata = { }, }; -static int exynos4_init_irq_eint(void); - /* Initial IO mappings */ static struct map_desc exynos_iodesc[] __initdata = { @@ -461,6 +462,8 @@ static const struct of_device_id exynos4_dt_irq_match[] = { { .compatible = "arm,cortex-a9-gic", .data = gic_of_init, }, { .compatible = "samsung,exynos4210-combiner", .data = combiner_of_init, }, + { .compatible = "samsung,exynos4210-wakeup-eint", + .data = exynos4_init_irq_eint, }, {}, }; #endif @@ -478,8 +481,10 @@ void __init exynos4_init_irq(void) of_irq_init(exynos4_dt_irq_match); #endif - if (!of_have_populated_dt()) + if (!of_have_populated_dt()) { combiner_init(S5P_VA_COMBINER_BASE, NULL); + exynos4_init_irq_eint(NULL, NULL); + } /* * The parameters of s5p_init_irq() are for VIC init. @@ -487,7 +492,6 @@ void __init exynos4_init_irq(void) * uses GIC instead of VIC. */ s5p_init_irq(NULL, 0); - exynos4_init_irq_eint(); } struct bus_type exynos4_subsys = { @@ -745,9 +749,20 @@ static struct irq_domain_ops exynos4_eint_irq_domain_ops = { .map = exynos4_eint_irq_domain_map, }; -static int __init exynos4_init_irq_eint(void) +static int __init exynos4_eint_to_irq(struct device_node *np, int hwirq) +{ +#ifdef CONFIG_OF + return np ? irq_of_parse_and_map(np, hwirq) : + exynos4_irq_eint_to_gic_irq(hwirq); +#else + return exynos4_irq_eint_to_gic_irq(hwirq); +#endif +} + +static int __init exynos4_init_irq_eint(struct device_node *np, + struct device_node *parent) { - int eint, irq_base; + int eint, irq_base, irq; struct irq_domain *irq_domain; irq_base = irq_alloc_descs(IRQ_EINT(0), 1, EXYNOS4_EINT_NR, 0); @@ -757,7 +772,7 @@ static int __init exynos4_init_irq_eint(void) "Continuing with %d as linux irq base\n", irq_base); } - irq_domain = irq_domain_add_legacy(NULL, EXYNOS4_EINT_NR, irq_base, 0, + irq_domain = irq_domain_add_legacy(np, EXYNOS4_EINT_NR, irq_base, 0, &exynos4_eint_irq_domain_ops, NULL); if (WARN_ON(!irq_domain)) { pr_warning("exynos4_init_irq_eint: irq domain init failed\n"); @@ -765,16 +780,16 @@ static int __init exynos4_init_irq_eint(void) } eint_data.irq_domain = irq_domain; - eint_data.gic_irq_base = exynos4_irq_eint_to_gic_irq(0); + eint_data.gic_irq_base = exynos4_eint_to_irq(np, 0); for (eint = 0 ; eint <= 15 ; eint++) { - irq_set_handler_data(exynos4_irq_eint_to_gic_irq(eint), - &eint_data); - irq_set_chained_handler(exynos4_irq_eint_to_gic_irq(eint), - exynos4_irq_eint0_15); + irq = exynos4_eint_to_irq(np, eint); + irq_set_handler_data(irq, &eint_data); + irq_set_chained_handler(irq, exynos4_irq_eint0_15); } - irq_set_chained_handler(IRQ_EINT16_31, exynos4_irq_demux_eint16_31); - irq_set_handler_data(IRQ_EINT16_31, &eint_data); + irq = exynos4_eint_to_irq(np, eint); + irq_set_chained_handler(irq, exynos4_irq_demux_eint16_31); + irq_set_handler_data(irq, &eint_data); return 0; }