layerscape: make uImage with zImage for 32-bit kernel
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 3032-arm64-Add-pdev_archdata-for-dmamask.patch
1 From f7e48669bb75f3b52e9f3ce1a5d885c49b7c4712 Mon Sep 17 00:00:00 2001
2 From: Cristian Sovaiala <cristian.sovaiala@freescale.com>
3 Date: Thu, 4 Jun 2015 18:27:20 +0300
4 Subject: [PATCH 32/70] arm64: Add pdev_archdata for dmamask
5
6 The dma_mask for a device structure is a pointer. This pointer
7 needs to be set up before the dma mask can actually be set. Most
8 frameworks in the kernel take care of setting this up properly but
9 platform devices that don't follow a regular bus structure may not
10 ever have this set. As a result, checks such as dma_capable will
11 always return false on a raw platform device and dma_set_mask will
12 always return -EIO. Fix this by adding a dma_mask in the
13 platform_device archdata and setting it to be the dma_mask. Devices
14 used in other frameworks can change this as needed.
15
16 Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
17 ---
18 arch/arm64/include/asm/device.h | 1 +
19 arch/arm64/kernel/setup.c | 7 +++++++
20 2 files changed, 8 insertions(+)
21
22 --- a/arch/arm64/include/asm/device.h
23 +++ b/arch/arm64/include/asm/device.h
24 @@ -25,6 +25,7 @@ struct dev_archdata {
25 };
26
27 struct pdev_archdata {
28 + u64 dma_mask;
29 };
30
31 #endif
32 --- a/arch/arm64/kernel/setup.c
33 +++ b/arch/arm64/kernel/setup.c
34 @@ -44,6 +44,7 @@
35 #include <linux/of_platform.h>
36 #include <linux/efi.h>
37 #include <linux/psci.h>
38 +#include <linux/dma-mapping.h>
39
40 #include <asm/acpi.h>
41 #include <asm/fixmap.h>
42 @@ -381,3 +382,9 @@ static int __init topology_init(void)
43 return 0;
44 }
45 subsys_initcall(topology_init);
46 +
47 +void arch_setup_pdev_archdata(struct platform_device *pdev)
48 +{
49 + pdev->archdata.dma_mask = DMA_BIT_MASK(32);
50 + pdev->dev.dma_mask = &pdev->archdata.dma_mask;
51 +}