mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-12 06:57:57 +04:00
realtek: pcs: rtl930x: coalesce TX amplitude updates
Program impedance, pre-amplitude, and post-amplitude in that order so dependent enable state is not exposed before its coefficient. Then update the main amplitude and both enable bits together. This replaces three REG07 read-modify-write transactions with one. Link: https://github.com/openwrt/openwrt/pull/25314 Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
This commit is contained in:
1 file changed
+9
-15
@@ -2219,6 +2219,7 @@ static int rtpcs_930x_sds_tx_config(struct rtpcs_serdes *sds, enum rtpcs_sds_mod
|
||||
const struct rtpcs_sds_tx_config *tx_conf)
|
||||
{
|
||||
enum rtpcs_page page;
|
||||
u16 mask, val;
|
||||
int ret;
|
||||
|
||||
ret = rtpcs_93xx_sds_get_cmu_page(hw_mode);
|
||||
@@ -2230,29 +2231,22 @@ static int rtpcs_930x_sds_tx_config(struct rtpcs_serdes *sds, enum rtpcs_sds_mod
|
||||
|
||||
ret = rtpcs_sds_write_mask(sds, page, ANA_SPD_EXT_REG24, RTL930X_TX_IMPEDANCE,
|
||||
FIELD_PREP(RTL930X_TX_IMPEDANCE, tx_conf->impedance));
|
||||
if (!ret)
|
||||
ret = rtpcs_sds_write_mask(sds, page, ANA_SPD_EXT_REG07, RTL930X_TX_MAIN_AMP,
|
||||
FIELD_PREP(RTL930X_TX_MAIN_AMP, tx_conf->main_amp));
|
||||
|
||||
/* pre-amp */
|
||||
if (!ret)
|
||||
ret = rtpcs_sds_write_mask(sds, page, ANA_SPD_EXT_REG01, RTL930X_TX_PRE_AMP,
|
||||
FIELD_PREP(RTL930X_TX_PRE_AMP, tx_conf->pre_amp));
|
||||
if (!ret)
|
||||
ret = rtpcs_sds_write_mask(sds, page, ANA_SPD_EXT_REG07,
|
||||
RTL930X_TX_PRE_AMP_EN,
|
||||
tx_conf->pre_amp ? RTL930X_TX_PRE_AMP_EN : 0);
|
||||
|
||||
/* post-amp */
|
||||
if (!ret)
|
||||
ret = rtpcs_sds_write_mask(sds, page, ANA_SPD_EXT_REG06, RTL930X_TX_POST_AMP,
|
||||
FIELD_PREP(RTL930X_TX_POST_AMP, tx_conf->post_amp));
|
||||
if (!ret)
|
||||
ret = rtpcs_sds_write_mask(sds, page, ANA_SPD_EXT_REG07,
|
||||
RTL930X_TX_POST_AMP_EN,
|
||||
tx_conf->post_amp ? RTL930X_TX_POST_AMP_EN : 0);
|
||||
|
||||
return ret;
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
mask = RTL930X_TX_MAIN_AMP | RTL930X_TX_PRE_AMP_EN | RTL930X_TX_POST_AMP_EN;
|
||||
val = FIELD_PREP(RTL930X_TX_MAIN_AMP, tx_conf->main_amp) |
|
||||
(tx_conf->pre_amp ? RTL930X_TX_PRE_AMP_EN : 0) |
|
||||
(tx_conf->post_amp ? RTL930X_TX_POST_AMP_EN : 0);
|
||||
return rtpcs_sds_write_mask(sds, page, ANA_SPD_EXT_REG07, mask, val);
|
||||
}
|
||||
|
||||
static int rtpcs_930x_sds_rxeq_set_debug(struct rtpcs_serdes *sds, unsigned int debug_sel)
|
||||
|
||||
Reference in new issue
Block a user