realtek: pcs: add setup_serdes callback to rtpcs_cfg

Add a callback for a serdes setup function to rtpcs_cfg to allow each
SoC variant to define its own SerDes setup routine.

Call the setup_serdes operation in pcs_config if it is defined.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/20352
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Jonas Jelonek 2025-10-08 19:37:30 +00:00 committed by Robert Marko
parent 3cf04d2e0b
commit 5b527704b1

View File

@ -78,6 +78,7 @@ struct rtpcs_config {
int mac_tx_pause_sts;
const struct phylink_pcs_ops *pcs_ops;
int (*set_autoneg)(struct rtpcs_ctrl *ctrl, int sds, unsigned int neg_mode);
int (*setup_serdes)(struct rtpcs_ctrl *ctrl, int sds, phy_interface_t mode);
};
static int rtpcs_sds_to_mmd(int sds_page, int sds_regnum)
@ -254,6 +255,12 @@ static int rtpcs_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
mutex_lock(&ctrl->lock);
if (ctrl->cfg->setup_serdes) {
ret = ctrl->cfg->setup_serdes(ctrl, link->sds, interface);
if (ret < 0)
goto out;
}
if (ctrl->cfg->set_autoneg) {
ret = ctrl->cfg->set_autoneg(ctrl, link->sds, neg_mode);
if (ret < 0)