Re: [PATCH] bcma: use the SoC device for DMA on MIPS
From: Johannes Berg
Date: Tue Oct 13 2026 - 09:17:51 EST
On Fri, 2026-10-09 at 14:31 -0700, Rosen Penev wrote:
> The MIPS BCM47xx code allocates a struct device for the SoC, sets a
> 32-bit DMA mask on it and passes it to bcma in struct bcma_soc. bcma
> never uses it: bus->dev stays NULL for the MIPS SoC host, so cores fall
> back to doing DMA through their own struct device, whose
> coherent_dma_mask is 0. Since
> commit f8c55dc6e828 ("MIPS: use generic dma noncoherent ops for simple noncoherent platforms")
> coherent allocations then fail:
>
> bgmac_bcma bcma0:2: Allocation of TX ring 0x200 failed
> bgmac_bcma bcma0:2: Unable to alloc memory for DMA
> bgmac_bcma: probe of bcma0:2 failed with error -12
>
> Set bus->dev from the SoC device and do DMA through it, as the ARM SoC
> host already does. Every SoC host now has a bus device, so drop the
> fallback that pointed a core's dma_mask at its coherent_dma_mask.
>
> This addresses the review of the earlier postings: the cores' DMA masks
> are no longer touched at all.
>
> Tested on an ASUS RT-N16 (BCM4718): bgmac probes and passes traffic.
>
> Fixes: f8c55dc6e828 ("MIPS: use generic dma noncoherent ops for simple noncoherent platforms")
>
That was in a MIPS tree, so perhaps this fix should be too? I don't
really know what to do with it.
johannes