[openwrt/openwrt] realtek: relocate mips cpc probing

LEDE Commits lede-commits at lists.infradead.org
Sat May 24 12:21:03 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/cd808d999739fdf65c5cfd19cd04a8a02e1c0089

commit cd808d999739fdf65c5cfd19cd04a8a02e1c0089
Author: Markus Stockhausen <markus.stockhausen at gmx.de>
AuthorDate: Fri May 23 13:21:28 2025 -0400

    realtek: relocate mips cpc probing
    
    The MIPS CPC (Cluster Power Controller) is setup during boot and can take
    its configuration from the devicetree. This is currently not possible
    because the cpc probing happens before dt initialization. Call order
    during startup is:
    
    setup_arch()
      prom_init() <- our function
        mips_cpc_probe()
        smp_stuff()
      arch_mem_init()
        device_tree_init() <- our function
          unflatten_and_copy_device_tree()
    
    To avoid ugly hacking and support a clean devicetree relocate the cps/smp
    stuff to device_tree_init(). This is basically the same location as in
    generic mips initialization.
    
    Signed-off-by: Markus Stockhausen <markus.stockhausen at gmx.de>
    Signed-off-by: Sebastian Gottschall <s.gottschall at dd-wrt.com>
    Link: https://github.com/openwrt/openwrt/pull/18888
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../realtek/files-6.6/arch/mips/rtl838x/prom.c     | 33 +++++++++++-----------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/target/linux/realtek/files-6.6/arch/mips/rtl838x/prom.c b/target/linux/realtek/files-6.6/arch/mips/rtl838x/prom.c
index 03993ec01d..0452987247 100644
--- a/target/linux/realtek/files-6.6/arch/mips/rtl838x/prom.c
+++ b/target/linux/realtek/files-6.6/arch/mips/rtl838x/prom.c
@@ -76,6 +76,23 @@ void __init device_tree_init(void)
 	}
 	initial_boot_params = (void *)fdt;
 	unflatten_and_copy_device_tree();
+
+	/* delay cpc & smp probing to allow devicetree access */
+	mips_cpc_probe();
+
+	if (!register_cps_smp_ops())
+		return;
+
+#ifdef CONFIG_MIPS_MT_SMP
+	if (cpu_has_mipsmt) {
+		rtl_smp_ops = vsmp_smp_ops;
+		rtl_smp_ops.init_secondary = rtl_init_secondary;
+		register_smp_ops(&rtl_smp_ops);
+		return;
+	}
+#endif
+
+	register_up_smp_ops();
 }
 
 void __init identify_rtl9302(void)
@@ -205,20 +222,4 @@ void __init prom_init(void)
 		fw_arg2 = 0;
 
 	fw_init_cmdline();
-
-	mips_cpc_probe();
-
-	if (!register_cps_smp_ops())
-		return;
-
-#ifdef CONFIG_MIPS_MT_SMP
-	if (cpu_has_mipsmt) {
-		rtl_smp_ops = vsmp_smp_ops;
-		rtl_smp_ops.init_secondary = rtl_init_secondary;
-		register_smp_ops(&rtl_smp_ops);
-		return;
-	}
-#endif
-
-	register_up_smp_ops();
 }




More information about the lede-commits mailing list