linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
To: <monstr@monstr.eu>, <ralf@linux-mips.org>, <tglx@linutronix.de>,
	<jason@lakedaemon.net>, <marc.zyngier@arm.com>,
	<alistair@popple.id.au>, <mporter@kernel.crashing.org>
Cc: <soren.brinkmann@xilinx.com>, <linux-kernel@vger.kernel.org>,
	<linux-mips@linux-mips.org>, <michal.simek@xilinx.com>,
	<linuxppc-dev@lists.ozlabs.org>, <mpe@ellerman.id.au>,
	<paulus@samba.org>, <benh@kernel.crashing.org>
Subject: [Patch v5 04/12] irqchip: xilinx: Add support for parent intc
Date: Mon, 17 Oct 2016 17:52:48 +0100	[thread overview]
Message-ID: <1476723176-39891-5-git-send-email-Zubair.Kakakhel@imgtec.com> (raw)
In-Reply-To: <1476723176-39891-1-git-send-email-Zubair.Kakakhel@imgtec.com>

The MIPS based xilfpga platform has the following IRQ structure

Peripherals --> xilinx_intcontroller -> mips_cpu_int controller

Add support for the driver to chain the irq handler

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>

---
V4 -> V5
Rebased to v4.9-rc1
Missing curly braces

V3 -> V4
Clean up if/else when a parent is found
Pass irqchip structure to handler as data

V2 -> V3
Reused existing parent node instead of finding again.
Cleanup up handler based on review

V1 -> V2

No change
---
 drivers/irqchip/irq-xilinx-intc.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c
index 45e5154..dbf8b0c 100644
--- a/drivers/irqchip/irq-xilinx-intc.c
+++ b/drivers/irqchip/irq-xilinx-intc.c
@@ -15,6 +15,7 @@
 #include <linux/of_address.h>
 #include <linux/io.h>
 #include <linux/bug.h>
+#include <linux/of_irq.h>
 
 /* No one else should require these constants, so define them locally here. */
 #define ISR 0x00			/* Interrupt Status Register */
@@ -154,11 +155,23 @@ static int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
 	.map = xintc_map,
 };
 
+static void xil_intc_irq_handler(struct irq_desc *desc)
+{
+	u32 pending;
+
+	do {
+		pending = xintc_get_irq();
+		if (pending == -1U)
+			break;
+		generic_handle_irq(pending);
+	} while (true);
+}
+
 static int __init xilinx_intc_of_init(struct device_node *intc,
 					     struct device_node *parent)
 {
 	u32 nr_irq;
-	int ret;
+	int ret, irq;
 	struct xintc_irq_chip *irqc;
 
 	if (xintc_irqc) {
@@ -221,7 +234,16 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
 		goto err_alloc;
 	}
 
-	irq_set_default_host(root_domain);
+	if (parent) {
+		irq = irq_of_parse_and_map(intc, 0);
+		if (irq)
+			irq_set_chained_handler_and_data(irq,
+							 xil_intc_irq_handler,
+							 irqc);
+
+	} else {
+		irq_set_default_host(root_domain);
+	}
 
 	return 0;
 
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
To: monstr@monstr.eu, ralf@linux-mips.org, tglx@linutronix.de,
	jason@lakedaemon.net, marc.zyngier@arm.com,
	alistair@popple.id.au, mporter@kernel.crashing.org
Cc: soren.brinkmann@xilinx.com, linux-kernel@vger.kernel.org,
	linux-mips@linux-mips.org, michal.simek@xilinx.com,
	linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au,
	paulus@samba.org, benh@kernel.crashing.org
Subject: [Patch v5 04/12] irqchip: xilinx: Add support for parent intc
Date: Mon, 17 Oct 2016 17:52:48 +0100	[thread overview]
Message-ID: <1476723176-39891-5-git-send-email-Zubair.Kakakhel@imgtec.com> (raw)
Message-ID: <20161017165248.-rpKGW1GT5mO7y5KH78qEJUWrFG_AGu4fEEjKuJ5JPA@z> (raw)
In-Reply-To: <1476723176-39891-1-git-send-email-Zubair.Kakakhel@imgtec.com>

The MIPS based xilfpga platform has the following IRQ structure

Peripherals --> xilinx_intcontroller -> mips_cpu_int controller

Add support for the driver to chain the irq handler

Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>

---
V4 -> V5
Rebased to v4.9-rc1
Missing curly braces

V3 -> V4
Clean up if/else when a parent is found
Pass irqchip structure to handler as data

V2 -> V3
Reused existing parent node instead of finding again.
Cleanup up handler based on review

V1 -> V2

No change
---
 drivers/irqchip/irq-xilinx-intc.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c
index 45e5154..dbf8b0c 100644
--- a/drivers/irqchip/irq-xilinx-intc.c
+++ b/drivers/irqchip/irq-xilinx-intc.c
@@ -15,6 +15,7 @@
 #include <linux/of_address.h>
 #include <linux/io.h>
 #include <linux/bug.h>
+#include <linux/of_irq.h>
 
 /* No one else should require these constants, so define them locally here. */
 #define ISR 0x00			/* Interrupt Status Register */
@@ -154,11 +155,23 @@ static int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
 	.map = xintc_map,
 };
 
+static void xil_intc_irq_handler(struct irq_desc *desc)
+{
+	u32 pending;
+
+	do {
+		pending = xintc_get_irq();
+		if (pending == -1U)
+			break;
+		generic_handle_irq(pending);
+	} while (true);
+}
+
 static int __init xilinx_intc_of_init(struct device_node *intc,
 					     struct device_node *parent)
 {
 	u32 nr_irq;
-	int ret;
+	int ret, irq;
 	struct xintc_irq_chip *irqc;
 
 	if (xintc_irqc) {
@@ -221,7 +234,16 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
 		goto err_alloc;
 	}
 
-	irq_set_default_host(root_domain);
+	if (parent) {
+		irq = irq_of_parse_and_map(intc, 0);
+		if (irq)
+			irq_set_chained_handler_and_data(irq,
+							 xil_intc_irq_handler,
+							 irqc);
+
+	} else {
+		irq_set_default_host(root_domain);
+	}
 
 	return 0;
 
-- 
1.9.1

  parent reply	other threads:[~2016-10-17 16:58 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 16:52 [Patch v5 00/12] microblaze/MIPS/PowerPC: Xilinx intc Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 01/12] microblaze: irqchip: Move intc driver to irqchip Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 02/12] irqchip: xilinx: Clean up irqdomain argument and read/write Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 03/12] irqchip: xilinx: Rename get_irq to xintc_get_irq Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` Zubair Lutfullah Kakakhel [this message]
2016-10-17 16:52   ` [Patch v5 04/12] irqchip: xilinx: Add support for parent intc Zubair Lutfullah Kakakhel
2016-10-21  9:48   ` Marc Zyngier
2016-10-25  9:42     ` Zubair Lutfullah Kakakhel
2016-10-25  9:42       ` Zubair Lutfullah Kakakhel
2016-10-25 10:49       ` Thomas Gleixner
2016-10-25 14:44         ` Sören Brinkmann
2016-10-25 14:44           ` Sören Brinkmann
2016-10-25 14:52           ` Marc Zyngier
2016-10-17 16:52 ` [Patch v5 05/12] irqchip: xilinx: Try to fall back if xlnx,kind-of-intr not provided Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 06/12] powerpc/virtex: Use generic xilinx irqchip driver Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-19 11:53   ` Michael Ellerman
2016-10-17 16:52 ` [Patch v5 07/12] MIPS: xilfpga: Use irqchip instead of the legacy way Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 08/12] MIPS: xilfpga: Use Xilinx Interrupt Controller Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 09/12] MIPS: xilfpga: Update DT node and specify uart irq Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 10/12] MIPS: xilfpga: Add DT node for AXI I2C Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 11/12] MIPS: xilfpga: Add DT node for AXI emaclite Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel
2016-10-17 16:52 ` [Patch v5 12/12] MIPS: xilfpga: Update defconfig Zubair Lutfullah Kakakhel
2016-10-17 16:52   ` Zubair Lutfullah Kakakhel

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=1476723176-39891-5-git-send-email-Zubair.Kakakhel@imgtec.com \
    --to=zubair.kakakhel@imgtec.com \
    --cc=alistair@popple.id.au \
    --cc=benh@kernel.crashing.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=marc.zyngier@arm.com \
    --cc=michal.simek@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=mpe@ellerman.id.au \
    --cc=mporter@kernel.crashing.org \
    --cc=paulus@samba.org \
    --cc=ralf@linux-mips.org \
    --cc=soren.brinkmann@xilinx.com \
    --cc=tglx@linutronix.de \
    /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).