Skip to content

Commit

Permalink
net: dsa: microchip: ksz9477: separate phylink mode from switch register
Browse files Browse the repository at this point in the history
As per 'commit 3506b2f ("net: dsa: microchip: call
phy_remove_link_mode during probe")' phy_remove_link_mode is added in
the switch_register function after dsa_switch_register. In order to have
the common switch register function, moving this phylink validation to
phylink_get_caps validation hook.

Signed-off-by: Arun Ramadoss <arun.ramadoss@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Arun Ramadoss authored and David S. Miller committed Jun 24, 2022
1 parent 1958eee commit 7a8988a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 26 deletions.
31 changes: 6 additions & 25 deletions drivers/net/dsa/microchip/ksz9477.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,11 @@ static void ksz9477_phy_errata_setup(struct ksz_device *dev, int port)
static void ksz9477_get_caps(struct ksz_device *dev, int port,
struct phylink_config *config)
{
config->mac_capabilities = MAC_10 | MAC_100 | MAC_1000FD |
MAC_ASYM_PAUSE | MAC_SYM_PAUSE;
config->mac_capabilities = MAC_10 | MAC_100 | MAC_ASYM_PAUSE |
MAC_SYM_PAUSE;

if (dev->features & GBIT_SUPPORT)
config->mac_capabilities |= MAC_1000FD;
}

static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
Expand Down Expand Up @@ -1381,29 +1384,7 @@ static const struct ksz_dev_ops ksz9477_dev_ops = {

int ksz9477_switch_register(struct ksz_device *dev)
{
int ret, i;
struct phy_device *phydev;

ret = ksz_switch_register(dev, &ksz9477_dev_ops);
if (ret)
return ret;

for (i = 0; i < dev->phy_port_cnt; ++i) {
if (!dsa_is_user_port(dev->ds, i))
continue;

phydev = dsa_to_port(dev->ds, i)->slave->phydev;

/* The MAC actually cannot run in 1000 half-duplex mode. */
phy_remove_link_mode(phydev,
ETHTOOL_LINK_MODE_1000baseT_Half_BIT);

/* PHY does not support gigabit. */
if (!(dev->features & GBIT_SUPPORT))
phy_remove_link_mode(phydev,
ETHTOOL_LINK_MODE_1000baseT_Full_BIT);
}
return ret;
return ksz_switch_register(dev, &ksz9477_dev_ops);
}
EXPORT_SYMBOL(ksz9477_switch_register);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/dsa/microchip/ksz_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ int ksz_switch_register(struct ksz_device *dev,
/* Start the MIB timer. */
schedule_delayed_work(&dev->mib_read, 0);

return 0;
return ret;
}
EXPORT_SYMBOL(ksz_switch_register);

Expand Down

0 comments on commit 7a8988a

Please sign in to comment.