diff options
author | Philippe Reynes <tremyfr@gmail.com> | 2016-07-17 17:30:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-18 02:22:02 -0400 |
commit | 2186f6eec2739ecd3944f9278e59edf0474f207c (patch) | |
tree | dcef0df7481b839c2a1cdcf55638a0e00eb4817a /drivers/net/ethernet/marvell | |
parent | 7d32184513baca1b66383825d57e24be62af40d1 (diff) |
net: ethernet: marvell: pxa168_eth: use phy_ethtool_{get|set}_link_ksettings
There are two generics functions phy_ethtool_{get|set}_link_ksettings,
so we can use them instead of defining the same code in the driver.
Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell')
-rw-r--r-- | drivers/net/ethernet/marvell/pxa168_eth.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c index d46632601b86..aeeb2e79a91a 100644 --- a/drivers/net/ethernet/marvell/pxa168_eth.c +++ b/drivers/net/ethernet/marvell/pxa168_eth.c | |||
@@ -274,8 +274,8 @@ enum hash_table_entry { | |||
274 | HASH_ENTRY_RECEIVE_DISCARD_BIT = 2 | 274 | HASH_ENTRY_RECEIVE_DISCARD_BIT = 2 |
275 | }; | 275 | }; |
276 | 276 | ||
277 | static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); | 277 | static int pxa168_get_link_ksettings(struct net_device *dev, |
278 | static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd); | 278 | struct ethtool_link_ksettings *cmd); |
279 | static int pxa168_init_hw(struct pxa168_eth_private *pep); | 279 | static int pxa168_init_hw(struct pxa168_eth_private *pep); |
280 | static int pxa168_init_phy(struct net_device *dev); | 280 | static int pxa168_init_phy(struct net_device *dev); |
281 | static void eth_port_reset(struct net_device *dev); | 281 | static void eth_port_reset(struct net_device *dev); |
@@ -971,7 +971,7 @@ static void pxa168_eth_adjust_link(struct net_device *dev) | |||
971 | static int pxa168_init_phy(struct net_device *dev) | 971 | static int pxa168_init_phy(struct net_device *dev) |
972 | { | 972 | { |
973 | struct pxa168_eth_private *pep = netdev_priv(dev); | 973 | struct pxa168_eth_private *pep = netdev_priv(dev); |
974 | struct ethtool_cmd cmd; | 974 | struct ethtool_link_ksettings cmd; |
975 | struct phy_device *phy = NULL; | 975 | struct phy_device *phy = NULL; |
976 | int err; | 976 | int err; |
977 | 977 | ||
@@ -987,20 +987,21 @@ static int pxa168_init_phy(struct net_device *dev) | |||
987 | if (err) | 987 | if (err) |
988 | return err; | 988 | return err; |
989 | 989 | ||
990 | err = pxa168_get_settings(dev, &cmd); | 990 | err = pxa168_get_link_ksettings(dev, &cmd); |
991 | if (err) | 991 | if (err) |
992 | return err; | 992 | return err; |
993 | 993 | ||
994 | cmd.phy_address = pep->phy_addr; | 994 | cmd.base.phy_address = pep->phy_addr; |
995 | cmd.speed = pep->phy_speed; | 995 | cmd.base.speed = pep->phy_speed; |
996 | cmd.duplex = pep->phy_duplex; | 996 | cmd.base.duplex = pep->phy_duplex; |
997 | cmd.advertising = PHY_BASIC_FEATURES; | 997 | ethtool_convert_legacy_u32_to_link_mode(cmd.link_modes.advertising, |
998 | cmd.autoneg = AUTONEG_ENABLE; | 998 | PHY_BASIC_FEATURES); |
999 | cmd.base.autoneg = AUTONEG_ENABLE; | ||
999 | 1000 | ||
1000 | if (cmd.speed != 0) | 1001 | if (cmd.base.speed != 0) |
1001 | cmd.autoneg = AUTONEG_DISABLE; | 1002 | cmd.base.autoneg = AUTONEG_DISABLE; |
1002 | 1003 | ||
1003 | return pxa168_set_settings(dev, &cmd); | 1004 | return phy_ethtool_set_link_ksettings(dev, &cmd); |
1004 | } | 1005 | } |
1005 | 1006 | ||
1006 | static int pxa168_init_hw(struct pxa168_eth_private *pep) | 1007 | static int pxa168_init_hw(struct pxa168_eth_private *pep) |
@@ -1372,22 +1373,18 @@ static int pxa168_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, | |||
1372 | return -EOPNOTSUPP; | 1373 | return -EOPNOTSUPP; |
1373 | } | 1374 | } |
1374 | 1375 | ||
1375 | static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 1376 | static int pxa168_get_link_ksettings(struct net_device *dev, |
1377 | struct ethtool_link_ksettings *cmd) | ||
1376 | { | 1378 | { |
1377 | int err; | 1379 | int err; |
1378 | 1380 | ||
1379 | err = phy_read_status(dev->phydev); | 1381 | err = phy_read_status(dev->phydev); |
1380 | if (err == 0) | 1382 | if (err == 0) |
1381 | err = phy_ethtool_gset(dev->phydev, cmd); | 1383 | err = phy_ethtool_ksettings_get(dev->phydev, cmd); |
1382 | 1384 | ||
1383 | return err; | 1385 | return err; |
1384 | } | 1386 | } |
1385 | 1387 | ||
1386 | static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
1387 | { | ||
1388 | return phy_ethtool_sset(dev->phydev, cmd); | ||
1389 | } | ||
1390 | |||
1391 | static void pxa168_get_drvinfo(struct net_device *dev, | 1388 | static void pxa168_get_drvinfo(struct net_device *dev, |
1392 | struct ethtool_drvinfo *info) | 1389 | struct ethtool_drvinfo *info) |
1393 | { | 1390 | { |
@@ -1398,11 +1395,11 @@ static void pxa168_get_drvinfo(struct net_device *dev, | |||
1398 | } | 1395 | } |
1399 | 1396 | ||
1400 | static const struct ethtool_ops pxa168_ethtool_ops = { | 1397 | static const struct ethtool_ops pxa168_ethtool_ops = { |
1401 | .get_settings = pxa168_get_settings, | ||
1402 | .set_settings = pxa168_set_settings, | ||
1403 | .get_drvinfo = pxa168_get_drvinfo, | 1398 | .get_drvinfo = pxa168_get_drvinfo, |
1404 | .get_link = ethtool_op_get_link, | 1399 | .get_link = ethtool_op_get_link, |
1405 | .get_ts_info = ethtool_op_get_ts_info, | 1400 | .get_ts_info = ethtool_op_get_ts_info, |
1401 | .get_link_ksettings = pxa168_get_link_ksettings, | ||
1402 | .set_link_ksettings = phy_ethtool_set_link_ksettings, | ||
1406 | }; | 1403 | }; |
1407 | 1404 | ||
1408 | static const struct net_device_ops pxa168_eth_netdev_ops = { | 1405 | static const struct net_device_ops pxa168_eth_netdev_ops = { |