From patchwork Mon Jul 25 16:09:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jamie Iles X-Patchwork-Id: 1005422 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6PGBImR000547 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 25 Jul 2011 16:11:39 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QlNk0-00080o-BE; Mon, 25 Jul 2011 16:10:48 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QlNjz-0001b2-6O; Mon, 25 Jul 2011 16:10:47 +0000 Received: from mail-ww0-f49.google.com ([74.125.82.49]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QlNjN-0001U6-4c for linux-arm-kernel@lists.infradead.org; Mon, 25 Jul 2011 16:10:11 +0000 Received: by wwf22 with SMTP id 22so3073578wwf.18 for ; Mon, 25 Jul 2011 09:10:07 -0700 (PDT) Received: by 10.216.229.165 with SMTP id h37mr645873weq.69.1311610206957; Mon, 25 Jul 2011 09:10:06 -0700 (PDT) Received: from localhost (gw-ba1.picochip.com [94.175.234.108]) by mx.google.com with ESMTPS id k9sm3506850weq.27.2011.07.25.09.10.06 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 09:10:06 -0700 (PDT) From: Jamie Iles To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] vic: add device tree bindings Date: Mon, 25 Jul 2011 17:09:58 +0100 Message-Id: <1311610200-12408-2-git-send-email-jamie@jamieiles.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1311610200-12408-1-git-send-email-jamie@jamieiles.com> References: <1311610200-12408-1-git-send-email-jamie@jamieiles.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110725_121009_412809_96E8439A X-CRM114-Status: GOOD ( 18.73 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.49 listed in list.dnswl.org] Cc: Jamie Iles , devicetree-discuss@lists.ozlabs.org, Russell King X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 25 Jul 2011 16:11:39 +0000 (UTC) Allow the VIC to be used from device tree. This adds vic_of_init() that finds all compatible controllers in the device tree creating irq domains and initialising the VIC. We use of_iomap() for the IO mapping, but allow the entry functions in arch/arm/include/asm/entry-macro-vic2.S to be used, this requires that a static mapping is configured on the platform. Cc: Russell King Cc: devicetree-discuss@lists.ozlabs.org Signed-off-by: Jamie Iles --- Documentation/devicetree/bindings/arm/vic.txt | 21 +++++++++++++++ arch/arm/common/vic.c | 35 +++++++++++++++++++++++++ arch/arm/include/asm/hardware/vic.h | 5 +++ 3 files changed, 61 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/vic.txt diff --git a/Documentation/devicetree/bindings/arm/vic.txt b/Documentation/devicetree/bindings/arm/vic.txt new file mode 100644 index 0000000..be5abc9 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/vic.txt @@ -0,0 +1,21 @@ +ARM Vectored Interrupt Controller + +Some ARM cores may contain a vectored interrupt controller (VIC). This +controller is represented in the device tree with: + +Required properties: + - #interrupt-cells : <1> (32 interrupt sources supported) + - compatible : "arm,pl190-vic", "arm,pl192-vic", "arm-vic" + - reg : Offset and length of the register set for this device + - interrupt-controller + - irq-start : The first interrupt number that the VIC services + +Example ARM VIC node: + +vic0@60000 { + compatible = "arm,pl192-vic"; + interrupt-controller; + reg = <0x60000 0x1000>; + irq-start = <32>; + #interrupt-cells = <1>; +}; diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c index 7aa4262..5838b9f 100644 --- a/arch/arm/common/vic.c +++ b/arch/arm/common/vic.c @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include #include #include @@ -377,3 +380,35 @@ void __init vic_init(void __iomem *base, unsigned int irq_start, vic_pm_register(base, irq_start, resume_sources); } + +#ifdef CONFIG_OF +static const struct of_device_id arm_vic_ids[] __initconst = { + { .compatible = "arm,pl190-vic" }, + { .compatible = "arm,pl192-vic" }, + { .compatible = "arm,vic" }, + {}, +}; + +void __init vic_of_init(void) +{ + struct device_node *np; + + for_each_matching_node(np, arm_vic_ids) { + void __iomem *iobase; + u32 base_irq; + + iobase = of_iomap(np, 0); + + if (!iobase) + panic("Unable to map VIC"); + + if (of_property_read_u32(np, "irq-start", &base_irq)) + panic("No irq-start property defined"); + + of_node_put(np); + + vic_init(iobase, base_irq, ~0, 0); + irq_domain_add_simple(np, base_irq); + } +} +#endif /* CONFIG_OF */ diff --git a/arch/arm/include/asm/hardware/vic.h b/arch/arm/include/asm/hardware/vic.h index 5d72550..dbda2d1 100644 --- a/arch/arm/include/asm/hardware/vic.h +++ b/arch/arm/include/asm/hardware/vic.h @@ -42,6 +42,11 @@ #ifndef __ASSEMBLY__ void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources); +#ifdef CONFIG_OF +void vic_of_init(void); +#else /* CONFIG_OF */ +static inline void vic_of_init(void) {} +#endif /* CONFIG_OF */ #endif #endif