OLD | NEW |
1 /* b44.c: Broadcom 44xx/47xx Fast Ethernet device driver. | 1 /* b44.c: Broadcom 44xx/47xx Fast Ethernet device driver. |
2 * | 2 * |
3 * Copyright (C) 2002 David S. Miller (davem@redhat.com) | 3 * Copyright (C) 2002 David S. Miller (davem@redhat.com) |
4 * Copyright (C) 2004 Pekka Pietikainen (pp@ee.oulu.fi) | 4 * Copyright (C) 2004 Pekka Pietikainen (pp@ee.oulu.fi) |
5 * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org) | 5 * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org) |
6 * Copyright (C) 2006 Felix Fietkau (nbd@openwrt.org) | 6 * Copyright (C) 2006 Felix Fietkau (nbd@openwrt.org) |
7 * Copyright (C) 2006 Broadcom Corporation. | 7 * Copyright (C) 2006 Broadcom Corporation. |
8 * Copyright (C) 2007 Michael Buesch <mb@bu3sch.de> | 8 * Copyright (C) 2007 Michael Buesch <mb@bu3sch.de> |
9 * | 9 * |
10 * Distribute under GPL. | 10 * Distribute under GPL. |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 int work_done; | 841 int work_done; |
842 unsigned long flags; | 842 unsigned long flags; |
843 | 843 |
844 spin_lock_irqsave(&bp->lock, flags); | 844 spin_lock_irqsave(&bp->lock, flags); |
845 | 845 |
846 if (bp->istat & (ISTAT_TX | ISTAT_TO)) { | 846 if (bp->istat & (ISTAT_TX | ISTAT_TO)) { |
847 /* spin_lock(&bp->tx_lock); */ | 847 /* spin_lock(&bp->tx_lock); */ |
848 b44_tx(bp); | 848 b44_tx(bp); |
849 /* spin_unlock(&bp->tx_lock); */ | 849 /* spin_unlock(&bp->tx_lock); */ |
850 } | 850 } |
| 851 if (bp->istat & ISTAT_RFO) { /* fast recovery, in ~20msec */ |
| 852 bp->istat &= ~ISTAT_RFO; |
| 853 b44_disable_ints(bp); |
| 854 ssb_device_enable(bp->sdev, 0); /* resets ISTAT_RFO */ |
| 855 b44_init_rings(bp); |
| 856 b44_init_hw(bp, B44_FULL_RESET_SKIP_PHY); |
| 857 netif_wake_queue(bp->dev); |
| 858 } |
| 859 |
851 spin_unlock_irqrestore(&bp->lock, flags); | 860 spin_unlock_irqrestore(&bp->lock, flags); |
852 | 861 |
853 work_done = 0; | 862 work_done = 0; |
854 if (bp->istat & ISTAT_RX) | 863 if (bp->istat & ISTAT_RX) |
855 work_done += b44_rx(bp, budget); | 864 work_done += b44_rx(bp, budget); |
856 | 865 |
857 if (bp->istat & ISTAT_ERRORS) { | 866 if (bp->istat & ISTAT_ERRORS) { |
858 spin_lock_irqsave(&bp->lock, flags); | 867 spin_lock_irqsave(&bp->lock, flags); |
859 b44_halt(bp); | 868 b44_halt(bp); |
860 b44_init_rings(bp); | 869 b44_init_rings(bp); |
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2158 | 2167 |
2159 bp->rx_pending = B44_DEF_RX_RING_PENDING; | 2168 bp->rx_pending = B44_DEF_RX_RING_PENDING; |
2160 bp->tx_pending = B44_DEF_TX_RING_PENDING; | 2169 bp->tx_pending = B44_DEF_TX_RING_PENDING; |
2161 | 2170 |
2162 netdev_attach_ops(dev, &b44_netdev_ops); | 2171 netdev_attach_ops(dev, &b44_netdev_ops); |
2163 netif_napi_add(dev, &bp->napi, b44_poll, 64); | 2172 netif_napi_add(dev, &bp->napi, b44_poll, 64); |
2164 dev->watchdog_timeo = B44_TX_TIMEOUT; | 2173 dev->watchdog_timeo = B44_TX_TIMEOUT; |
2165 dev->irq = sdev->irq; | 2174 dev->irq = sdev->irq; |
2166 SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); | 2175 SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); |
2167 | 2176 |
2168 netif_carrier_off(dev); | |
2169 | |
2170 err = ssb_bus_powerup(sdev->bus, 0); | 2177 err = ssb_bus_powerup(sdev->bus, 0); |
2171 if (err) { | 2178 if (err) { |
2172 dev_err(sdev->dev, | 2179 dev_err(sdev->dev, |
2173 "Failed to powerup the bus\n"); | 2180 "Failed to powerup the bus\n"); |
2174 goto err_out_free_dev; | 2181 goto err_out_free_dev; |
2175 } | 2182 } |
2176 | 2183 |
2177 if (dma_set_mask(sdev->dma_dev, DMA_BIT_MASK(30)) || | 2184 if (dma_set_mask(sdev->dma_dev, DMA_BIT_MASK(30)) || |
2178 dma_set_coherent_mask(sdev->dma_dev, DMA_BIT_MASK(30))) { | 2185 dma_set_coherent_mask(sdev->dma_dev, DMA_BIT_MASK(30))) { |
2179 dev_err(sdev->dev, | 2186 dev_err(sdev->dev, |
(...skipping 21 matching lines...) Expand all Loading... |
2201 | 2208 |
2202 /* By default, auto-negotiate PAUSE. */ | 2209 /* By default, auto-negotiate PAUSE. */ |
2203 bp->flags |= B44_FLAG_PAUSE_AUTO; | 2210 bp->flags |= B44_FLAG_PAUSE_AUTO; |
2204 | 2211 |
2205 err = register_netdev(dev); | 2212 err = register_netdev(dev); |
2206 if (err) { | 2213 if (err) { |
2207 dev_err(sdev->dev, "Cannot register net device, aborting\n"); | 2214 dev_err(sdev->dev, "Cannot register net device, aborting\n"); |
2208 goto err_out_powerdown; | 2215 goto err_out_powerdown; |
2209 } | 2216 } |
2210 | 2217 |
| 2218 netif_carrier_off(dev); |
| 2219 |
2211 ssb_set_drvdata(sdev, dev); | 2220 ssb_set_drvdata(sdev, dev); |
2212 | 2221 |
2213 /* Chip reset provides power to the b44 MAC & PCI cores, which | 2222 /* Chip reset provides power to the b44 MAC & PCI cores, which |
2214 * is necessary for MAC register access. | 2223 * is necessary for MAC register access. |
2215 */ | 2224 */ |
2216 b44_chip_reset(bp, B44_CHIP_RESET_FULL); | 2225 b44_chip_reset(bp, B44_CHIP_RESET_FULL); |
2217 | 2226 |
2218 /* do a phy reset to test if there is an active phy */ | 2227 /* do a phy reset to test if there is an active phy */ |
2219 if (b44_phy_reset(bp) < 0) | 2228 if (b44_phy_reset(bp) < 0) |
2220 bp->phy_addr = B44_PHY_ADDR_NO_PHY; | 2229 bp->phy_addr = B44_PHY_ADDR_NO_PHY; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 | 2365 |
2357 static void __exit b44_cleanup(void) | 2366 static void __exit b44_cleanup(void) |
2358 { | 2367 { |
2359 ssb_driver_unregister(&b44_ssb_driver); | 2368 ssb_driver_unregister(&b44_ssb_driver); |
2360 b44_pci_exit(); | 2369 b44_pci_exit(); |
2361 } | 2370 } |
2362 | 2371 |
2363 module_init(b44_init); | 2372 module_init(b44_init); |
2364 module_exit(b44_cleanup); | 2373 module_exit(b44_cleanup); |
2365 | 2374 |
OLD | NEW |