Skip to content

Commit 5a7faef

Browse files
author
Christoph Hellwig
committed
sparc: set a default 32-bit dma mask for OF devices
This keeps the historic default behavior for devices without a DMA mask, but removes the warning about a lacking DMA mask for doing DMA without a mask. Reported-by: Meelis Roos <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Tested-by: Guenter Roeck <[email protected]>
1 parent c1d0af1 commit 5a7faef

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

arch/sparc/kernel/of_device_32.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/irq.h>
1010
#include <linux/of_device.h>
1111
#include <linux/of_platform.h>
12+
#include <linux/dma-mapping.h>
1213
#include <asm/leon.h>
1314
#include <asm/leon_amba.h>
1415

@@ -381,6 +382,9 @@ static struct platform_device * __init scan_one_device(struct device_node *dp,
381382
else
382383
dev_set_name(&op->dev, "%08x", dp->phandle);
383384

385+
op->dev.coherent_dma_mask = DMA_BIT_MASK(32);
386+
op->dev.dma_mask = &op->dev.coherent_dma_mask;
387+
384388
if (of_device_register(op)) {
385389
printk("%s: Could not register of device.\n",
386390
dp->full_name);

arch/sparc/kernel/of_device_64.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <linux/string.h>
33
#include <linux/kernel.h>
44
#include <linux/of.h>
5+
#include <linux/dma-mapping.h>
56
#include <linux/init.h>
67
#include <linux/export.h>
78
#include <linux/mod_devicetable.h>
@@ -675,6 +676,8 @@ static struct platform_device * __init scan_one_device(struct device_node *dp,
675676
dev_set_name(&op->dev, "root");
676677
else
677678
dev_set_name(&op->dev, "%08x", dp->phandle);
679+
op->dev.coherent_dma_mask = DMA_BIT_MASK(32);
680+
op->dev.dma_mask = &op->dev.coherent_dma_mask;
678681

679682
if (of_device_register(op)) {
680683
printk("%s: Could not register of device.\n",

0 commit comments

Comments
 (0)