aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/b43/main.c')
-rw-r--r--drivers/net/wireless/b43/main.c84
1 files changed, 8 insertions, 76 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 6b3013c2d96d..2add839f5045 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -46,7 +46,6 @@
46#include "debugfs.h" 46#include "debugfs.h"
47#include "phy.h" 47#include "phy.h"
48#include "dma.h" 48#include "dma.h"
49#include "pio.h"
50#include "sysfs.h" 49#include "sysfs.h"
51#include "xmit.h" 50#include "xmit.h"
52#include "lo.h" 51#include "lo.h"
@@ -58,17 +57,6 @@ MODULE_AUTHOR("Stefano Brivio");
58MODULE_AUTHOR("Michael Buesch"); 57MODULE_AUTHOR("Michael Buesch");
59MODULE_LICENSE("GPL"); 58MODULE_LICENSE("GPL");
60 59
61extern char *nvram_get(char *name);
62
63#if defined(CONFIG_B43_DMA) && defined(CONFIG_B43_PIO)
64static int modparam_pio;
65module_param_named(pio, modparam_pio, int, 0444);
66MODULE_PARM_DESC(pio, "enable(1) / disable(0) PIO mode");
67#elif defined(CONFIG_B43_DMA)
68# define modparam_pio 0
69#elif defined(CONFIG_B43_PIO)
70# define modparam_pio 1
71#endif
72 60
73static int modparam_bad_frames_preempt; 61static int modparam_bad_frames_preempt;
74module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); 62module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444);
@@ -1447,20 +1435,12 @@ static void b43_interrupt_tasklet(struct b43_wldev *dev)
1447 handle_irq_noise(dev); 1435 handle_irq_noise(dev);
1448 1436
1449 /* Check the DMA reason registers for received data. */ 1437 /* Check the DMA reason registers for received data. */
1450 if (dma_reason[0] & B43_DMAIRQ_RX_DONE) { 1438 if (dma_reason[0] & B43_DMAIRQ_RX_DONE)
1451 if (b43_using_pio(dev)) 1439 b43_dma_rx(dev->dma.rx_ring0);
1452 b43_pio_rx(dev->pio.queue0); 1440 if (dma_reason[3] & B43_DMAIRQ_RX_DONE)
1453 else 1441 b43_dma_rx(dev->dma.rx_ring3);
1454 b43_dma_rx(dev->dma.rx_ring0);
1455 }
1456 B43_WARN_ON(dma_reason[1] & B43_DMAIRQ_RX_DONE); 1442 B43_WARN_ON(dma_reason[1] & B43_DMAIRQ_RX_DONE);
1457 B43_WARN_ON(dma_reason[2] & B43_DMAIRQ_RX_DONE); 1443 B43_WARN_ON(dma_reason[2] & B43_DMAIRQ_RX_DONE);
1458 if (dma_reason[3] & B43_DMAIRQ_RX_DONE) {
1459 if (b43_using_pio(dev))
1460 b43_pio_rx(dev->pio.queue3);
1461 else
1462 b43_dma_rx(dev->dma.rx_ring3);
1463 }
1464 B43_WARN_ON(dma_reason[4] & B43_DMAIRQ_RX_DONE); 1444 B43_WARN_ON(dma_reason[4] & B43_DMAIRQ_RX_DONE);
1465 B43_WARN_ON(dma_reason[5] & B43_DMAIRQ_RX_DONE); 1445 B43_WARN_ON(dma_reason[5] & B43_DMAIRQ_RX_DONE);
1466 1446
@@ -1472,29 +1452,8 @@ static void b43_interrupt_tasklet(struct b43_wldev *dev)
1472 spin_unlock_irqrestore(&dev->wl->irq_lock, flags); 1452 spin_unlock_irqrestore(&dev->wl->irq_lock, flags);
1473} 1453}
1474 1454
1475static void pio_irq_workaround(struct b43_wldev *dev, u16 base, int queueidx)
1476{
1477 u16 rxctl;
1478
1479 rxctl = b43_read16(dev, base + B43_PIO_RXCTL);
1480 if (rxctl & B43_PIO_RXCTL_DATAAVAILABLE)
1481 dev->dma_reason[queueidx] |= B43_DMAIRQ_RX_DONE;
1482 else
1483 dev->dma_reason[queueidx] &= ~B43_DMAIRQ_RX_DONE;
1484}
1485
1486static void b43_interrupt_ack(struct b43_wldev *dev, u32 reason) 1455static void b43_interrupt_ack(struct b43_wldev *dev, u32 reason)
1487{ 1456{
1488 if (b43_using_pio(dev) &&
1489 (dev->dev->id.revision < 3) &&
1490 (!(reason & B43_IRQ_PIO_WORKAROUND))) {
1491 /* Apply a PIO specific workaround to the dma_reasons */
1492 pio_irq_workaround(dev, B43_MMIO_PIO1_BASE, 0);
1493 pio_irq_workaround(dev, B43_MMIO_PIO2_BASE, 1);
1494 pio_irq_workaround(dev, B43_MMIO_PIO3_BASE, 2);
1495 pio_irq_workaround(dev, B43_MMIO_PIO4_BASE, 3);
1496 }
1497
1498 b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, reason); 1457 b43_write32(dev, B43_MMIO_GEN_IRQ_REASON, reason);
1499 1458
1500 b43_write32(dev, B43_MMIO_DMA0_REASON, dev->dma_reason[0]); 1459 b43_write32(dev, B43_MMIO_DMA0_REASON, dev->dma_reason[0]);
@@ -2225,14 +2184,6 @@ static int b43_chip_init(struct b43_wldev *dev)
2225 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) 2184 b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL)
2226 | B43_MACCTL_INFRA); 2185 | B43_MACCTL_INFRA);
2227 2186
2228 if (b43_using_pio(dev)) {
2229 b43_write32(dev, 0x0210, 0x00000100);
2230 b43_write32(dev, 0x0230, 0x00000100);
2231 b43_write32(dev, 0x0250, 0x00000100);
2232 b43_write32(dev, 0x0270, 0x00000100);
2233 b43_shm_write16(dev, B43_SHM_SHARED, 0x0034, 0x0000);
2234 }
2235
2236 /* Probe Response Timeout value */ 2187 /* Probe Response Timeout value */
2237 /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */ 2188 /* FIXME: Default to 0, has to be set by ioctl probably... :-/ */
2238 b43_shm_write16(dev, B43_SHM_SHARED, 0x0074, 0x0000); 2189 b43_shm_write16(dev, B43_SHM_SHARED, 0x0074, 0x0000);
@@ -2513,19 +2464,13 @@ static int b43_op_tx(struct ieee80211_hw *hw,
2513 struct b43_wl *wl = hw_to_b43_wl(hw); 2464 struct b43_wl *wl = hw_to_b43_wl(hw);
2514 struct b43_wldev *dev = wl->current_dev; 2465 struct b43_wldev *dev = wl->current_dev;
2515 int err = -ENODEV; 2466 int err = -ENODEV;
2516 unsigned long flags;
2517 2467
2518 if (unlikely(!dev)) 2468 if (unlikely(!dev))
2519 goto out; 2469 goto out;
2520 if (unlikely(b43_status(dev) < B43_STAT_STARTED)) 2470 if (unlikely(b43_status(dev) < B43_STAT_STARTED))
2521 goto out; 2471 goto out;
2522 /* DMA-TX is done without a global lock. */ 2472 /* DMA-TX is done without a global lock. */
2523 if (b43_using_pio(dev)) { 2473 err = b43_dma_tx(dev, skb, ctl);
2524 spin_lock_irqsave(&wl->irq_lock, flags);
2525 err = b43_pio_tx(dev, skb, ctl);
2526 spin_unlock_irqrestore(&wl->irq_lock, flags);
2527 } else
2528 err = b43_dma_tx(dev, skb, ctl);
2529out: 2474out:
2530 if (unlikely(err)) 2475 if (unlikely(err))
2531 return NETDEV_TX_BUSY; 2476 return NETDEV_TX_BUSY;
@@ -2551,10 +2496,7 @@ static int b43_op_get_tx_stats(struct ieee80211_hw *hw,
2551 goto out; 2496 goto out;
2552 spin_lock_irqsave(&wl->irq_lock, flags); 2497 spin_lock_irqsave(&wl->irq_lock, flags);
2553 if (likely(b43_status(dev) >= B43_STAT_STARTED)) { 2498 if (likely(b43_status(dev) >= B43_STAT_STARTED)) {
2554 if (b43_using_pio(dev)) 2499 b43_dma_get_tx_stats(dev, stats);
2555 b43_pio_get_tx_stats(dev, stats);
2556 else
2557 b43_dma_get_tx_stats(dev, stats);
2558 err = 0; 2500 err = 0;
2559 } 2501 }
2560 spin_unlock_irqrestore(&wl->irq_lock, flags); 2502 spin_unlock_irqrestore(&wl->irq_lock, flags);
@@ -3336,7 +3278,6 @@ static void b43_wireless_core_exit(struct b43_wldev *dev)
3336 3278
3337 b43_leds_exit(dev); 3279 b43_leds_exit(dev);
3338 b43_rng_exit(dev->wl); 3280 b43_rng_exit(dev->wl);
3339 b43_pio_free(dev);
3340 b43_dma_free(dev); 3281 b43_dma_free(dev);
3341 b43_chip_exit(dev); 3282 b43_chip_exit(dev);
3342 b43_radio_turn_off(dev, 1); 3283 b43_radio_turn_off(dev, 1);
@@ -3430,17 +3371,10 @@ static int b43_wireless_core_init(struct b43_wldev *dev)
3430 /* Maximum Contention Window */ 3371 /* Maximum Contention Window */
3431 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF); 3372 b43_shm_write16(dev, B43_SHM_SCRATCH, B43_SHM_SC_MAXCONT, 0x3FF);
3432 3373
3433 do { 3374 err = b43_dma_init(dev);
3434 if (b43_using_pio(dev)) {
3435 err = b43_pio_init(dev);
3436 } else {
3437 err = b43_dma_init(dev);
3438 if (!err)
3439 b43_qos_init(dev);
3440 }
3441 } while (err == -EAGAIN);
3442 if (err) 3375 if (err)
3443 goto err_chip_exit; 3376 goto err_chip_exit;
3377 b43_qos_init(dev);
3444 3378
3445//FIXME 3379//FIXME
3446#if 1 3380#if 1
@@ -3890,8 +3824,6 @@ static int b43_one_core_attach(struct ssb_device *dev, struct b43_wl *wl)
3890 tasklet_init(&wldev->isr_tasklet, 3824 tasklet_init(&wldev->isr_tasklet,
3891 (void (*)(unsigned long))b43_interrupt_tasklet, 3825 (void (*)(unsigned long))b43_interrupt_tasklet,
3892 (unsigned long)wldev); 3826 (unsigned long)wldev);
3893 if (modparam_pio)
3894 wldev->__using_pio = 1;
3895 INIT_LIST_HEAD(&wldev->list); 3827 INIT_LIST_HEAD(&wldev->list);
3896 3828
3897 err = b43_wireless_core_attach(wldev); 3829 err = b43_wireless_core_attach(wldev);