forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/irqchip/irqchip.c
....@@ -10,8 +10,10 @@
1010
1111 #include <linux/acpi.h>
1212 #include <linux/init.h>
13
+#include <linux/of_device.h>
1314 #include <linux/of_irq.h>
1415 #include <linux/irqchip.h>
16
+#include <linux/platform_device.h>
1517
1618 /*
1719 * This special of_device_id is the sentinel at the end of the
....@@ -20,7 +22,7 @@
2022 * special section.
2123 */
2224 static const struct of_device_id
23
-irqchip_of_match_end __used __section(__irqchip_of_table_end);
25
+irqchip_of_match_end __used __section("__irqchip_of_table_end");
2426
2527 extern struct of_device_id __irqchip_of_table[];
2628
....@@ -29,3 +31,30 @@
2931 of_irq_init(__irqchip_of_table);
3032 acpi_probe_device_table(irqchip);
3133 }
34
+
35
+int platform_irqchip_probe(struct platform_device *pdev)
36
+{
37
+ struct device_node *np = pdev->dev.of_node;
38
+ struct device_node *par_np = of_irq_find_parent(np);
39
+ of_irq_init_cb_t irq_init_cb = of_device_get_match_data(&pdev->dev);
40
+
41
+ if (!irq_init_cb)
42
+ return -EINVAL;
43
+
44
+ if (par_np == np)
45
+ par_np = NULL;
46
+
47
+ /*
48
+ * If there's a parent interrupt controller and none of the parent irq
49
+ * domains have been registered, that means the parent interrupt
50
+ * controller has not been initialized yet. it's not time for this
51
+ * interrupt controller to initialize. So, defer probe of this
52
+ * interrupt controller. The actual initialization callback of this
53
+ * interrupt controller can check for specific domains as necessary.
54
+ */
55
+ if (par_np && !irq_find_matching_host(par_np, DOMAIN_BUS_ANY))
56
+ return -EPROBE_DEFER;
57
+
58
+ return irq_init_cb(np, par_np);
59
+}
60
+EXPORT_SYMBOL_GPL(platform_irqchip_probe);