Skip to content

Commit d2a3474

Browse files
jonasjelonekrobimarko
authored andcommitted
realtek: pcs: make use of SerDes struct in set_autoneg
Also switch set_autoneg (and related helper rtpcs_sds_modify) to the SerDes struct instead of the plain SerDes id by using just the reference to the SerDes instance instead of (ctrl, sds_id) tuple. This completes the transition. Signed-off-by: Jonas Jelonek <[email protected]> Link: openwrt/openwrt#21146 Signed-off-by: Robert Marko <[email protected]> (cherry picked from commit d8dd8bd)
1 parent cf03520 commit d2a3474

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ struct rtpcs_config {
168168

169169
const struct phylink_pcs_ops *pcs_ops;
170170
int (*init_serdes_common)(struct rtpcs_ctrl *ctrl);
171-
int (*set_autoneg)(struct rtpcs_ctrl *ctrl, int sds, unsigned int neg_mode);
171+
int (*set_autoneg)(struct rtpcs_serdes *sds, unsigned int neg_mode);
172172
int (*setup_serdes)(struct rtpcs_serdes *sds, phy_interface_t mode);
173173
};
174174

@@ -232,12 +232,12 @@ static int rtpcs_sds_write_bits(struct rtpcs_serdes *sds, int page,
232232
return rtpcs_sds_write(sds, page, regnum, reg);
233233
}
234234

235-
static int rtpcs_sds_modify(struct rtpcs_ctrl *ctrl, int sds, int page, int regnum,
235+
static int rtpcs_sds_modify(struct rtpcs_serdes *sds, int page, int regnum,
236236
u16 mask, u16 set)
237237
{
238238
int mmd_regnum = rtpcs_sds_to_mmd(page, regnum);
239239

240-
return mdiobus_c45_modify(ctrl->bus, sds, MDIO_MMD_VEND1,
240+
return mdiobus_c45_modify(sds->ctrl->bus, sds->id, MDIO_MMD_VEND1,
241241
mmd_regnum, mask, set);
242242
}
243243

@@ -2975,7 +2975,7 @@ static int rtpcs_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
29752975
}
29762976

29772977
if (ctrl->cfg->set_autoneg) {
2978-
ret = ctrl->cfg->set_autoneg(ctrl, link->sds->id, neg_mode);
2978+
ret = ctrl->cfg->set_autoneg(link->sds, neg_mode);
29792979
if (ret < 0)
29802980
goto out;
29812981
}
@@ -3136,12 +3136,11 @@ static int rtpcs_probe(struct platform_device *pdev)
31363136
return 0;
31373137
}
31383138

3139-
static int rtpcs_93xx_set_autoneg(struct rtpcs_ctrl *ctrl, int sds,
3140-
unsigned int neg_mode)
3139+
static int rtpcs_93xx_set_autoneg(struct rtpcs_serdes *sds, unsigned int neg_mode)
31413140
{
31423141
u16 bmcr = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ? BMCR_ANENABLE : 0;
31433142

3144-
return rtpcs_sds_modify(ctrl, sds, 2, MII_BMCR, BMCR_ANENABLE, bmcr);
3143+
return rtpcs_sds_modify(sds, 2, MII_BMCR, BMCR_ANENABLE, bmcr);
31453144
}
31463145

31473146
static const struct phylink_pcs_ops rtpcs_838x_pcs_ops = {

0 commit comments

Comments
 (0)