mirror of
https://github.com/openwrt/openwrt.git
synced 2025-04-10 12:50:47 +00:00
lantiq: old gptu timer driver: use platform_get_irq to get irqs
This is required for linux-6.1 compatibility. IRQs are not automatically mapped from HW to virtual IRQ numbers when the IRQ domain is registered. This happens when the IRQ number is read from the device tree based on the IRQ domain from the device tree now. In kernel 5.15 it was done when the IRQ domain was registered. Signed-off-by: Martin Schiller <ms@dev.tdt.de>
This commit is contained in:
parent
db4bb19679
commit
83fccc42df
@ -186,7 +186,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
obj-y += vmmc.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/lantiq/xway/timer.c
|
||||
@@ -0,0 +1,852 @@
|
||||
@@ -0,0 +1,887 @@
|
||||
+#ifndef CONFIG_SOC_AMAZON_SE
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
@ -203,6 +203,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
+#include <linux/sched.h>
|
||||
+#include <linux/sched/signal.h>
|
||||
+
|
||||
+#include <linux/of_platform.h>
|
||||
+
|
||||
+#include <asm/irq.h>
|
||||
+#include <asm/div64.h>
|
||||
+#include "../clk.h"
|
||||
@ -978,7 +980,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int __init lq_gptu_init(void)
|
||||
+static int gptu_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ int ret;
|
||||
+ int i;
|
||||
@ -1005,15 +1007,24 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < timer_dev.number_of_timers; i++) {
|
||||
+ ret = request_irq(TIMER_INTERRUPT + i, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]);
|
||||
+ int irq = platform_get_irq(pdev, i);
|
||||
+ if (irq < 0) {
|
||||
+ printk(KERN_ERR "gptu: failed in getting irq (%d), get error %d\n", i, irq);
|
||||
+ for (i--; i >= 0; i--)
|
||||
+ free_irq(timer_dev.timer[i].irq, &timer_dev.timer[i]);
|
||||
+ misc_deregister(&gptu_miscdev);
|
||||
+ return irq;
|
||||
+ }
|
||||
+
|
||||
+ ret = request_irq(irq, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]);
|
||||
+ if (ret) {
|
||||
+ printk(KERN_ERR "gptu: failed in requesting irq (%d), get error %d\n", i, -ret);
|
||||
+ for (i--; i >= 0; i--)
|
||||
+ free_irq(TIMER_INTERRUPT + i, &timer_dev.timer[i]);
|
||||
+ free_irq(timer_dev.timer[i].irq, &timer_dev.timer[i]);
|
||||
+ misc_deregister(&gptu_miscdev);
|
||||
+ return ret;
|
||||
+ } else {
|
||||
+ timer_dev.timer[i].irq = TIMER_INTERRUPT + i;
|
||||
+ timer_dev.timer[i].irq = irq;
|
||||
+ disable_irq(timer_dev.timer[i].irq);
|
||||
+ printk(KERN_INFO "gptu: succeeded to request irq %d\n", timer_dev.timer[i].irq);
|
||||
+ }
|
||||
@ -1022,6 +1033,30 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id gptu_match[] = {
|
||||
+ { .compatible = "lantiq,gptu-xway" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, gptu_match);
|
||||
+
|
||||
+static struct platform_driver gptu_driver = {
|
||||
+ .probe = gptu_probe,
|
||||
+ .driver = {
|
||||
+ .name = "gptu-xway",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = gptu_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+int __init lq_gptu_init(void)
|
||||
+{
|
||||
+ int ret = platform_driver_register(&gptu_driver);
|
||||
+
|
||||
+ if (ret)
|
||||
+ pr_info("gptu: Error registering platform driver\n");
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+void __exit lq_gptu_exit(void)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
|
@ -186,7 +186,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
obj-y += vmmc.o
|
||||
--- /dev/null
|
||||
+++ b/arch/mips/lantiq/xway/timer.c
|
||||
@@ -0,0 +1,852 @@
|
||||
@@ -0,0 +1,887 @@
|
||||
+#ifndef CONFIG_SOC_AMAZON_SE
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
@ -203,6 +203,8 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
+#include <linux/sched.h>
|
||||
+#include <linux/sched/signal.h>
|
||||
+
|
||||
+#include <linux/of_platform.h>
|
||||
+
|
||||
+#include <asm/irq.h>
|
||||
+#include <asm/div64.h>
|
||||
+#include "../clk.h"
|
||||
@ -978,7 +980,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int __init lq_gptu_init(void)
|
||||
+static int gptu_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ int ret;
|
||||
+ int i;
|
||||
@ -1005,15 +1007,24 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < timer_dev.number_of_timers; i++) {
|
||||
+ ret = request_irq(TIMER_INTERRUPT + i, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]);
|
||||
+ int irq = platform_get_irq(pdev, i);
|
||||
+ if (irq < 0) {
|
||||
+ printk(KERN_ERR "gptu: failed in getting irq (%d), get error %d\n", i, irq);
|
||||
+ for (i--; i >= 0; i--)
|
||||
+ free_irq(timer_dev.timer[i].irq, &timer_dev.timer[i]);
|
||||
+ misc_deregister(&gptu_miscdev);
|
||||
+ return irq;
|
||||
+ }
|
||||
+
|
||||
+ ret = request_irq(irq, timer_irq_handler, IRQF_TIMER, gptu_miscdev.name, &timer_dev.timer[i]);
|
||||
+ if (ret) {
|
||||
+ printk(KERN_ERR "gptu: failed in requesting irq (%d), get error %d\n", i, -ret);
|
||||
+ for (i--; i >= 0; i--)
|
||||
+ free_irq(TIMER_INTERRUPT + i, &timer_dev.timer[i]);
|
||||
+ free_irq(timer_dev.timer[i].irq, &timer_dev.timer[i]);
|
||||
+ misc_deregister(&gptu_miscdev);
|
||||
+ return ret;
|
||||
+ } else {
|
||||
+ timer_dev.timer[i].irq = TIMER_INTERRUPT + i;
|
||||
+ timer_dev.timer[i].irq = irq;
|
||||
+ disable_irq(timer_dev.timer[i].irq);
|
||||
+ printk(KERN_INFO "gptu: succeeded to request irq %d\n", timer_dev.timer[i].irq);
|
||||
+ }
|
||||
@ -1022,6 +1033,30 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id gptu_match[] = {
|
||||
+ { .compatible = "lantiq,gptu-xway" },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, gptu_match);
|
||||
+
|
||||
+static struct platform_driver gptu_driver = {
|
||||
+ .probe = gptu_probe,
|
||||
+ .driver = {
|
||||
+ .name = "gptu-xway",
|
||||
+ .owner = THIS_MODULE,
|
||||
+ .of_match_table = gptu_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+int __init lq_gptu_init(void)
|
||||
+{
|
||||
+ int ret = platform_driver_register(&gptu_driver);
|
||||
+
|
||||
+ if (ret)
|
||||
+ pr_info("gptu: Error registering platform driver\n");
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+void __exit lq_gptu_exit(void)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user