diff options
author | Laura Abbott <lauraa@codeaurora.org> | 2014-01-24 13:04:14 -0800 |
---|---|---|
committer | Rohit Vaswani <rvaswani@codeaurora.org> | 2016-03-01 12:22:10 -0800 |
commit | a360a2d337e3fec89ca5e1ac2f0b3a79a10534de (patch) | |
tree | 72083e07f1748fa84a6a5f9cd1e7f3fbde4c16f6 /arch/arm64 | |
parent | 1267164e16857ab7f28aef12224456d5fdbfe48e (diff) |
arm64: Add pdev_archdata for dmamask
The dma_mask for a device structure is a pointer. This pointer
needs to be set up before the dma mask can actually be set. Most
frameworks in the kernel take care of setting this up properly but
platform devices that don't follow a regular bus structure may not
ever have this set. As a result, checks such as dma_capable will
always return false on a raw platform device and dma_set_mask will
always return -EIO. Fix this by adding a dma_mask in the
platform_device archdata and setting it to be the dma_mask. Devices
used in other frameworks can change this as needed.
Change-Id: I5bfd2aa75798dfdf49d3af70fdd95dfaf2126e8c
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[abhimany: resolve trivial merge conflicts]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/include/asm/device.h | 1 | ||||
-rw-r--r-- | arch/arm64/kernel/setup.c | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h index 243ef256b8c9..eb4f47de7d7e 100644 --- a/arch/arm64/include/asm/device.h +++ b/arch/arm64/include/asm/device.h @@ -25,6 +25,7 @@ struct dev_archdata { }; struct pdev_archdata { + u64 dma_mask; }; #endif diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 8119479147db..33497844ae51 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -44,6 +44,7 @@ #include <linux/of_platform.h> #include <linux/efi.h> #include <linux/psci.h> +#include <linux/dma-mapping.h> #include <asm/acpi.h> #include <asm/fixmap.h> @@ -381,3 +382,9 @@ static int __init topology_init(void) return 0; } subsys_initcall(topology_init); + +void arch_setup_pdev_archdata(struct platform_device *pdev) +{ + pdev->archdata.dma_mask = DMA_BIT_MASK(32); + pdev->dev.dma_mask = &pdev->archdata.dma_mask; +} |