From: Paul Burton <paul.burton@imgtec.com>
To: <linux-mips@linux-mips.org>
Cc: <devicetree@vger.kernel.org>, Rob Herring <robh+dt@kernel.org>,
Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
"Paul Burton" <paul.burton@imgtec.com>,
Qais Yousef <qais.yousef@imgtec.com>,
"Andrew Bresticker" <abrestic@chromium.org>,
<linux-kernel@vger.kernel.org>,
"Ralf Baechle" <ralf@linux-mips.org>
Subject: [PATCH 04/15] MIPS: i8259: DT support
Date: Fri, 22 May 2015 16:51:03 +0100 [thread overview]
Message-ID: <1432309875-9712-5-git-send-email-paul.burton@imgtec.com> (raw)
In-Reply-To: <1432309875-9712-1-git-send-email-paul.burton@imgtec.com>
Support probing the i8259 programmable interrupt controller, as found on
the Malta board, and using its interrupts via device tree.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---
arch/mips/include/asm/i8259.h | 1 +
arch/mips/kernel/i8259.c | 43 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/arch/mips/include/asm/i8259.h b/arch/mips/include/asm/i8259.h
index c7e2784..a7fbcd6 100644
--- a/arch/mips/include/asm/i8259.h
+++ b/arch/mips/include/asm/i8259.h
@@ -41,6 +41,7 @@ extern int i8259A_irq_pending(unsigned int irq);
extern void make_8259A_irq(unsigned int irq);
extern void init_i8259_irqs(void);
+extern int i8259_of_init(struct device_node *node, struct device_node *parent);
/*
* Do the traditional i8259 interrupt polling thing. This is for the few
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index a74ec3a..74f6752 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -14,6 +14,7 @@
#include <linux/interrupt.h>
#include <linux/irqdomain.h>
#include <linux/kernel.h>
+#include <linux/of_irq.h>
#include <linux/spinlock.h>
#include <linux/syscore_ops.h>
#include <linux/irq.h>
@@ -21,6 +22,8 @@
#include <asm/i8259.h>
#include <asm/io.h>
+#include "../../drivers/irqchip/irqchip.h"
+
/*
* This is the 'legacy' 8259A Programmable Interrupt Controller,
* present in the majority of PC/AT boxes.
@@ -327,7 +330,7 @@ static struct irq_domain_ops i8259A_ops = {
* driver compatibility reasons interrupts 0 - 15 to be the i8259
* interrupts even if the hardware uses a different interrupt numbering.
*/
-void __init init_i8259_irqs(void)
+struct irq_domain * __init __init_i8259_irqs(struct device_node *node)
{
struct irq_domain *domain;
@@ -336,10 +339,46 @@ void __init init_i8259_irqs(void)
init_8259A(0);
- domain = irq_domain_add_legacy(NULL, 16, I8259A_IRQ_BASE, 0,
+ domain = irq_domain_add_legacy(node, 16, I8259A_IRQ_BASE, 0,
&i8259A_ops, NULL);
if (!domain)
panic("Failed to add i8259 IRQ domain");
setup_irq(I8259A_IRQ_BASE + PIC_CASCADE_IR, &irq2);
+ return domain;
+}
+
+void __init init_i8259_irqs(void)
+{
+ __init_i8259_irqs(NULL);
+}
+
+static void i8259_irq_dispatch(unsigned int irq, struct irq_desc *desc)
+{
+ struct irq_domain *domain = irq_get_handler_data(irq);
+ int hwirq = i8259_irq();
+
+ if (hwirq < 0)
+ return;
+
+ irq = irq_linear_revmap(domain, hwirq);
+ generic_handle_irq(irq);
+}
+
+int __init i8259_of_init(struct device_node *node, struct device_node *parent)
+{
+ struct irq_domain *domain;
+ unsigned int parent_irq;
+
+ parent_irq = irq_of_parse_and_map(node, 0);
+ if (!parent_irq) {
+ pr_err("Failed to map i8259 parent IRQ\n");
+ return -ENODEV;
+ }
+
+ domain = __init_i8259_irqs(node);
+ irq_set_handler_data(parent_irq, domain);
+ irq_set_chained_handler(parent_irq, i8259_irq_dispatch);
+ return 0;
}
+IRQCHIP_DECLARE(i8259, "intel,i8259", i8259_of_init);
--
2.4.1
next prev parent reply other threads:[~2015-05-22 15:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 15:50 [PATCH 00/15] MIPS Malta DT Conversion Paul Burton
2015-05-22 15:51 ` [PATCH 01/15] MIPS: define GCR_GIC_STATUS register fields Paul Burton
2015-05-22 15:51 ` [PATCH 02/15] MIPS: include errno.h for ENODEV in mips-cm.h Paul Burton
2015-05-22 15:51 ` [PATCH 03/15] MIPS: malta: basic DT plumbing Paul Burton
2015-05-22 15:51 ` Paul Burton [this message]
2015-05-22 15:51 ` [PATCH 05/15] irqchip: mips-gic: register IRQ domain with MIPS_GIC_IRQ_BASE Paul Burton
2015-05-22 17:27 ` Jason Cooper
2015-05-22 15:51 ` [PATCH 06/15] MIPS: malta: probe interrupt controllers via DT Paul Burton
2015-05-22 15:51 ` [PATCH 07/15] MIPS: remove [SR]ocIt(2) IRQ handling code Paul Burton
2015-05-22 15:51 ` [PATCH 08/15] of_serial: support for UARTs on I/O ports Paul Burton
2015-05-26 13:53 ` Peter Hurley
2015-05-22 15:51 ` [PATCH 09/15] MIPS: malta: probe UARTs using DT Paul Burton
2015-05-22 15:51 ` [PATCH 10/15] MIPS: malta: probe RTC via DT Paul Burton
2015-05-22 15:51 ` [PATCH 11/15] MIPS: malta: probe pflash " Paul Burton
2015-05-22 15:51 ` [PATCH 12/15] MIPS: malta: remove fw_memblock_t abstraction Paul Burton
2015-05-22 15:51 ` [PATCH 13/15] MIPS: malta: remove nonsense memory limit Paul Burton
2015-05-22 15:51 ` [PATCH 14/15] MIPS: malta: setup RAM regions via DT Paul Burton
2015-10-29 4:39 ` Rob Herring
2015-05-22 15:51 ` [PATCH 15/15] MIPS: malta: setup post-I/O hole RAM on non-EVA Paul Burton
2015-05-25 7:59 ` [PATCH 00/15] MIPS Malta DT Conversion Rob Landley
2015-05-25 13:29 ` Paul Burton
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=1432309875-9712-5-git-send-email-paul.burton@imgtec.com \
--to=paul.burton@imgtec.com \
--cc=abrestic@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=qais.yousef@imgtec.com \
--cc=ralf@linux-mips.org \
--cc=robh+dt@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
all inboxes | Powered by JetHome®