diff options
author | Mike McCormack <mikem@ring3k.org> | 2010-02-12 01:58:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-12 19:21:03 -0500 |
commit | ea0f71e59c20ea1e413cacfc971e051b3d6c6f64 (patch) | |
tree | 9b86b5dc7b3f0c34d2b0e53ab025e6d0a3d86782 /drivers/net/sky2.c | |
parent | 200ac492b3c366346fcabd11897fadbd1a7a6599 (diff) |
sky2: Refactor sky2_up into two functions
Move hardware initialization into sky2_hw_up.
Signed-off-by: Mike McCormack <mikem@ring3k.org>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 493a82018cbd..1f0180f1f0c3 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -1525,16 +1525,16 @@ static void sky2_free_buffers(struct sky2_port *sky2) | |||
1525 | sky2->rx_ring = NULL; | 1525 | sky2->rx_ring = NULL; |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | /* Bring up network interface. */ | 1528 | static void sky2_hw_up(struct sky2_port *sky2) |
1529 | static int sky2_up(struct net_device *dev) | ||
1530 | { | 1529 | { |
1531 | struct sky2_port *sky2 = netdev_priv(dev); | ||
1532 | struct sky2_hw *hw = sky2->hw; | 1530 | struct sky2_hw *hw = sky2->hw; |
1533 | unsigned port = sky2->port; | 1531 | unsigned port = sky2->port; |
1534 | u32 imask, ramsize; | 1532 | u32 ramsize; |
1535 | int cap, err; | 1533 | int cap; |
1536 | struct net_device *otherdev = hw->dev[sky2->port^1]; | 1534 | struct net_device *otherdev = hw->dev[sky2->port^1]; |
1537 | 1535 | ||
1536 | tx_init(sky2); | ||
1537 | |||
1538 | /* | 1538 | /* |
1539 | * On dual port PCI-X card, there is an problem where status | 1539 | * On dual port PCI-X card, there is an problem where status |
1540 | * can be received out of order due to split transactions | 1540 | * can be received out of order due to split transactions |
@@ -1546,16 +1546,7 @@ static int sky2_up(struct net_device *dev) | |||
1546 | cmd = sky2_pci_read16(hw, cap + PCI_X_CMD); | 1546 | cmd = sky2_pci_read16(hw, cap + PCI_X_CMD); |
1547 | cmd &= ~PCI_X_CMD_MAX_SPLIT; | 1547 | cmd &= ~PCI_X_CMD_MAX_SPLIT; |
1548 | sky2_pci_write16(hw, cap + PCI_X_CMD, cmd); | 1548 | sky2_pci_write16(hw, cap + PCI_X_CMD, cmd); |
1549 | 1549 | } | |
1550 | } | ||
1551 | |||
1552 | netif_carrier_off(dev); | ||
1553 | |||
1554 | err = sky2_alloc_buffers(sky2); | ||
1555 | if (err) | ||
1556 | goto err_out; | ||
1557 | |||
1558 | tx_init(sky2); | ||
1559 | 1550 | ||
1560 | sky2_mac_init(hw, port); | 1551 | sky2_mac_init(hw, port); |
1561 | 1552 | ||
@@ -1564,7 +1555,7 @@ static int sky2_up(struct net_device *dev) | |||
1564 | if (ramsize > 0) { | 1555 | if (ramsize > 0) { |
1565 | u32 rxspace; | 1556 | u32 rxspace; |
1566 | 1557 | ||
1567 | pr_debug(PFX "%s: ram buffer %dK\n", dev->name, ramsize); | 1558 | pr_debug(PFX "%s: ram buffer %dK\n", sky2->netdev->name, ramsize); |
1568 | if (ramsize < 16) | 1559 | if (ramsize < 16) |
1569 | rxspace = ramsize / 2; | 1560 | rxspace = ramsize / 2; |
1570 | else | 1561 | else |
@@ -1597,6 +1588,24 @@ static int sky2_up(struct net_device *dev) | |||
1597 | #endif | 1588 | #endif |
1598 | 1589 | ||
1599 | sky2_rx_start(sky2); | 1590 | sky2_rx_start(sky2); |
1591 | } | ||
1592 | |||
1593 | /* Bring up network interface. */ | ||
1594 | static int sky2_up(struct net_device *dev) | ||
1595 | { | ||
1596 | struct sky2_port *sky2 = netdev_priv(dev); | ||
1597 | struct sky2_hw *hw = sky2->hw; | ||
1598 | unsigned port = sky2->port; | ||
1599 | u32 imask; | ||
1600 | int err; | ||
1601 | |||
1602 | netif_carrier_off(dev); | ||
1603 | |||
1604 | err = sky2_alloc_buffers(sky2); | ||
1605 | if (err) | ||
1606 | goto err_out; | ||
1607 | |||
1608 | sky2_hw_up(sky2); | ||
1600 | 1609 | ||
1601 | /* Enable interrupts from phy/mac for port */ | 1610 | /* Enable interrupts from phy/mac for port */ |
1602 | imask = sky2_read32(hw, B0_IMSK); | 1611 | imask = sky2_read32(hw, B0_IMSK); |