net: stmmac: meson8b: use stmmac_get_phy_intf_sel()
Use stmmac_get_phy_intf_sel() to decode the PHY interface mode to the phy_intf_sel value, validate the result and use that to set the control register to select the operating mode for the DWMAC core. Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1vIT6b-0000000DpPX-1LQ0@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
52d639da6f
commit
da3d150123
@@ -238,22 +238,12 @@ static int meson_axg_set_phy_mode(struct meson8b_dwmac *dwmac)
|
||||
{
|
||||
int phy_intf_sel;
|
||||
|
||||
switch (dwmac->phy_mode) {
|
||||
case PHY_INTERFACE_MODE_RGMII:
|
||||
case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||
case PHY_INTERFACE_MODE_RGMII_ID:
|
||||
case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||
/* enable RGMII mode */
|
||||
phy_intf_sel = PHY_INTF_SEL_RGMII;
|
||||
break;
|
||||
case PHY_INTERFACE_MODE_RMII:
|
||||
/* disable RGMII mode -> enables RMII mode */
|
||||
phy_intf_sel = PHY_INTF_SEL_RMII;
|
||||
break;
|
||||
default:
|
||||
phy_intf_sel = stmmac_get_phy_intf_sel(dwmac->phy_mode);
|
||||
if (phy_intf_sel != PHY_INTF_SEL_RGMII &&
|
||||
phy_intf_sel != PHY_INTF_SEL_RMII) {
|
||||
dev_err(dwmac->dev, "fail to set phy-mode %s\n",
|
||||
phy_modes(dwmac->phy_mode));
|
||||
return -EINVAL;
|
||||
return phy_intf_sel < 0 ? phy_intf_sel : -EINVAL;
|
||||
}
|
||||
|
||||
meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, PRG_ETH0_EXT_PHY_MODE_MASK,
|
||||
|
||||
Reference in New Issue
Block a user