This bit was set unconditionally for any 10G-capable SerDes regardless
of hw_mode, including SGMII/1000BASEX/2500BASEX running on 10G-capable
silicon. The vendor SDK's dal_longan_construct_mac_default_10gmedia_fiber
gates it on the port's declared protocol class instead, applying it to
PHY-attached XSGMII/USXGMII as well as genuine fiber - the "medium to
fiber" naming doesn't match its actual condition.
Gate on speed == RTPCS_SDS_PLL_SPD_10000 instead, matching the real
10G-class protocol family, and actively clear it for 1G/2.5G modes so a
prior 10G-class configuration doesn't leave it stuck across a runtime
downshift. 0 also matches this register's confirmed hardware reset
default on an unconfigured SerDes.
Link: https://github.com/openwrt/openwrt/pull/24232
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
if (sds->type != RTPCS_SDS_TYPE_10G)
return 0;
- /*
- * dal_longan_construct_mac_default_10gmedia_fiber: set medium to fiber.
- * TODO: does this apply to all fiber modes or only 10GBase-R?
- */
- ret = rtpcs_sds_write_bits(sds, PAGE_WDIG, 11, 1, 1, 1);
+ ret = rtpcs_sds_select_pll_speed(hw_mode, &speed);
if (ret < 0)
return ret;
- ret = rtpcs_sds_select_pll_speed(hw_mode, &speed);
+ /*
+ * dal_longan_construct_mac_default_10gmedia_fiber: vendor sets this
+ * for any 10G-class port regardless of attachment, despite the
+ * name; 0 matches this register's hardware reset default.
+ */
+ ret = rtpcs_sds_write_bits(sds, PAGE_WDIG, 11, 1, 1, speed == RTPCS_SDS_PLL_SPD_10000);
if (ret < 0)
return ret;