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>
This commit is contained in:
Laura Abbott 2014-01-24 13:04:14 -08:00 committed by Rohit Vaswani
parent 1267164e16
commit a360a2d337
2 changed files with 8 additions and 0 deletions

View file

@ -25,6 +25,7 @@ struct dev_archdata {
};
struct pdev_archdata {
u64 dma_mask;
};
#endif

View file

@ -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;
}