devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rabin Vincent <rabin@rab.in>
To: jesper.nilsson@axis.com
Cc: linux-cris-kernel@axis.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Rabin Vincent <rabin@rab.in>
Subject: [PATCH 2/4] CRISv32: add irq domains support
Date: Sun,  8 Feb 2015 16:35:43 +0100	[thread overview]
Message-ID: <1423409745-2230-2-git-send-email-rabin@rab.in> (raw)
In-Reply-To: <1423409745-2230-1-git-send-email-rabin@rab.in>

Add support for IRQ domains to the CRISv32 interrupt controller.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 arch/cris/Kconfig               |  1 +
 arch/cris/arch-v32/kernel/irq.c | 28 +++++++++++++++++++++++++---
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index cbbc2dc..66f71df 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -55,6 +55,7 @@ config CRIS
 	select ARCH_REQUIRE_GPIOLIB
 	select OF
 	select OF_EARLY_FLATTREE
+	select IRQ_DOMAIN if ETRAX_ARCH_V32
 
 config HZ
 	int
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
index 25437ae..bc871d2 100644
--- a/arch/cris/arch-v32/kernel/irq.c
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -10,6 +10,8 @@
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/profile.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/threads.h>
@@ -431,6 +433,19 @@ crisv32_do_multiple(struct pt_regs* regs)
 	irq_exit();
 }
 
+static int crisv32_irq_map(struct irq_domain *h, unsigned int virq,
+			   irq_hw_number_t hw_irq_num)
+{
+	irq_set_chip_and_handler(virq, &crisv32_irq_type, handle_simple_irq);
+
+	return 0;
+}
+
+static struct irq_domain_ops crisv32_irq_ops = {
+	.map	= crisv32_irq_map,
+	.xlate	= irq_domain_xlate_onecell,
+};
+
 /*
  * This is called by start_kernel. It fixes the IRQ masks and setup the
  * interrupt vector table to point to bad_interrupt pointers.
@@ -441,6 +456,8 @@ init_IRQ(void)
 	int i;
 	int j;
 	reg_intr_vect_rw_mask vect_mask = {0};
+	struct device_node *np;
+	struct irq_domain *domain;
 
 	/* Clear all interrupts masks. */
 	for (i = 0; i < NBR_REGS; i++)
@@ -449,10 +466,15 @@ init_IRQ(void)
 	for (i = 0; i < 256; i++)
 		etrax_irv->v[i] = weird_irq;
 
-	/* Point all IRQ's to bad handlers. */
+	np = of_find_compatible_node(NULL, NULL, "axis,crisv32-intc");
+	domain = irq_domain_add_legacy(np, NR_IRQS - FIRST_IRQ,
+				       FIRST_IRQ, FIRST_IRQ,
+				       &crisv32_irq_ops, NULL);
+	BUG_ON(!domain);
+	irq_set_default_host(domain);
+	of_node_put(np);
+
 	for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
-		irq_set_chip_and_handler(j, &crisv32_irq_type,
-					 handle_simple_irq);
 		set_exception_vector(i, interrupt[j]);
 	}
 
-- 
2.1.4

  reply	other threads:[~2015-02-08 15:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-08 15:35 [PATCH 1/4] CRIS: add device tree support Rabin Vincent
2015-02-08 15:35 ` Rabin Vincent [this message]
2015-02-09  9:40   ` [PATCH 2/4] CRISv32: add irq domains support Jesper Nilsson
2015-02-08 15:35 ` [PATCH 3/4] CRIS: document CRISv32 intc bindings Rabin Vincent
     [not found]   ` <1423409745-2230-3-git-send-email-rabin-66gdRtMMWGc@public.gmane.org>
2015-02-09  9:45     ` Jesper Nilsson
2015-02-08 15:35 ` [PATCH 4/4] CRIS: add Axis 88 board device tree Rabin Vincent
2015-02-09  9:46   ` Jesper Nilsson
2015-02-09  9:39 ` [PATCH 1/4] CRIS: add device tree support Jesper Nilsson
2015-02-22 19:42 ` [PATCHv2 1/2] CRISv32: add irq domains support Rabin Vincent
2015-02-22 19:42   ` [PATCHv2 2/2] CRISv32: add device tree support Rabin Vincent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1423409745-2230-2-git-send-email-rabin@rab.in \
    --to=rabin@rab.in \
    --cc=devicetree@vger.kernel.org \
    --cc=jesper.nilsson@axis.com \
    --cc=linux-cris-kernel@axis.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).