>From 25e2f50273e785598b6bd9a8aee28cf825d3fe9f Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Fri, 7 Jun 2019 12:04:16 -0500 Subject: [PATCH] b43legacy: Fix DMA breakage from commit commit 65a21b71f948 To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, pkshih@realtek.com Following commit 65a21b71f948 ("powerpc/dma: remove dma_nommu_dma_supported"), this driver errors with a message that "The machine/kernel does not support the required 30-bit DMA mask." Indeed, the hardware only allows 31-bit masks. This solution is to change the fallback mask from 30- to 31-bits for 32-bit PPC systems. Fixes: 65a21b71f948 ("powerpc/dma: remove dma_nommu_dma_supported") Reported-by: Aaro Koskinen Cc: Christoph Hellwig Cc: Aaro Koskinen Signed-off-by: Larry Finger --- drivers/net/wireless/broadcom/b43legacy/dma.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/broadcom/b43legacy/dma.c b/drivers/net/wireless/broadcom/b43legacy/dma.c index 1cc25f44dd9a..75613f516e50 100644 --- a/drivers/net/wireless/broadcom/b43legacy/dma.c +++ b/drivers/net/wireless/broadcom/b43legacy/dma.c @@ -27,6 +27,15 @@ #include #include +/* Special handling for PPC32 - The maximum DMA mask is 31 bits, and + * the fallback to 30 bits fails. Set the fallback at 31. + */ +#ifdef CONFIG_PPC32 +#define FB_DMA 31 +#else +#define FB_DMA 30 +#endif + /* 32bit DMA ops. */ static struct b43legacy_dmadesc32 *op32_idx2desc(struct b43legacy_dmaring *ring, @@ -418,7 +427,7 @@ static bool b43legacy_dma_mapping_error(struct b43legacy_dmaring *ring, switch (ring->type) { case B43legacy_DMA_30BIT: - if ((u64)addr + buffersize > (1ULL << 30)) + if ((u64)addr + buffersize > (1ULL << FB_DMA)) goto address_error; break; case B43legacy_DMA_32BIT: @@ -617,12 +626,12 @@ static u64 supported_dma_mask(struct b43legacy_wldev *dev) if (tmp & B43legacy_DMA32_TXADDREXT_MASK) return DMA_BIT_MASK(32); - return DMA_BIT_MASK(30); + return DMA_BIT_MASK(FB_DMA); } static enum b43legacy_dmatype dma_mask_to_engine_type(u64 dmamask) { - if (dmamask == DMA_BIT_MASK(30)) + if (dmamask == DMA_BIT_MASK(FB_DMA)) return B43legacy_DMA_30BIT; if (dmamask == DMA_BIT_MASK(32)) return B43legacy_DMA_32BIT; @@ -802,7 +811,7 @@ static int b43legacy_dma_set_mask(struct b43legacy_wldev *dev, u64 mask) continue; } if (mask == DMA_BIT_MASK(32)) { - mask = DMA_BIT_MASK(30); + mask = DMA_BIT_MASK(FB_DMA); fallback = true; continue; } -- 2.21.0