aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/skge.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index 00d683063c01..f77658192a14 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -88,15 +88,14 @@ MODULE_DEVICE_TABLE(pci, skge_id_table);
88 88
89static int skge_up(struct net_device *dev); 89static int skge_up(struct net_device *dev);
90static int skge_down(struct net_device *dev); 90static int skge_down(struct net_device *dev);
91static void skge_phy_reset(struct skge_port *skge);
91static void skge_tx_clean(struct skge_port *skge); 92static void skge_tx_clean(struct skge_port *skge);
92static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); 93static int xm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val);
93static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val); 94static int gm_phy_write(struct skge_hw *hw, int port, u16 reg, u16 val);
94static void genesis_get_stats(struct skge_port *skge, u64 *data); 95static void genesis_get_stats(struct skge_port *skge, u64 *data);
95static void yukon_get_stats(struct skge_port *skge, u64 *data); 96static void yukon_get_stats(struct skge_port *skge, u64 *data);
96static void yukon_init(struct skge_hw *hw, int port); 97static void yukon_init(struct skge_hw *hw, int port);
97static void yukon_reset(struct skge_hw *hw, int port);
98static void genesis_mac_init(struct skge_hw *hw, int port); 98static void genesis_mac_init(struct skge_hw *hw, int port);
99static void genesis_reset(struct skge_hw *hw, int port);
100static void genesis_link_up(struct skge_port *skge); 99static void genesis_link_up(struct skge_port *skge);
101 100
102/* Avoid conditionals by using array */ 101/* Avoid conditionals by using array */
@@ -276,10 +275,9 @@ static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
276 skge->autoneg = ecmd->autoneg; 275 skge->autoneg = ecmd->autoneg;
277 skge->advertising = ecmd->advertising; 276 skge->advertising = ecmd->advertising;
278 277
279 if (netif_running(dev)) { 278 if (netif_running(dev))
280 skge_down(dev); 279 skge_phy_reset(skge);
281 skge_up(dev); 280
282 }
283 return (0); 281 return (0);
284} 282}
285 283
@@ -430,21 +428,11 @@ static void skge_set_msglevel(struct net_device *netdev, u32 value)
430static int skge_nway_reset(struct net_device *dev) 428static int skge_nway_reset(struct net_device *dev)
431{ 429{
432 struct skge_port *skge = netdev_priv(dev); 430 struct skge_port *skge = netdev_priv(dev);
433 struct skge_hw *hw = skge->hw;
434 int port = skge->port;
435 431
436 if (skge->autoneg != AUTONEG_ENABLE || !netif_running(dev)) 432 if (skge->autoneg != AUTONEG_ENABLE || !netif_running(dev))
437 return -EINVAL; 433 return -EINVAL;
438 434
439 spin_lock_bh(&hw->phy_lock); 435 skge_phy_reset(skge);
440 if (hw->chip_id == CHIP_ID_GENESIS) {
441 genesis_reset(hw, port);
442 genesis_mac_init(hw, port);
443 } else {
444 yukon_reset(hw, port);
445 yukon_init(hw, port);
446 }
447 spin_unlock_bh(&hw->phy_lock);
448 return 0; 436 return 0;
449} 437}
450 438
@@ -2019,6 +2007,25 @@ static void yukon_phy_intr(struct skge_port *skge)
2019 /* XXX restart autonegotiation? */ 2007 /* XXX restart autonegotiation? */
2020} 2008}
2021 2009
2010static void skge_phy_reset(struct skge_port *skge)
2011{
2012 struct skge_hw *hw = skge->hw;
2013 int port = skge->port;
2014
2015 netif_stop_queue(skge->netdev);
2016 netif_carrier_off(skge->netdev);
2017
2018 spin_lock_bh(&hw->phy_lock);
2019 if (hw->chip_id == CHIP_ID_GENESIS) {
2020 genesis_reset(hw, port);
2021 genesis_mac_init(hw, port);
2022 } else {
2023 yukon_reset(hw, port);
2024 yukon_init(hw, port);
2025 }
2026 spin_unlock_bh(&hw->phy_lock);
2027}
2028
2022/* Basic MII support */ 2029/* Basic MII support */
2023static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 2030static int skge_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
2024{ 2031{