summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/marvell10g.c
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2023-11-24 13:28:03 +0100
committerJakub Kicinski <kuba@kernel.org>2023-11-28 03:04:11 +0100
commit82f2e76b660a490ae226db80d495b7c785e00d7a (patch)
tree51e4e2b7455fd4aa9d1cad4d16cbe6d346a44e08 /drivers/net/phy/marvell10g.c
parentnet: phy: marvell10g: table driven mactype decode (diff)
downloadlinux-82f2e76b660a490ae226db80d495b7c785e00d7a.tar.xz
linux-82f2e76b660a490ae226db80d495b7c785e00d7a.zip
net: phy: marvell10g: fill in possible_interfaces
Fill in the possible_interfaces member according to the selected mactype mode. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/E1r6VHv-00DDLZ-OL@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/phy/marvell10g.c')
-rw-r--r--drivers/net/phy/marvell10g.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index a880b3375dee..ad43e280930c 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -803,6 +803,22 @@ static const struct mv3310_mactype mv3340_mactypes[] = {
},
};
+static void mv3310_fill_possible_interfaces(struct phy_device *phydev)
+{
+ struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
+ unsigned long *possible = phydev->possible_interfaces;
+ const struct mv3310_mactype *mactype = priv->mactype;
+
+ if (mactype->interface_10g != PHY_INTERFACE_MODE_NA)
+ __set_bit(priv->mactype->interface_10g, possible);
+
+ if (!mactype->fixed_interface) {
+ __set_bit(PHY_INTERFACE_MODE_5GBASER, possible);
+ __set_bit(PHY_INTERFACE_MODE_2500BASEX, possible);
+ __set_bit(PHY_INTERFACE_MODE_SGMII, possible);
+ }
+}
+
static int mv3310_config_init(struct phy_device *phydev)
{
struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
@@ -845,6 +861,8 @@ static int mv3310_config_init(struct phy_device *phydev)
priv->mactype = &chip->mactypes[mactype];
+ mv3310_fill_possible_interfaces(phydev);
+
/* Enable EDPD mode - saving 600mW */
err = mv3310_set_edpd(phydev, ETHTOOL_PHY_EDPD_DFLT_TX_MSECS);
if (err)