Commit c125c66e authored by Russell King (Oracle)'s avatar Russell King (Oracle) Committed by Jakub Kicinski

net: mtk_eth_soc: add advertisement programming

Program the advertisement into the mtk PCS block.
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f752c0df
...@@ -70,16 +70,27 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode, ...@@ -70,16 +70,27 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
{ {
struct mtk_pcs *mpcs = pcs_to_mtk_pcs(pcs); struct mtk_pcs *mpcs = pcs_to_mtk_pcs(pcs);
unsigned int rgc3; unsigned int rgc3;
int advertise;
bool changed;
if (interface == PHY_INTERFACE_MODE_2500BASEX) if (interface == PHY_INTERFACE_MODE_2500BASEX)
rgc3 = RG_PHY_SPEED_3_125G; rgc3 = RG_PHY_SPEED_3_125G;
else else
rgc3 = 0; rgc3 = 0;
advertise = phylink_mii_c22_pcs_encode_advertisement(interface,
advertising);
if (advertise < 0)
return advertise;
/* Configure the underlying interface speed */ /* Configure the underlying interface speed */
regmap_update_bits(mpcs->regmap, mpcs->ana_rgc3, regmap_update_bits(mpcs->regmap, mpcs->ana_rgc3,
RG_PHY_SPEED_3_125G, rgc3); RG_PHY_SPEED_3_125G, rgc3);
/* Update the advertisement, noting whether it has changed */
regmap_update_bits_check(mpcs->regmap, SGMSYS_PCS_ADVERTISE,
SGMII_ADVERTISE, advertise, &changed);
/* Setup SGMIISYS with the determined property */ /* Setup SGMIISYS with the determined property */
if (interface != PHY_INTERFACE_MODE_SGMII) if (interface != PHY_INTERFACE_MODE_SGMII)
mtk_pcs_setup_mode_force(mpcs, interface); mtk_pcs_setup_mode_force(mpcs, interface);
...@@ -90,7 +101,7 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode, ...@@ -90,7 +101,7 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, regmap_update_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL,
SGMII_PHYA_PWD, 0); SGMII_PHYA_PWD, 0);
return 0; return changed;
} }
static void mtk_pcs_restart_an(struct phylink_pcs *pcs) static void mtk_pcs_restart_an(struct phylink_pcs *pcs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment