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

net: smsc: smc91c92_cs: 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.

As I don't have the hardware, I'd be very pleased if
someone may test this patch.
Signed-off-by: default avatarPhilippe Reynes <tremyfr@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 60269ae1
...@@ -1843,56 +1843,60 @@ static int smc_link_ok(struct net_device *dev) ...@@ -1843,56 +1843,60 @@ static int smc_link_ok(struct net_device *dev)
} }
} }
static int smc_netdev_get_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) static int smc_netdev_get_ecmd(struct net_device *dev,
struct ethtool_link_ksettings *ecmd)
{ {
u16 tmp; u16 tmp;
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
u32 supported;
ecmd->supported = (SUPPORTED_TP | SUPPORTED_AUI | supported = (SUPPORTED_TP | SUPPORTED_AUI |
SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full); SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full);
SMC_SELECT_BANK(1);
tmp = inw(ioaddr + CONFIG);
ecmd->port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP;
ecmd->transceiver = XCVR_INTERNAL;
ethtool_cmd_speed_set(ecmd, SPEED_10);
ecmd->phy_address = ioaddr + MGMT;
SMC_SELECT_BANK(0); SMC_SELECT_BANK(1);
tmp = inw(ioaddr + TCR); tmp = inw(ioaddr + CONFIG);
ecmd->duplex = (tmp & TCR_FDUPLX) ? DUPLEX_FULL : DUPLEX_HALF; ecmd->base.port = (tmp & CFG_AUI_SELECT) ? PORT_AUI : PORT_TP;
ecmd->base.speed = SPEED_10;
ecmd->base.phy_address = ioaddr + MGMT;
return 0; SMC_SELECT_BANK(0);
tmp = inw(ioaddr + TCR);
ecmd->base.duplex = (tmp & TCR_FDUPLX) ? DUPLEX_FULL : DUPLEX_HALF;
ethtool_convert_legacy_u32_to_link_mode(ecmd->link_modes.supported,
supported);
return 0;
} }
static int smc_netdev_set_ecmd(struct net_device *dev, struct ethtool_cmd *ecmd) static int smc_netdev_set_ecmd(struct net_device *dev,
const struct ethtool_link_ksettings *ecmd)
{ {
u16 tmp; u16 tmp;
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
if (ethtool_cmd_speed(ecmd) != SPEED_10) if (ecmd->base.speed != SPEED_10)
return -EINVAL; return -EINVAL;
if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) if (ecmd->base.duplex != DUPLEX_HALF &&
return -EINVAL; ecmd->base.duplex != DUPLEX_FULL)
if (ecmd->port != PORT_TP && ecmd->port != PORT_AUI) return -EINVAL;
return -EINVAL; if (ecmd->base.port != PORT_TP && ecmd->base.port != PORT_AUI)
if (ecmd->transceiver != XCVR_INTERNAL) return -EINVAL;
return -EINVAL;
if (ecmd->port == PORT_AUI) if (ecmd->base.port == PORT_AUI)
smc_set_xcvr(dev, 1); smc_set_xcvr(dev, 1);
else else
smc_set_xcvr(dev, 0); smc_set_xcvr(dev, 0);
SMC_SELECT_BANK(0); SMC_SELECT_BANK(0);
tmp = inw(ioaddr + TCR); tmp = inw(ioaddr + TCR);
if (ecmd->duplex == DUPLEX_FULL) if (ecmd->base.duplex == DUPLEX_FULL)
tmp |= TCR_FDUPLX; tmp |= TCR_FDUPLX;
else else
tmp &= ~TCR_FDUPLX; tmp &= ~TCR_FDUPLX;
outw(tmp, ioaddr + TCR); outw(tmp, ioaddr + TCR);
return 0; return 0;
} }
static int check_if_running(struct net_device *dev) static int check_if_running(struct net_device *dev)
...@@ -1908,7 +1912,8 @@ static void smc_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info ...@@ -1908,7 +1912,8 @@ static void smc_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
strlcpy(info->version, DRV_VERSION, sizeof(info->version)); strlcpy(info->version, DRV_VERSION, sizeof(info->version));
} }
static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) static int smc_get_link_ksettings(struct net_device *dev,
struct ethtool_link_ksettings *ecmd)
{ {
struct smc_private *smc = netdev_priv(dev); struct smc_private *smc = netdev_priv(dev);
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
...@@ -1919,7 +1924,7 @@ static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -1919,7 +1924,7 @@ static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
spin_lock_irqsave(&smc->lock, flags); spin_lock_irqsave(&smc->lock, flags);
SMC_SELECT_BANK(3); SMC_SELECT_BANK(3);
if (smc->cfg & CFG_MII_SELECT) if (smc->cfg & CFG_MII_SELECT)
ret = mii_ethtool_gset(&smc->mii_if, ecmd); ret = mii_ethtool_get_link_ksettings(&smc->mii_if, ecmd);
else else
ret = smc_netdev_get_ecmd(dev, ecmd); ret = smc_netdev_get_ecmd(dev, ecmd);
SMC_SELECT_BANK(saved_bank); SMC_SELECT_BANK(saved_bank);
...@@ -1927,7 +1932,8 @@ static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -1927,7 +1932,8 @@ static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
return ret; return ret;
} }
static int smc_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) static int smc_set_link_ksettings(struct net_device *dev,
const struct ethtool_link_ksettings *ecmd)
{ {
struct smc_private *smc = netdev_priv(dev); struct smc_private *smc = netdev_priv(dev);
unsigned int ioaddr = dev->base_addr; unsigned int ioaddr = dev->base_addr;
...@@ -1938,7 +1944,7 @@ static int smc_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) ...@@ -1938,7 +1944,7 @@ static int smc_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
spin_lock_irqsave(&smc->lock, flags); spin_lock_irqsave(&smc->lock, flags);
SMC_SELECT_BANK(3); SMC_SELECT_BANK(3);
if (smc->cfg & CFG_MII_SELECT) if (smc->cfg & CFG_MII_SELECT)
ret = mii_ethtool_sset(&smc->mii_if, ecmd); ret = mii_ethtool_set_link_ksettings(&smc->mii_if, ecmd);
else else
ret = smc_netdev_set_ecmd(dev, ecmd); ret = smc_netdev_set_ecmd(dev, ecmd);
SMC_SELECT_BANK(saved_bank); SMC_SELECT_BANK(saved_bank);
...@@ -1982,10 +1988,10 @@ static int smc_nway_reset(struct net_device *dev) ...@@ -1982,10 +1988,10 @@ static int smc_nway_reset(struct net_device *dev)
static const struct ethtool_ops ethtool_ops = { static const struct ethtool_ops ethtool_ops = {
.begin = check_if_running, .begin = check_if_running,
.get_drvinfo = smc_get_drvinfo, .get_drvinfo = smc_get_drvinfo,
.get_settings = smc_get_settings,
.set_settings = smc_set_settings,
.get_link = smc_get_link, .get_link = smc_get_link,
.nway_reset = smc_nway_reset, .nway_reset = smc_nway_reset,
.get_link_ksettings = smc_get_link_ksettings,
.set_link_ksettings = smc_set_link_ksettings,
}; };
static int smc_ioctl (struct net_device *dev, struct ifreq *rq, int cmd) static int smc_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
......
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