mirror of
https://github.com/openwrt/openwrt.git
synced 2025-12-21 19:14:28 +04:00
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 <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21146
Signed-off-by: Robert Marko <robimarko@gmail.com>
(cherry picked from commit d8dd8bd88f)
This commit is contained in:
committed by
Robert Marko
parent
cf03520c71
commit
d2a34744fe
@@ -168,7 +168,7 @@ struct rtpcs_config {
|
|||||||
|
|
||||||
const struct phylink_pcs_ops *pcs_ops;
|
const struct phylink_pcs_ops *pcs_ops;
|
||||||
int (*init_serdes_common)(struct rtpcs_ctrl *ctrl);
|
int (*init_serdes_common)(struct rtpcs_ctrl *ctrl);
|
||||||
int (*set_autoneg)(struct rtpcs_ctrl *ctrl, int sds, unsigned int neg_mode);
|
int (*set_autoneg)(struct rtpcs_serdes *sds, unsigned int neg_mode);
|
||||||
int (*setup_serdes)(struct rtpcs_serdes *sds, phy_interface_t mode);
|
int (*setup_serdes)(struct rtpcs_serdes *sds, phy_interface_t mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -232,12 +232,12 @@ static int rtpcs_sds_write_bits(struct rtpcs_serdes *sds, int page,
|
|||||||
return rtpcs_sds_write(sds, page, regnum, reg);
|
return rtpcs_sds_write(sds, page, regnum, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtpcs_sds_modify(struct rtpcs_ctrl *ctrl, int sds, int page, int regnum,
|
static int rtpcs_sds_modify(struct rtpcs_serdes *sds, int page, int regnum,
|
||||||
u16 mask, u16 set)
|
u16 mask, u16 set)
|
||||||
{
|
{
|
||||||
int mmd_regnum = rtpcs_sds_to_mmd(page, regnum);
|
int mmd_regnum = rtpcs_sds_to_mmd(page, regnum);
|
||||||
|
|
||||||
return mdiobus_c45_modify(ctrl->bus, sds, MDIO_MMD_VEND1,
|
return mdiobus_c45_modify(sds->ctrl->bus, sds->id, MDIO_MMD_VEND1,
|
||||||
mmd_regnum, mask, set);
|
mmd_regnum, mask, set);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2975,7 +2975,7 @@ static int rtpcs_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ctrl->cfg->set_autoneg) {
|
if (ctrl->cfg->set_autoneg) {
|
||||||
ret = ctrl->cfg->set_autoneg(ctrl, link->sds->id, neg_mode);
|
ret = ctrl->cfg->set_autoneg(link->sds, neg_mode);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@@ -3136,12 +3136,11 @@ static int rtpcs_probe(struct platform_device *pdev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rtpcs_93xx_set_autoneg(struct rtpcs_ctrl *ctrl, int sds,
|
static int rtpcs_93xx_set_autoneg(struct rtpcs_serdes *sds, unsigned int neg_mode)
|
||||||
unsigned int neg_mode)
|
|
||||||
{
|
{
|
||||||
u16 bmcr = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ? BMCR_ANENABLE : 0;
|
u16 bmcr = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED ? BMCR_ANENABLE : 0;
|
||||||
|
|
||||||
return rtpcs_sds_modify(ctrl, sds, 2, MII_BMCR, BMCR_ANENABLE, bmcr);
|
return rtpcs_sds_modify(sds, 2, MII_BMCR, BMCR_ANENABLE, bmcr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct phylink_pcs_ops rtpcs_838x_pcs_ops = {
|
static const struct phylink_pcs_ops rtpcs_838x_pcs_ops = {
|
||||||
|
|||||||
Reference in New Issue
Block a user