From: Jonas Jelonek Date: Fri, 27 Mar 2026 11:16:14 +0000 (+0100) Subject: realtek: pcs: rtl931x: relocate analog reset X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f4ecfe3baf3fe50ed10be3bd548f837d94db227c;p=thirdparty%2Fopenwrt.git realtek: pcs: rtl931x: relocate analog reset Relocate the analog reset code within set_media for RTL931X to have it in one place at the very top of the function, running all reset actions before further real configuration is done. Also drop a separate call to rx_reset because a subsequent sequence already includes this functionality. Signed-off-by: Jonas Jelonek Link: https://github.com/openwrt/openwrt/pull/22814 Signed-off-by: Robert Marko --- diff --git a/target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c b/target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c index 9a1b1291479..4762d48122e 100644 --- a/target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c +++ b/target/linux/realtek/files-6.18/drivers/net/pcs/pcs-rtl-otto.c @@ -3503,13 +3503,23 @@ static int rtpcs_931x_sds_set_media(struct rtpcs_serdes *sds, enum rtpcs_sds_med */ rtpcs_sds_write_bits(sds, 0x5f, 0x1, 0, 0, 0x1); - /* media none behavior */ + /* from _phy_rtl9310_sds_init */ + rtpcs_sds_write_bits(sds, 0x2e, 0xe, 13, 11, 0x0); + rtpcs_931x_sds_reset_leq_dfe(sds); + + /* + * SDK says: media none behavior + * + * - the first three calls are the same as in rx_reset + * - the last one slightly differs in the value. Something is taken into power down + * while rx_reset doesn't do this. + */ rtpcs_sds_write(sds, 0x2e, 0x12, 0x2740); rtpcs_sds_write(sds, 0x2f, 0x0, 0x0); /* [11:6] DFE_TAP3_ODD | [5:0] DFE_TAP3_EVEN */ rtpcs_sds_write(sds, 0x2f, 0x2, 0x2010); rtpcs_sds_write(sds, 0x20, 0x0, 0xcd1); /* from 930x: [7:6] POWER_DOWN OF ?? */ - rtpcs_sds_write_bits(sds, 0x2e, 0xf, 5, 0, 0x4); + rtpcs_sds_write_bits(sds, 0x2e, 0xf, 5, 0, 0x4); rtpcs_sds_write_bits(sds, 0x2a, 0x12, 7, 6, 0x1); if (sds_media == RTPCS_SDS_MEDIA_NONE) @@ -3518,11 +3528,6 @@ static int rtpcs_931x_sds_set_media(struct rtpcs_serdes *sds, enum rtpcs_sds_med rtpcs_sds_write(sds, 0x21, 0x19, 0xf0f0); /* from XS1930-10 SDK */ rtpcs_sds_write(even_sds, 0x2e, 0x8, 0x0294); /* [10:7] impedance */ - /* from _phy_rtl9310_sds_init, DMS1250 SDK */ - rtpcs_sds_write_bits(sds, 0x2e, 0xe, 13, 11, 0x0); - rtpcs_931x_sds_rx_reset(sds); - rtpcs_931x_sds_reset_leq_dfe(sds); - is_dac = (sds_media == RTPCS_SDS_MEDIA_DAC_SHORT || sds_media == RTPCS_SDS_MEDIA_DAC_LONG); is_10g = (hw_mode == RTPCS_SDS_MODE_10GBASER);