Skip to content

Commit 8ac9a97

Browse files
Michael SchmitzZhengShunQian
authored andcommitted
zorro: Set up z->dev.dma_mask for the DMA API
[ Upstream commit 55496d3 ] The generic DMA API uses dev->dma_mask to check the DMA addressable memory bitmask, and warns if no mask is set or even allocated. Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask to point to z->dev.dma_coherent_mask so device drivers that need DMA have everything set up to avoid warnings from dma_alloc_coherent(). Drivers can still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask. Signed-off-by: Michael Schmitz <[email protected]> [geert: Handle Zorro II with 24-bit address space] Acked-by: Christoph Hellwig <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2f7b1f9 commit 8ac9a97

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

drivers/zorro/zorro.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/bitops.h>
1717
#include <linux/string.h>
1818
#include <linux/platform_device.h>
19+
#include <linux/dma-mapping.h>
1920
#include <linux/slab.h>
2021

2122
#include <asm/byteorder.h>
@@ -185,6 +186,17 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
185186
z->dev.parent = &bus->dev;
186187
z->dev.bus = &zorro_bus_type;
187188
z->dev.id = i;
189+
switch (z->rom.er_Type & ERT_TYPEMASK) {
190+
case ERT_ZORROIII:
191+
z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
192+
break;
193+
194+
case ERT_ZORROII:
195+
default:
196+
z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
197+
break;
198+
}
199+
z->dev.dma_mask = &z->dev.coherent_dma_mask;
188200
}
189201

190202
/* ... then register them */

0 commit comments

Comments
 (0)