]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: rtl838x: fix non-functional reboot 22334/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sun, 8 Mar 2026 21:28:42 +0000 (22:28 +0100)
committerRobert Marko <robimarko@gmail.com>
Tue, 10 Mar 2026 09:34:23 +0000 (10:34 +0100)
RTL838x devices cannot reboot if the flash controller is driven in
4 byte mode. Unitl fdc3776 ("realtek: pcs: fix PLL_CML_CTRL for
serdes 0/1") this bit was luckily cleared by a coding error. Since
then the device cannot be rebooted anymore.

Looking at the SDK one can see that this bit is reset short before
the reboot happens. But we might need that in critical situations
where there is no chance to do it right in time. As the RTL838x
always ran with the bit disabled restore the old behaviour. This
time implement it as a documented quirk so it does not get lost.

Fixes: fdc3776 ("realtek: pcs: fix PLL_CML_CTRL for serdes 0/1")
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22334
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/arch/mips/include/asm/mach-rtl-otto/mach-rtl-otto.h
target/linux/realtek/files-6.12/arch/mips/rtl-otto/prom.c

index aa917c2ef749ebaf5408ee1dc79b45ae5763f019..f85dee65913faa5c9cbce91afcd70d96b81fc6d5 100644 (file)
@@ -28,6 +28,7 @@
 
 #define RTL838X_INT_RW_CTRL            (0x0058)
 #define RTL838X_EXT_VERSION            (0x00D0)
+#define RTL838X_PLL_CML_CTRL           (0x0ff8)
 
 #define RTL931X_LED_GLB_CTRL           (0x0600)
 #define RTL931X_MAC_L2_GLOBAL_CTRL2    (0x1358)
index b0975c51aec70a97956747d97d01cf5b85658a63..2ec2b3f0dd3268ed322da4f562285c10b7265859 100644 (file)
@@ -101,9 +101,21 @@ static int rtlsmp_register(void)
 
 static void __init apply_early_quirks(void)
 {
-       /* Open up write protected registers. Never mess with this elsewhere */
-       if (soc_info.family == RTL8380_FAMILY_ID)
+       if (soc_info.family == RTL8380_FAMILY_ID) {
+               /*
+                * Open up write protected registers. SDK opens/closes this whenever needed. For
+                * simplicity always work with an "open" register set.
+                */
                sw_w32(0x3, RTL838X_INT_RW_CTRL);
+               /*
+                * Disable 4 byte address mode of flash controller. If this bit is not cleared
+                * the watchdog cannot reset the SoC. The SDK changes this short before restart.
+                * Until this quirk was implemented all RTL838x devices ran with this disabled
+                * because of a coding error. As no issues were detected keep the behaviour
+                * until more details are known.
+                */
+               sw_w32_mask(BIT(30), 0, RTL838X_PLL_CML_CTRL);
+       }
 }
 
 static void __init apply_dts_quirks(void)