Commit a54e1612 authored by Philippe Reynes's avatar Philippe Reynes Committed by David S. Miller

net: mv643xx_eth: use new api ethtool_{get|set}_link_ksettings

The ethtool api {get|set}_settings is deprecated.
We move this driver to new api {get|set}_link_ksettings.
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e8a655d
...@@ -1495,56 +1495,69 @@ static const struct mv643xx_eth_stats mv643xx_eth_stats[] = { ...@@ -1495,56 +1495,69 @@ static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
}; };
static int static int
mv643xx_eth_get_settings_phy(struct mv643xx_eth_private *mp, mv643xx_eth_get_link_ksettings_phy(struct mv643xx_eth_private *mp,
struct ethtool_cmd *cmd) struct ethtool_link_ksettings *cmd)
{ {
struct net_device *dev = mp->dev; struct net_device *dev = mp->dev;
int err; int err;
u32 supported, advertising;
err = phy_read_status(dev->phydev); err = phy_read_status(dev->phydev);
if (err == 0) if (err == 0)
err = phy_ethtool_gset(dev->phydev, cmd); err = phy_ethtool_ksettings_get(dev->phydev, cmd);
/* /*
* The MAC does not support 1000baseT_Half. * The MAC does not support 1000baseT_Half.
*/ */
cmd->supported &= ~SUPPORTED_1000baseT_Half; ethtool_convert_link_mode_to_legacy_u32(&supported,
cmd->advertising &= ~ADVERTISED_1000baseT_Half; cmd->link_modes.supported);
ethtool_convert_link_mode_to_legacy_u32(&advertising,
cmd->link_modes.advertising);
supported &= ~SUPPORTED_1000baseT_Half;
advertising &= ~ADVERTISED_1000baseT_Half;
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
supported);
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
advertising);
return err; return err;
} }
static int static int
mv643xx_eth_get_settings_phyless(struct mv643xx_eth_private *mp, mv643xx_eth_get_link_ksettings_phyless(struct mv643xx_eth_private *mp,
struct ethtool_cmd *cmd) struct ethtool_link_ksettings *cmd)
{ {
u32 port_status; u32 port_status;
u32 supported, advertising;
port_status = rdlp(mp, PORT_STATUS); port_status = rdlp(mp, PORT_STATUS);
cmd->supported = SUPPORTED_MII; supported = SUPPORTED_MII;
cmd->advertising = ADVERTISED_MII; advertising = ADVERTISED_MII;
switch (port_status & PORT_SPEED_MASK) { switch (port_status & PORT_SPEED_MASK) {
case PORT_SPEED_10: case PORT_SPEED_10:
ethtool_cmd_speed_set(cmd, SPEED_10); cmd->base.speed = SPEED_10;
break; break;
case PORT_SPEED_100: case PORT_SPEED_100:
ethtool_cmd_speed_set(cmd, SPEED_100); cmd->base.speed = SPEED_100;
break; break;
case PORT_SPEED_1000: case PORT_SPEED_1000:
ethtool_cmd_speed_set(cmd, SPEED_1000); cmd->base.speed = SPEED_1000;
break; break;
default: default:
cmd->speed = -1; cmd->base.speed = -1;
break; break;
} }
cmd->duplex = (port_status & FULL_DUPLEX) ? DUPLEX_FULL : DUPLEX_HALF; cmd->base.duplex = (port_status & FULL_DUPLEX) ?
cmd->port = PORT_MII; DUPLEX_FULL : DUPLEX_HALF;
cmd->phy_address = 0; cmd->base.port = PORT_MII;
cmd->transceiver = XCVR_INTERNAL; cmd->base.phy_address = 0;
cmd->autoneg = AUTONEG_DISABLE; cmd->base.autoneg = AUTONEG_DISABLE;
cmd->maxtxpkt = 1;
cmd->maxrxpkt = 1; ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
supported);
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
advertising);
return 0; return 0;
} }
...@@ -1576,19 +1589,23 @@ mv643xx_eth_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) ...@@ -1576,19 +1589,23 @@ mv643xx_eth_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
} }
static int static int
mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) mv643xx_eth_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *cmd)
{ {
struct mv643xx_eth_private *mp = netdev_priv(dev); struct mv643xx_eth_private *mp = netdev_priv(dev);
if (dev->phydev) if (dev->phydev)
return mv643xx_eth_get_settings_phy(mp, cmd); return mv643xx_eth_get_link_ksettings_phy(mp, cmd);
else else
return mv643xx_eth_get_settings_phyless(mp, cmd); return mv643xx_eth_get_link_ksettings_phyless(mp, cmd);
} }
static int static int
mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) mv643xx_eth_set_link_ksettings(struct net_device *dev,
const struct ethtool_link_ksettings *cmd)
{ {
struct ethtool_link_ksettings c = *cmd;
u32 advertising;
int ret; int ret;
if (!dev->phydev) if (!dev->phydev)
...@@ -1597,9 +1614,13 @@ mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) ...@@ -1597,9 +1614,13 @@ mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
/* /*
* The MAC does not support 1000baseT_Half. * The MAC does not support 1000baseT_Half.
*/ */
cmd->advertising &= ~ADVERTISED_1000baseT_Half; ethtool_convert_link_mode_to_legacy_u32(&advertising,
c.link_modes.advertising);
advertising &= ~ADVERTISED_1000baseT_Half;
ethtool_convert_legacy_u32_to_link_mode(c.link_modes.advertising,
advertising);
ret = phy_ethtool_sset(dev->phydev, cmd); ret = phy_ethtool_ksettings_set(dev->phydev, &c);
if (!ret) if (!ret)
mv643xx_eth_adjust_link(dev); mv643xx_eth_adjust_link(dev);
return ret; return ret;
...@@ -1746,8 +1767,6 @@ static int mv643xx_eth_get_sset_count(struct net_device *dev, int sset) ...@@ -1746,8 +1767,6 @@ static int mv643xx_eth_get_sset_count(struct net_device *dev, int sset)
} }
static const struct ethtool_ops mv643xx_eth_ethtool_ops = { static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
.get_settings = mv643xx_eth_get_settings,
.set_settings = mv643xx_eth_set_settings,
.get_drvinfo = mv643xx_eth_get_drvinfo, .get_drvinfo = mv643xx_eth_get_drvinfo,
.nway_reset = mv643xx_eth_nway_reset, .nway_reset = mv643xx_eth_nway_reset,
.get_link = ethtool_op_get_link, .get_link = ethtool_op_get_link,
...@@ -1761,6 +1780,8 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = { ...@@ -1761,6 +1780,8 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
.get_ts_info = ethtool_op_get_ts_info, .get_ts_info = ethtool_op_get_ts_info,
.get_wol = mv643xx_eth_get_wol, .get_wol = mv643xx_eth_get_wol,
.set_wol = mv643xx_eth_set_wol, .set_wol = mv643xx_eth_set_wol,
.get_link_ksettings = mv643xx_eth_get_link_ksettings,
.set_link_ksettings = mv643xx_eth_set_link_ksettings,
}; };
...@@ -2328,11 +2349,12 @@ static void port_start(struct mv643xx_eth_private *mp) ...@@ -2328,11 +2349,12 @@ static void port_start(struct mv643xx_eth_private *mp)
* Perform PHY reset, if there is a PHY. * Perform PHY reset, if there is a PHY.
*/ */
if (dev->phydev) { if (dev->phydev) {
struct ethtool_cmd cmd; struct ethtool_link_ksettings cmd;
mv643xx_eth_get_settings(dev, &cmd); mv643xx_eth_get_link_ksettings(dev, &cmd);
phy_init_hw(dev->phydev); phy_init_hw(dev->phydev);
mv643xx_eth_set_settings(dev, &cmd); mv643xx_eth_set_link_ksettings(
dev, (const struct ethtool_link_ksettings *)&cmd);
phy_start(dev->phydev); phy_start(dev->phydev);
} }
......
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