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 <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22814
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Jonas Jelonek 2026-03-27 12:16:14 +01:00 committed by Robert Marko
parent 1c590ed4b7
commit f4ecfe3baf

View File

@ -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);