Commit 39b91698 authored by Michael Schmitz's avatar Michael Schmitz Committed by Khalid Elmously

zorro: Set up z->dev.dma_mask for the DMA API

BugLink: https://bugs.launchpad.net/bugs/1775771

[ Upstream commit 55496d3f ]

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: default avatarMichael Schmitz <schmitzmic@gmail.com>
[geert: Handle Zorro II with 24-bit address space]
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent d46b9d45
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
...@@ -185,6 +186,17 @@ static int __init amiga_zorro_probe(struct platform_device *pdev) ...@@ -185,6 +186,17 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)
z->dev.parent = &bus->dev; z->dev.parent = &bus->dev;
z->dev.bus = &zorro_bus_type; z->dev.bus = &zorro_bus_type;
z->dev.id = i; 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 */ /* ... then register them */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment