From a360a2d337e3fec89ca5e1ac2f0b3a79a10534de Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Fri, 24 Jan 2014 13:04:14 -0800 Subject: [PATCH] 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 [abhimany: resolve trivial merge conflicts] Signed-off-by: Abhimanyu Kapur --- arch/arm64/include/asm/device.h | 1 + arch/arm64/kernel/setup.c | 7 +++++++ 2 files changed, 8 insertions(+) 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 #include #include +#include #include #include @@ -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; +}