[v2,1/2] irqchip: loongarch-cpu: add DT support

Message ID 20221114113824.1880-2-liupeibao@loongson.cn
State New
Headers
Series irqchip: loongarch-cpu: add DT support |

Commit Message

Liu Peibao Nov. 14, 2022, 11:38 a.m. UTC
  LoongArch is coming to support booting with FDT, so DT
support of this driver is desired.

Signed-off-by: Liu Peibao <liupeibao@loongson.cn>
---
 drivers/irqchip/irq-loongarch-cpu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
  

Comments

Huacai Chen Dec. 2, 2022, 2:07 a.m. UTC | #1
Hi, Peibao and Marc,

I found this patch has merged but lkp report a problem, this can
simply fixed by add "static" before loongarch_cpu_irq_of_init
definition. Since Marc's next branch hasn't been tagged yet, can
Peibao send a new version and Marc rebase it?

Huacai

On Mon, Nov 14, 2022 at 7:38 PM Liu Peibao <liupeibao@loongson.cn> wrote:
>
> LoongArch is coming to support booting with FDT, so DT
> support of this driver is desired.
>
> Signed-off-by: Liu Peibao <liupeibao@loongson.cn>
> ---
>  drivers/irqchip/irq-loongarch-cpu.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/drivers/irqchip/irq-loongarch-cpu.c b/drivers/irqchip/irq-loongarch-cpu.c
> index 741612ba6a52..a28b7c549654 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)
> --
> 2.20.1
>
  
Marc Zyngier Dec. 2, 2022, 8:45 a.m. UTC | #2
On 2022-12-02 02:07, Huacai Chen wrote:
> Hi, Peibao and Marc,
> 
> I found this patch has merged but lkp report a problem, this can
> simply fixed by add "static" before loongarch_cpu_irq_of_init
> definition. Since Marc's next branch hasn't been tagged yet, can
> Peibao send a new version and Marc rebase it?

Please send in a fix on top of the existing series.

Thanks,

         M.
  
Huacai Chen Dec. 5, 2022, 4:42 a.m. UTC | #3
On Fri, Dec 2, 2022 at 4:45 PM Marc Zyngier <maz@kernel.org> wrote:
>
> On 2022-12-02 02:07, Huacai Chen wrote:
> > Hi, Peibao and Marc,
> >
> > I found this patch has merged but lkp report a problem, this can
> > simply fixed by add "static" before loongarch_cpu_irq_of_init
> > definition. Since Marc's next branch hasn't been tagged yet, can
> > Peibao send a new version and Marc rebase it?
>
> Please send in a fix on top of the existing series.
OK, I'll send a fix later.

Huacai
>
> Thanks,
>
>          M.
> --
> Jazz is not dead. It just smells funny...
  

Patch

diff --git a/drivers/irqchip/irq-loongarch-cpu.c b/drivers/irqchip/irq-loongarch-cpu.c
index 741612ba6a52..a28b7c549654 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)