From patchwork Wed Jun 1 16:37:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 840802 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p51Gd9VJ008795 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 1 Jun 2011 16:39:30 GMT Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRoRN-0001K1-8w; Wed, 01 Jun 2011 16:38:41 +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 1QRoRN-0007F9-2d; Wed, 01 Jun 2011 16:38:41 +0000 Received: from mail-yx0-f177.google.com ([209.85.213.177]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QRoQq-00077u-MZ for linux-arm-kernel@lists.infradead.org; Wed, 01 Jun 2011 16:38:09 +0000 Received: by yxh35 with SMTP id 35so2760250yxh.36 for ; Wed, 01 Jun 2011 09:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:date:message-id:x-mailer :in-reply-to:references; bh=thje489saU55EHBsZ2Z+CCUJvPKyPQhUh3+WCHTg0ks=; b=SIbTGLon1gLs2GgyqkE3Y9uW24WnebfNhngX3fLaD04oHGOvr0AFKwCMGMrveHg7sn AlQ9tVxHA10XiHrQ7DoTTcVjS4oN3YvfnKsEAqcsdQpqAO5PdAHbeuv6Pzr1bck7Ep2n 2G28d0KvABUNMODJNtwdhUqomQJ0+AC6CyFG4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; b=n57kXKYwEH9ZHtZkQeyZ8SRtPO+rIaZzXd0Viltqll7ioqkDsD3LSvstsFZONkGhWn jf8S+XI3mfs6RnU0duqWrQXGZ4FUPpvVlQESlmzAF3SKjqtnWKTNFiENKLe8ilzDjUAs PnvMnJWR/DTgAHxWLzQYJeYmRc3HjrZUnF1Bw= Received: by 10.101.166.1 with SMTP id t1mr4834547ano.43.1306946286293; Wed, 01 Jun 2011 09:38:06 -0700 (PDT) Received: from rob-laptop.i.smooth-stone.com ([173.226.190.126]) by mx.google.com with ESMTPS id t27sm802923anh.1.2011.06.01.09.38.05 (version=SSLv3 cipher=OTHER); Wed, 01 Jun 2011 09:38:05 -0700 (PDT) From: Rob Herring To: devicetree-discuss@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] ARM: gic: add OF based initialization Date: Wed, 1 Jun 2011 11:37:49 -0500 Message-Id: <1306946270-18379-3-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1306946270-18379-1-git-send-email-robherring2@gmail.com> References: <1306946270-18379-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110601_123809_052263_64932C11 X-CRM114-Status: GOOD ( 13.11 ) X-Spam-Score: 1.4 (+) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.213.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (robherring2[at]gmail.com) 2.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (robherring2[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 RFC_ABUSE_POST Both abuse and postmaster missing on sender domain 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL 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]); Wed, 01 Jun 2011 16:39:30 +0000 (UTC) From: Rob Herring This adds gic initialization using device tree data. An example device tree binding looks like this: intc: interrupt-controller@fff11000 { compatible = "arm,cortex-a9-gic"; #interrupt-cells = <1>; interrupt-controller; reg = <0xfff11000 0x1000>, <0xfff10100 0x100>; irq-start = <29>; }; Signed-off-by: Rob Herring --- arch/arm/common/gic.c | 35 +++++++++++++++++++++++++++++++++++ arch/arm/include/asm/hardware/gic.h | 1 + 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index 4ddd0a6..d44ca5b 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -401,3 +403,36 @@ void gic_raise_softirq(const struct cpumask *mask, unsigned int irq) writel_relaxed(map << 16 | irq, gic_data[0].dist_base + GIC_DIST_SOFTINT); } #endif + +#ifdef CONFIG_OF +static struct of_device_id gic_ids[] __initdata = { + { .compatible = "arm,cortex-a9-gic" }, +}; + +void __init gic_of_init(void) +{ + struct device_node *np; + void __iomem *cpu_base; + void __iomem *dist_base; + __u32 irq_start = 16; + const __be32 *val; + + np = of_find_matching_node(NULL, gic_ids); + if (!np) + panic("unable to find compatible gic node in dtb\n"); + + dist_base = of_iomap(np, 0); + if (!dist_base) + panic("unable to map gic dist registers\n"); + + cpu_base = of_iomap(np, 1); + if (!cpu_base) + panic("unable to map gic cpu registers\n"); + + if ((val = of_get_property(np, "irq-start", NULL)) != NULL) + irq_start = of_read_ulong(val, 1); + of_node_put(np); + + gic_init(0, irq_start, dist_base, cpu_base); +} +#endif diff --git a/arch/arm/include/asm/hardware/gic.h b/arch/arm/include/asm/hardware/gic.h index 0691f9d..954a08e 100644 --- a/arch/arm/include/asm/hardware/gic.h +++ b/arch/arm/include/asm/hardware/gic.h @@ -37,6 +37,7 @@ extern void __iomem *gic_cpu_base_addr; extern struct irq_chip gic_arch_extn; void gic_init(unsigned int, unsigned int, void __iomem *, void __iomem *); +void gic_of_init(void); void gic_secondary_init(unsigned int); void gic_cascade_irq(unsigned int gic_nr, unsigned int irq); void gic_raise_softirq(const struct cpumask *mask, unsigned int irq);