* [wireless-next][PATCH 1/3] b43: Relax requirement for descriptors to be in the DMA zone
@ 2011-08-26 18:41 Rafał Miłecki
2011-08-26 18:41 ` [wireless-next][PATCH 2/3] b43: use 8K buffers for 64-bit DMA to workaround hardware bug Rafał Miłecki
2011-08-26 18:41 ` [wireless-next][PATCH 3/3] b43: make HT-PHY support experimental Rafał Miłecki
0 siblings, 2 replies; 3+ messages in thread
From: Rafał Miłecki @ 2011-08-26 18:41 UTC (permalink / raw)
To: linux-wireless, John W. Linville
Cc: b43-dev, David Woodhouse, Maxime Vincent, Darren, Larry Finger,
Michael Buesch
From: Larry Finger <Larry.Finger@lwfinger.net>
When 64-bit DMA was first used, there were problems with the
BCM4311 (14e4:4311). The problem was "fixed" by using the GFP_DMA
flag in the allocation of coherent ring descriptor memory.
The original problem is now believed to have been due to bugs in
the 64-bit DMA implementation in the rest of the kernel, and that
those bugs have been fixed. Accordingly, the requirement for the
descriptors to be in the DMA zone is relaxed.
Bounce buffers are left in the DMA zone.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Buesch <m@bues.ch>
---
drivers/net/wireless/b43/dma.c | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index c5d890e..e36e8b5 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -423,14 +423,7 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
* has shown that 4K is sufficient for the latter as long as the buffer
* does not cross an 8K boundary.
*
- * For unknown reasons - possibly a hardware error - the BCM4311 rev
- * 02, which uses 64-bit DMA, needs the ring buffer in very low memory,
- * which accounts for the GFP_DMA flag below.
- *
- * The flags here must match the flags in free_ringmemory below!
*/
- if (ring->type == B43_DMA_64BIT)
- flags |= GFP_DMA;
ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
B43_DMA_RINGMEMSIZE,
&(ring->dmabase), flags);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [wireless-next][PATCH 2/3] b43: use 8K buffers for 64-bit DMA to workaround hardware bug
2011-08-26 18:41 [wireless-next][PATCH 1/3] b43: Relax requirement for descriptors to be in the DMA zone Rafał Miłecki
@ 2011-08-26 18:41 ` Rafał Miłecki
2011-08-26 18:41 ` [wireless-next][PATCH 3/3] b43: make HT-PHY support experimental Rafał Miłecki
1 sibling, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2011-08-26 18:41 UTC (permalink / raw)
To: linux-wireless, John W. Linville
Cc: b43-dev, David Woodhouse, Maxime Vincent, Darren,
Rafał Miłecki
Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
drivers/net/wireless/b43/dma.c | 24 ++++++++++++++++--------
drivers/net/wireless/b43/dma.h | 3 ++-
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index e36e8b5..5e45604 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -419,26 +419,34 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
gfp_t flags = GFP_KERNEL;
/* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
- * alignment and 8K buffers for 64-bit DMA with 8K alignment. Testing
- * has shown that 4K is sufficient for the latter as long as the buffer
- * does not cross an 8K boundary.
- *
+ * alignment and 8K buffers for 64-bit DMA with 8K alignment.
+ * In practice we could use smaller buffers for the latter, but the
+ * alignment is really important because of the hardware bug. If bit
+ * 0x00001000 is used in DMA address, some hardware (like BCM4331)
+ * copies that bit into B43_DMA64_RXSTATUS and we get false values from
+ * B43_DMA64_RXSTATDPTR. Let's just use 8K buffers even if we don't use
+ * more than 256 slots for ring.
*/
+ u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ?
+ B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE;
+
ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
- B43_DMA_RINGMEMSIZE,
- &(ring->dmabase), flags);
+ ring_mem_size, &(ring->dmabase),
+ flags);
if (!ring->descbase) {
b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
return -ENOMEM;
}
- memset(ring->descbase, 0, B43_DMA_RINGMEMSIZE);
+ memset(ring->descbase, 0, ring_mem_size);
return 0;
}
static void free_ringmemory(struct b43_dmaring *ring)
{
- dma_free_coherent(ring->dev->dev->dma_dev, B43_DMA_RINGMEMSIZE,
+ u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ?
+ B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE;
+ dma_free_coherent(ring->dev->dev->dma_dev, ring_mem_size,
ring->descbase, ring->dmabase);
}
diff --git a/drivers/net/wireless/b43/dma.h b/drivers/net/wireless/b43/dma.h
index 7e20b04..315b96e 100644
--- a/drivers/net/wireless/b43/dma.h
+++ b/drivers/net/wireless/b43/dma.h
@@ -161,7 +161,8 @@ struct b43_dmadesc_generic {
} __packed;
/* Misc DMA constants */
-#define B43_DMA_RINGMEMSIZE PAGE_SIZE
+#define B43_DMA32_RINGMEMSIZE 4096
+#define B43_DMA64_RINGMEMSIZE 8192
/* Offset of frame with actual data */
#define B43_DMA0_RX_FW598_FO 38
#define B43_DMA0_RX_FW351_FO 30
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [wireless-next][PATCH 3/3] b43: make HT-PHY support experimental
2011-08-26 18:41 [wireless-next][PATCH 1/3] b43: Relax requirement for descriptors to be in the DMA zone Rafał Miłecki
2011-08-26 18:41 ` [wireless-next][PATCH 2/3] b43: use 8K buffers for 64-bit DMA to workaround hardware bug Rafał Miłecki
@ 2011-08-26 18:41 ` Rafał Miłecki
1 sibling, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2011-08-26 18:41 UTC (permalink / raw)
To: linux-wireless, John W. Linville
Cc: b43-dev, David Woodhouse, Maxime Vincent, Darren,
Rafał Miłecki
It was tested on three BCM4331 devices, code has been written from MMIO
dumps only, but seems to be quite stable.
Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
---
drivers/net/wireless/b43/Kconfig | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index b81a2a1..0ddf0aa 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -124,12 +124,12 @@ config B43_PHY_LP
(802.11a support is optional, and currently disabled).
config B43_PHY_HT
- bool "Support for HT-PHY devices (BROKEN)"
- depends on B43 && BROKEN
+ bool "Support for HT-PHY (high throughput) devices (EXPERIMENTAL)"
+ depends on B43 && EXPERIMENTAL
---help---
Support for the HT-PHY.
- Say N, this is BROKEN and crashes driver.
+ Enables support for BCM4331 and possibly other chipsets with that PHY.
config B43_PHY_LCN
bool "Support for LCN-PHY devices (BROKEN)"
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-26 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-26 18:41 [wireless-next][PATCH 1/3] b43: Relax requirement for descriptors to be in the DMA zone Rafał Miłecki
2011-08-26 18:41 ` [wireless-next][PATCH 2/3] b43: use 8K buffers for 64-bit DMA to workaround hardware bug Rafał Miłecki
2011-08-26 18:41 ` [wireless-next][PATCH 3/3] b43: make HT-PHY support experimental Rafał Miłecki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).