diff options
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx_dma.c')
-rw-r--r-- | drivers/net/wireless/bcm43xx/bcm43xx_dma.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c index c3681b8f09b4..d0318e525ba7 100644 --- a/drivers/net/wireless/bcm43xx/bcm43xx_dma.c +++ b/drivers/net/wireless/bcm43xx/bcm43xx_dma.c | |||
@@ -196,8 +196,9 @@ static int alloc_ringmemory(struct bcm43xx_dmaring *ring) | |||
196 | } | 196 | } |
197 | if (ring->dmabase + BCM43xx_DMA_RINGMEMSIZE > BCM43xx_DMA_BUSADDRMAX) { | 197 | if (ring->dmabase + BCM43xx_DMA_RINGMEMSIZE > BCM43xx_DMA_BUSADDRMAX) { |
198 | printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RINGMEMORY >1G " | 198 | printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RINGMEMORY >1G " |
199 | "(0x%08x, len: %lu)\n", | 199 | "(0x%llx, len: %lu)\n", |
200 | ring->dmabase, BCM43xx_DMA_RINGMEMSIZE); | 200 | (unsigned long long)ring->dmabase, |
201 | BCM43xx_DMA_RINGMEMSIZE); | ||
201 | dma_free_coherent(dev, BCM43xx_DMA_RINGMEMSIZE, | 202 | dma_free_coherent(dev, BCM43xx_DMA_RINGMEMSIZE, |
202 | ring->vbase, ring->dmabase); | 203 | ring->vbase, ring->dmabase); |
203 | return -ENOMEM; | 204 | return -ENOMEM; |
@@ -307,8 +308,8 @@ static int setup_rx_descbuffer(struct bcm43xx_dmaring *ring, | |||
307 | unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); | 308 | unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); |
308 | dev_kfree_skb_any(skb); | 309 | dev_kfree_skb_any(skb); |
309 | printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RX SKB >1G " | 310 | printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA RX SKB >1G " |
310 | "(0x%08x, len: %u)\n", | 311 | "(0x%llx, len: %u)\n", |
311 | dmaaddr, ring->rx_buffersize); | 312 | (unsigned long long)dmaaddr, ring->rx_buffersize); |
312 | return -ENOMEM; | 313 | return -ENOMEM; |
313 | } | 314 | } |
314 | meta->skb = skb; | 315 | meta->skb = skb; |
@@ -623,25 +624,28 @@ err_destroy_tx0: | |||
623 | static u16 generate_cookie(struct bcm43xx_dmaring *ring, | 624 | static u16 generate_cookie(struct bcm43xx_dmaring *ring, |
624 | int slot) | 625 | int slot) |
625 | { | 626 | { |
626 | u16 cookie = 0x0000; | 627 | u16 cookie = 0xF000; |
627 | 628 | ||
628 | /* Use the upper 4 bits of the cookie as | 629 | /* Use the upper 4 bits of the cookie as |
629 | * DMA controller ID and store the slot number | 630 | * DMA controller ID and store the slot number |
630 | * in the lower 12 bits | 631 | * in the lower 12 bits. |
632 | * Note that the cookie must never be 0, as this | ||
633 | * is a special value used in RX path. | ||
631 | */ | 634 | */ |
632 | switch (ring->mmio_base) { | 635 | switch (ring->mmio_base) { |
633 | default: | 636 | default: |
634 | assert(0); | 637 | assert(0); |
635 | case BCM43xx_MMIO_DMA1_BASE: | 638 | case BCM43xx_MMIO_DMA1_BASE: |
639 | cookie = 0xA000; | ||
636 | break; | 640 | break; |
637 | case BCM43xx_MMIO_DMA2_BASE: | 641 | case BCM43xx_MMIO_DMA2_BASE: |
638 | cookie = 0x1000; | 642 | cookie = 0xB000; |
639 | break; | 643 | break; |
640 | case BCM43xx_MMIO_DMA3_BASE: | 644 | case BCM43xx_MMIO_DMA3_BASE: |
641 | cookie = 0x2000; | 645 | cookie = 0xC000; |
642 | break; | 646 | break; |
643 | case BCM43xx_MMIO_DMA4_BASE: | 647 | case BCM43xx_MMIO_DMA4_BASE: |
644 | cookie = 0x3000; | 648 | cookie = 0xD000; |
645 | break; | 649 | break; |
646 | } | 650 | } |
647 | assert(((u16)slot & 0xF000) == 0x0000); | 651 | assert(((u16)slot & 0xF000) == 0x0000); |
@@ -659,16 +663,16 @@ struct bcm43xx_dmaring * parse_cookie(struct bcm43xx_private *bcm, | |||
659 | struct bcm43xx_dmaring *ring = NULL; | 663 | struct bcm43xx_dmaring *ring = NULL; |
660 | 664 | ||
661 | switch (cookie & 0xF000) { | 665 | switch (cookie & 0xF000) { |
662 | case 0x0000: | 666 | case 0xA000: |
663 | ring = dma->tx_ring0; | 667 | ring = dma->tx_ring0; |
664 | break; | 668 | break; |
665 | case 0x1000: | 669 | case 0xB000: |
666 | ring = dma->tx_ring1; | 670 | ring = dma->tx_ring1; |
667 | break; | 671 | break; |
668 | case 0x2000: | 672 | case 0xC000: |
669 | ring = dma->tx_ring2; | 673 | ring = dma->tx_ring2; |
670 | break; | 674 | break; |
671 | case 0x3000: | 675 | case 0xD000: |
672 | ring = dma->tx_ring3; | 676 | ring = dma->tx_ring3; |
673 | break; | 677 | break; |
674 | default: | 678 | default: |
@@ -729,8 +733,8 @@ static int dma_tx_fragment(struct bcm43xx_dmaring *ring, | |||
729 | if (unlikely(meta->dmaaddr + skb->len > BCM43xx_DMA_BUSADDRMAX)) { | 733 | if (unlikely(meta->dmaaddr + skb->len > BCM43xx_DMA_BUSADDRMAX)) { |
730 | return_slot(ring, slot); | 734 | return_slot(ring, slot); |
731 | printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA TX SKB >1G " | 735 | printk(KERN_ERR PFX ">>>FATAL ERROR<<< DMA TX SKB >1G " |
732 | "(0x%08x, len: %u)\n", | 736 | "(0x%llx, len: %u)\n", |
733 | meta->dmaaddr, skb->len); | 737 | (unsigned long long)meta->dmaaddr, skb->len); |
734 | return -ENOMEM; | 738 | return -ENOMEM; |
735 | } | 739 | } |
736 | 740 | ||
@@ -838,8 +842,18 @@ static void dma_rx(struct bcm43xx_dmaring *ring, | |||
838 | /* We received an xmit status. */ | 842 | /* We received an xmit status. */ |
839 | struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data; | 843 | struct bcm43xx_hwxmitstatus *hw = (struct bcm43xx_hwxmitstatus *)skb->data; |
840 | struct bcm43xx_xmitstatus stat; | 844 | struct bcm43xx_xmitstatus stat; |
845 | int i = 0; | ||
841 | 846 | ||
842 | stat.cookie = le16_to_cpu(hw->cookie); | 847 | stat.cookie = le16_to_cpu(hw->cookie); |
848 | while (stat.cookie == 0) { | ||
849 | if (unlikely(++i >= 10000)) { | ||
850 | assert(0); | ||
851 | break; | ||
852 | } | ||
853 | udelay(2); | ||
854 | barrier(); | ||
855 | stat.cookie = le16_to_cpu(hw->cookie); | ||
856 | } | ||
843 | stat.flags = hw->flags; | 857 | stat.flags = hw->flags; |
844 | stat.cnt1 = hw->cnt1; | 858 | stat.cnt1 = hw->cnt1; |
845 | stat.cnt2 = hw->cnt2; | 859 | stat.cnt2 = hw->cnt2; |