From 0a18c64dcc2f02aa078bbc246fc71cc224504712 Mon Sep 17 00:00:00 2001 From: Lynn-Becky <60915579+Lynn-Becky@users.noreply.github.com> Date: Sun, 28 Jun 2026 22:47:33 +0800 Subject: [PATCH] fix(machine): move SWTG024AS-specific SDS0 setup to machine.c --- machine.c | 11 +++++++++++ rtl837x_init.c | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/machine.c b/machine.c index 0004224..e467c48 100644 --- a/machine.c +++ b/machine.c @@ -941,10 +941,21 @@ __code const struct machine machine = { void machine_custom_init(void) { + uint16_t pval; + reg_bit_set(RTL837X_REG_LED_GLB_IO_EN, 6); reg_bit_set(RTL837X_REG_LED_MODE, 17); reg_bit_clear(RTL837X_REG_LED_MODE, 9); reg_bit_clear(RTL837X_REG_LED_MODE, 7); + + // OEM firmware sets these companion SDS0 polarity bits for the RTL8221B. + sds_read(0, 0, 0); + pval = SFR_DATA_U16; + sds_write_v(0, 0, 0, pval | 0x100); + + sds_read(0, 6, 2); + pval = SFR_DATA_U16; + sds_write_v(0, 6, 2, pval | 0x4000); } #elif defined MACHINE_ZX310S_4T2XT diff --git a/rtl837x_init.c b/rtl837x_init.c index e665688..50d94f6 100644 --- a/rtl837x_init.c +++ b/rtl837x_init.c @@ -76,16 +76,6 @@ void static sds_init(void) sds_read(0, 0, 0); pval = SFR_DATA_U16; sds_write_v(0, 0, 0, pval | 0x200); -#if defined MACHINE_SWTG024AS_V2_0 - // OEM firmware also sets the companion SDS0 polarity bits. - sds_read(0, 0, 0); - pval = SFR_DATA_U16; - sds_write_v(0, 0, 0, pval | 0x100); - - sds_read(0, 6, 2); - pval = SFR_DATA_U16; - sds_write_v(0, 6, 2, pval | 0x4000); -#endif } } else if (machine.n_10g == 1) { reg_read_m(RTL837X_CFG_PHY_MDI_REVERSE);