summaryrefslogtreecommitdiffstats
path: root/arch/mips/mti-sead3/sead3-platform.c
diff options
context:
space:
mode:
authorPaul Burton <paul.burton@imgtec.com>2016-08-26 15:17:34 +0100
committerRalf Baechle <ralf@linux-mips.org>2016-10-05 01:31:20 +0200
commitb6d5e47e67292542a41c3fe367bacb364eb4e601 (patch)
tree009d252825c827993b2b6fb67b21827cb1fc20a4 /arch/mips/mti-sead3/sead3-platform.c
parent0a15273666aa18a45985e6419afa05ec24ecfeb4 (diff)
downloadlinux-b6d5e47e67292542a41c3fe367bacb364eb4e601.tar.gz
linux-b6d5e47e67292542a41c3fe367bacb364eb4e601.tar.bz2
linux-b6d5e47e67292542a41c3fe367bacb364eb4e601.zip
MIPS: SEAD3: Probe interrupt controllers using DT
Probe the CPU interrupt controller & optional Global Interrupt Controller (GIC) using devicetree rather than platform code. Because the bootloader on SEAD3 does not provide a device tree to the kernel & the device tree is always built in, we patch out the GIC node during boot if we detect that a GIC is not present in the system. The appropriate IRQ domain is discovered by platform code setting up device IRQ numbers temporarily. It will be removed by further patches which move the devices towards being probed via device tree. No behavioural change is intended by this patch. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: Matt Redfearn <matt.redfearn@imgtec.com> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> Cc: Jacek Anaszewski <j.anaszewski@samsung.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: linux-mips@linux-mips.org Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/14047/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mti-sead3/sead3-platform.c')
-rw-r--r--arch/mips/mti-sead3/sead3-platform.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/arch/mips/mti-sead3/sead3-platform.c b/arch/mips/mti-sead3/sead3-platform.c
index 73b73efbfb05..d6be0298056a 100644
--- a/arch/mips/mti-sead3/sead3-platform.c
+++ b/arch/mips/mti-sead3/sead3-platform.c
@@ -9,8 +9,10 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/irqchip/mips-gic.h>
+#include <linux/irqdomain.h>
#include <linux/leds.h>
#include <linux/mtd/physmap.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
#include <linux/smsc911x.h>
@@ -204,16 +206,41 @@ static struct platform_device *sead3_platform_devices[] __initdata = {
static int __init sead3_platforms_device_init(void)
{
+ const char *intc_compat;
+ struct device_node *node;
+ struct irq_domain *irqd;
+
+ if (gic_present)
+ intc_compat = "mti,gic";
+ else
+ intc_compat = "mti,cpu-interrupt-controller";
+
+ node = of_find_compatible_node(NULL, NULL, intc_compat);
+ if (!node) {
+ pr_err("unable to find interrupt controller DT node\n");
+ return -ENODEV;
+ }
+
+ irqd = irq_find_host(node);
+ if (!irqd) {
+ pr_err("unable to find interrupt controller IRQ domain\n");
+ return -ENODEV;
+ }
+
if (gic_present) {
- uart8250_data[0].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART0;
- uart8250_data[1].irq = MIPS_GIC_IRQ_BASE + GIC_INT_UART1;
- ehci_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_EHCI;
- sead3_net_resources[1].start = MIPS_GIC_IRQ_BASE + GIC_INT_NET;
+ uart8250_data[0].irq = irq_create_mapping(irqd, GIC_INT_UART0);
+ uart8250_data[1].irq = irq_create_mapping(irqd, GIC_INT_UART1);
+ ehci_resources[1].start =
+ irq_create_mapping(irqd, GIC_INT_EHCI);
+ sead3_net_resources[1].start =
+ irq_create_mapping(irqd, GIC_INT_NET);
} else {
- uart8250_data[0].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART0;
- uart8250_data[1].irq = MIPS_CPU_IRQ_BASE + CPU_INT_UART1;
- ehci_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_EHCI;
- sead3_net_resources[1].start = MIPS_CPU_IRQ_BASE + CPU_INT_NET;
+ uart8250_data[0].irq = irq_create_mapping(irqd, CPU_INT_UART0);
+ uart8250_data[1].irq = irq_create_mapping(irqd, CPU_INT_UART1);
+ ehci_resources[1].start =
+ irq_create_mapping(irqd, CPU_INT_EHCI);
+ sead3_net_resources[1].start =
+ irq_create_mapping(irqd, CPU_INT_NET);
}
return platform_add_devices(sead3_platform_devices,