aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Zambrano <zambrano@broadcom.com>2006-06-20 18:34:26 -0400
committerJeff Garzik <jeff@garzik.org>2006-06-22 23:16:13 -0400
commit00e8b3aa1cfd7577fd4019a24f7c3980506f83f3 (patch)
treebcdc179045db7ba908671ec864caf3cca74282ae
parent52cafd965507b7a7bb962486539f6d7422552692 (diff)
[PATCH] b44: add parameter
This patch adds a parameter to init_hw() to not completely initialize the nic for wol. Signed-off-by: Gary Zambrano <zambrano@broadcom.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r--drivers/net/b44.c49
1 files changed, 28 insertions, 21 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 73ca729e4cd7..12fc67a740ea 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -101,7 +101,7 @@ MODULE_DEVICE_TABLE(pci, b44_pci_tbl);
101 101
102static void b44_halt(struct b44 *); 102static void b44_halt(struct b44 *);
103static void b44_init_rings(struct b44 *); 103static void b44_init_rings(struct b44 *);
104static void b44_init_hw(struct b44 *); 104static void b44_init_hw(struct b44 *, int);
105 105
106static int dma_desc_align_mask; 106static int dma_desc_align_mask;
107static int dma_desc_sync_size; 107static int dma_desc_sync_size;
@@ -873,7 +873,7 @@ static int b44_poll(struct net_device *netdev, int *budget)
873 spin_lock_irq(&bp->lock); 873 spin_lock_irq(&bp->lock);
874 b44_halt(bp); 874 b44_halt(bp);
875 b44_init_rings(bp); 875 b44_init_rings(bp);
876 b44_init_hw(bp); 876 b44_init_hw(bp, 1);
877 netif_wake_queue(bp->dev); 877 netif_wake_queue(bp->dev);
878 spin_unlock_irq(&bp->lock); 878 spin_unlock_irq(&bp->lock);
879 done = 1; 879 done = 1;
@@ -942,7 +942,7 @@ static void b44_tx_timeout(struct net_device *dev)
942 942
943 b44_halt(bp); 943 b44_halt(bp);
944 b44_init_rings(bp); 944 b44_init_rings(bp);
945 b44_init_hw(bp); 945 b44_init_hw(bp, 1);
946 946
947 spin_unlock_irq(&bp->lock); 947 spin_unlock_irq(&bp->lock);
948 948
@@ -1059,7 +1059,7 @@ static int b44_change_mtu(struct net_device *dev, int new_mtu)
1059 b44_halt(bp); 1059 b44_halt(bp);
1060 dev->mtu = new_mtu; 1060 dev->mtu = new_mtu;
1061 b44_init_rings(bp); 1061 b44_init_rings(bp);
1062 b44_init_hw(bp); 1062 b44_init_hw(bp, 1);
1063 spin_unlock_irq(&bp->lock); 1063 spin_unlock_irq(&bp->lock);
1064 1064
1065 b44_enable_ints(bp); 1065 b44_enable_ints(bp);
@@ -1356,13 +1356,15 @@ static int b44_set_mac_addr(struct net_device *dev, void *p)
1356 * packet processing. Invoked with bp->lock held. 1356 * packet processing. Invoked with bp->lock held.
1357 */ 1357 */
1358static void __b44_set_rx_mode(struct net_device *); 1358static void __b44_set_rx_mode(struct net_device *);
1359static void b44_init_hw(struct b44 *bp) 1359static void b44_init_hw(struct b44 *bp, int full_reset)
1360{ 1360{
1361 u32 val; 1361 u32 val;
1362 1362
1363 b44_chip_reset(bp); 1363 b44_chip_reset(bp);
1364 b44_phy_reset(bp); 1364 if (full_reset) {
1365 b44_setup_phy(bp); 1365 b44_phy_reset(bp);
1366 b44_setup_phy(bp);
1367 }
1366 1368
1367 /* Enable CRC32, set proper LED modes and power on PHY */ 1369 /* Enable CRC32, set proper LED modes and power on PHY */
1368 bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL); 1370 bw32(bp, B44_MAC_CTRL, MAC_CTRL_CRC32_ENAB | MAC_CTRL_PHY_LEDCTRL);
@@ -1376,16 +1378,21 @@ static void b44_init_hw(struct b44 *bp)
1376 bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN); 1378 bw32(bp, B44_TXMAXLEN, bp->dev->mtu + ETH_HLEN + 8 + RX_HEADER_LEN);
1377 1379
1378 bw32(bp, B44_TX_WMARK, 56); /* XXX magic */ 1380 bw32(bp, B44_TX_WMARK, 56); /* XXX magic */
1379 bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE); 1381 if (full_reset) {
1380 bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset); 1382 bw32(bp, B44_DMATX_CTRL, DMATX_CTRL_ENABLE);
1381 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE | 1383 bw32(bp, B44_DMATX_ADDR, bp->tx_ring_dma + bp->dma_offset);
1382 (bp->rx_offset << DMARX_CTRL_ROSHIFT))); 1384 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
1383 bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset); 1385 (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
1386 bw32(bp, B44_DMARX_ADDR, bp->rx_ring_dma + bp->dma_offset);
1384 1387
1385 bw32(bp, B44_DMARX_PTR, bp->rx_pending); 1388 bw32(bp, B44_DMARX_PTR, bp->rx_pending);
1386 bp->rx_prod = bp->rx_pending; 1389 bp->rx_prod = bp->rx_pending;
1387 1390
1388 bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ); 1391 bw32(bp, B44_MIB_CTRL, MIB_CTRL_CLR_ON_READ);
1392 } else {
1393 bw32(bp, B44_DMARX_CTRL, (DMARX_CTRL_ENABLE |
1394 (bp->rx_offset << DMARX_CTRL_ROSHIFT)));
1395 }
1389 1396
1390 val = br32(bp, B44_ENET_CTRL); 1397 val = br32(bp, B44_ENET_CTRL);
1391 bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE)); 1398 bw32(bp, B44_ENET_CTRL, (val | ENET_CTRL_ENABLE));
@@ -1401,7 +1408,7 @@ static int b44_open(struct net_device *dev)
1401 goto out; 1408 goto out;
1402 1409
1403 b44_init_rings(bp); 1410 b44_init_rings(bp);
1404 b44_init_hw(bp); 1411 b44_init_hw(bp, 1);
1405 1412
1406 b44_check_phy(bp); 1413 b44_check_phy(bp);
1407 1414
@@ -1511,7 +1518,7 @@ static int b44_close(struct net_device *dev)
1511 netif_poll_enable(dev); 1518 netif_poll_enable(dev);
1512 1519
1513 if (bp->flags & B44_FLAG_WOL_ENABLE) { 1520 if (bp->flags & B44_FLAG_WOL_ENABLE) {
1514 b44_init_hw(bp); 1521 b44_init_hw(bp, 0);
1515 b44_setup_wol(bp); 1522 b44_setup_wol(bp);
1516 } 1523 }
1517 1524
@@ -1786,7 +1793,7 @@ static int b44_set_ringparam(struct net_device *dev,
1786 1793
1787 b44_halt(bp); 1794 b44_halt(bp);
1788 b44_init_rings(bp); 1795 b44_init_rings(bp);
1789 b44_init_hw(bp); 1796 b44_init_hw(bp, 1);
1790 netif_wake_queue(bp->dev); 1797 netif_wake_queue(bp->dev);
1791 spin_unlock_irq(&bp->lock); 1798 spin_unlock_irq(&bp->lock);
1792 1799
@@ -1829,7 +1836,7 @@ static int b44_set_pauseparam(struct net_device *dev,
1829 if (bp->flags & B44_FLAG_PAUSE_AUTO) { 1836 if (bp->flags & B44_FLAG_PAUSE_AUTO) {
1830 b44_halt(bp); 1837 b44_halt(bp);
1831 b44_init_rings(bp); 1838 b44_init_rings(bp);
1832 b44_init_hw(bp); 1839 b44_init_hw(bp, 1);
1833 } else { 1840 } else {
1834 __b44_set_flow_ctrl(bp, bp->flags); 1841 __b44_set_flow_ctrl(bp, bp->flags);
1835 } 1842 }
@@ -2188,7 +2195,7 @@ static int b44_suspend(struct pci_dev *pdev, pm_message_t state)
2188 2195
2189 free_irq(dev->irq, dev); 2196 free_irq(dev->irq, dev);
2190 if (bp->flags & B44_FLAG_WOL_ENABLE) { 2197 if (bp->flags & B44_FLAG_WOL_ENABLE) {
2191 b44_init_hw(bp); 2198 b44_init_hw(bp, 0);
2192 b44_setup_wol(bp); 2199 b44_setup_wol(bp);
2193 } 2200 }
2194 pci_disable_device(pdev); 2201 pci_disable_device(pdev);
@@ -2213,7 +2220,7 @@ static int b44_resume(struct pci_dev *pdev)
2213 spin_lock_irq(&bp->lock); 2220 spin_lock_irq(&bp->lock);
2214 2221
2215 b44_init_rings(bp); 2222 b44_init_rings(bp);
2216 b44_init_hw(bp); 2223 b44_init_hw(bp, 1);
2217 netif_device_attach(bp->dev); 2224 netif_device_attach(bp->dev);
2218 spin_unlock_irq(&bp->lock); 2225 spin_unlock_irq(&bp->lock);
2219 2226