diff options
Diffstat (limited to 'target/linux/ramips/patches-5.15/110-reset_controller_driver.patch')
-rw-r--r-- | target/linux/ramips/patches-5.15/110-reset_controller_driver.patch | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/target/linux/ramips/patches-5.15/110-reset_controller_driver.patch b/target/linux/ramips/patches-5.15/110-reset_controller_driver.patch new file mode 100644 index 0000000000..6c923d70c3 --- /dev/null +++ b/target/linux/ramips/patches-5.15/110-reset_controller_driver.patch @@ -0,0 +1,61 @@ +--- a/arch/mips/ralink/reset.c ++++ b/arch/mips/ralink/reset.c +@@ -11,6 +11,7 @@ + #include <linux/of.h> + #include <linux/delay.h> + #include <linux/reset-controller.h> ++#include <linux/platform_device.h> + + #include <asm/reboot.h> + +@@ -65,21 +66,39 @@ static const struct reset_control_ops re + .deassert = ralink_deassert_device, + }; + +-static struct reset_controller_dev reset_dev = { +- .ops = &reset_ops, +- .owner = THIS_MODULE, +- .nr_resets = 32, +- .of_reset_n_cells = 1, ++static int ralink_reset_probe(struct platform_device *pdev) ++{ ++ struct reset_controller_dev *rcdev; ++ ++ rcdev = devm_kzalloc(&pdev->dev, sizeof(*rcdev), GFP_KERNEL); ++ if (!rcdev) ++ return -ENOMEM; ++ ++ rcdev->ops = &reset_ops; ++ rcdev->owner = THIS_MODULE; ++ rcdev->nr_resets = 32; ++ rcdev->of_reset_n_cells = 1; ++ rcdev->of_node = pdev->dev.of_node; ++ ++ return devm_reset_controller_register(&pdev->dev, rcdev); ++} ++ ++static const struct of_device_id ralink_reset_dt_ids[] = { ++ { .compatible = "ralink,rt2880-reset" }, ++ {} ++}; ++ ++static struct platform_driver ralink_reset_driver = { ++ .probe = ralink_reset_probe, ++ .driver = { ++ .name = "ralink-reset", ++ .of_match_table = ralink_reset_dt_ids, ++ } + }; + + void ralink_rst_init(void) + { +- reset_dev.of_node = of_find_compatible_node(NULL, NULL, +- "ralink,rt2880-reset"); +- if (!reset_dev.of_node) +- pr_err("Failed to find reset controller node"); +- else +- reset_controller_register(&reset_dev); ++ platform_driver_register(&ralink_reset_driver); + } + + static void ralink_restart(char *command) |