From: Liu Peibao Date: Mon, 14 Nov 2022 11:38:23 +0000 (+0800) Subject: irqchip: loongarch-cpu: add DT support X-Git-Tag: v6.2-rc1~195^2^2~2^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=855d4ca4bdb366aab3d43408b74e02ab629d1d55;p=thirdparty%2Flinux.git irqchip: loongarch-cpu: add DT support LoongArch is coming to support booting with FDT, so DT support of this driver is desired. Signed-off-by: Liu Peibao Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20221114113824.1880-2-liupeibao@loongson.cn --- diff --git a/drivers/irqchip/irq-loongarch-cpu.c b/drivers/irqchip/irq-loongarch-cpu.c index 741612ba6a520..a28b7c5496546 100644 --- a/drivers/irqchip/irq-loongarch-cpu.c +++ b/drivers/irqchip/irq-loongarch-cpu.c @@ -92,6 +92,25 @@ static const struct irq_domain_ops loongarch_cpu_intc_irq_domain_ops = { .xlate = irq_domain_xlate_onecell, }; +#ifdef CONFIG_OF +int __init loongarch_cpu_irq_of_init(struct device_node *of_node, + struct device_node *parent) +{ + cpuintc_handle = of_node_to_fwnode(of_node); + + irq_domain = irq_domain_create_linear(cpuintc_handle, EXCCODE_INT_NUM, + &loongarch_cpu_intc_irq_domain_ops, NULL); + if (!irq_domain) + panic("Failed to add irqdomain for loongarch CPU"); + + set_handle_irq(&handle_cpu_irq); + + return 0; +} +IRQCHIP_DECLARE(cpu_intc, "loongson,cpu-interrupt-controller", + loongarch_cpu_irq_of_init); +#endif + static int __init liointc_parse_madt(union acpi_subtable_headers *header, const unsigned long end)