[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260131094547.455916-6-zhengxingda@iscas.ac.cn>
Date: Sat, 31 Jan 2026 17:45:44 +0800
From: Icenowy Zheng <zhengxingda@...as.ac.cn>
To: Thomas Gleixner <tglx@...nel.org>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Huacai Chen <chenhuacai@...nel.org>,
Jiaxun Yang <jiaxun.yang@...goat.com>
Cc: linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org,
linux-mips@...r.kernel.org,
Icenowy Zheng <zhengxingda@...as.ac.cn>
Subject: [PATCH 5/8] irqchip/loongson-pch-lpc: add OF init code
As the (kernel-internally) OF-based MIPS Loongson-3 systems can also
have PCH LPC interrupt controller, add OF-based initialization code for
the driver.
Co-developed-by: Jiaxun Yang <jiaxun.yang@...goat.com>
Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
Signed-off-by: Icenowy Zheng <zhengxingda@...as.ac.cn>
---
drivers/irqchip/irq-loongson-pch-lpc.c | 28 ++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/irqchip/irq-loongson-pch-lpc.c b/drivers/irqchip/irq-loongson-pch-lpc.c
index 96489e031d34e..0baa93028abf4 100644
--- a/drivers/irqchip/irq-loongson-pch-lpc.c
+++ b/drivers/irqchip/irq-loongson-pch-lpc.c
@@ -13,6 +13,8 @@
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h>
#include <linux/kernel.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
#include <linux/syscore_ops.h>
#include "irq-loongson.h"
@@ -257,3 +259,29 @@ int __init pch_lpc_acpi_init(struct irq_domain *parent,
return 0;
}
#endif /* CONFIG_ACPI */
+
+#ifdef CONFIG_OF
+static int pch_lpc_of_init(struct device_node *node,
+ struct device_node *parent)
+{
+ int parent_irq;
+ struct fwnode_handle *irq_handle;
+ struct resource res;
+
+ if (of_address_to_resource(node, 0, &res))
+ return -EINVAL;
+
+ parent_irq = irq_of_parse_and_map(node, 0);
+ if (!parent_irq) {
+ pr_err("Failed to get the parent IRQ for LPC IRQs\n");
+ return -EINVAL;
+ }
+
+ irq_handle = of_fwnode_handle(node);
+
+ return pch_lpc_init(res.start, resource_size(&res), irq_handle,
+ parent_irq);
+}
+
+IRQCHIP_DECLARE(pch_lpc, "loongson,pch-lpc-1.0", pch_lpc_of_init);
+#endif /* CONFIG_OF */
--
2.52.0
Powered by blists - more mailing lists