Skip to content

Commit

Permalink
zorro: Set up z->dev.dma_mask for the DMA API
Browse files Browse the repository at this point in the history
[ Upstream commit 55496d3fe2acd1a365c43cbd613a20ecd4d74395 ]

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]>
  • Loading branch information
Michael Schmitz authored and gregkh committed May 30, 2018
1 parent 9c43286 commit ae90d15
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/zorro/zorro.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/bitops.h>
#include <linux/string.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>

#include <asm/byteorder.h>
Expand Down Expand Up @@ -185,6 +186,17 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
z->dev.parent = &bus->dev;
z->dev.bus = &zorro_bus_type;
z->dev.id = i;
switch (z->rom.er_Type & ERT_TYPEMASK) {
case ERT_ZORROIII:
z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
break;

case ERT_ZORROII:
default:
z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
break;
}
z->dev.dma_mask = &z->dev.coherent_dma_mask;
}

/* ... then register them */
Expand Down

0 comments on commit ae90d15

Please sign in to comment.