layerscape: add 64b/32b target for ls1012ardb device
[openwrt/openwrt.git] / package / boot / uboot-layerscape / patches / 0016-ARM-asm-types-Introduce-DMA_ADDR_T_64BIT.patch
1 From 4aa3d79020aeca3780ea113a495d18662d593761 Mon Sep 17 00:00:00 2001
2 From: Lokesh Vutla <lokeshvutla@ti.com>
3 Date: Thu, 24 Mar 2016 16:02:00 +0530
4 Subject: [PATCH 16/93] ARM: asm: types: Introduce DMA_ADDR_T_64BIT
5
6 dma_addr_t holds any valid DMA address. If the DMA API only uses 32-bit
7 addresses, dma_addr_t need only be 32 bits wide. Bus addresses, e.g., PCI BARs,
8 may be wider than 32 bits, but drivers do memory-mapped I/O to ioremapped
9 kernel virtual addresses, so they don't care about the size of the actual
10 bus addresses.
11 Also 32 bit ARM systems with LPAE enabled can use 64bit address space, but
12 DMA still use 32bit address like in case of DRA7 and Keystone platforms.
13
14 This is inspired from the Linux kernel types implementation[1]
15
16 [1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/types.h#n142
17
18 Acked-by: Lukasz Majewski <l.majewski@samsung.com>
19 Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
20 Reviewed-by: Tom Rini <trini@konsulko.com>
21 Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
22 ---
23 arch/arm/Kconfig | 4 ++++
24 arch/arm/include/asm/types.h | 17 +++++++++++++++--
25 2 files changed, 19 insertions(+), 2 deletions(-)
26
27 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
28 index 5c20801..b536684 100644
29 --- a/arch/arm/Kconfig
30 +++ b/arch/arm/Kconfig
31 @@ -7,6 +7,10 @@ config SYS_ARCH
32 config ARM64
33 bool
34
35 +config DMA_ADDR_T_64BIT
36 + bool
37 + default y if ARM64
38 +
39 config HAS_VBAR
40 bool
41
42 diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
43 index 388058e..d108915 100644
44 --- a/arch/arm/include/asm/types.h
45 +++ b/arch/arm/include/asm/types.h
46 @@ -46,16 +46,29 @@ typedef unsigned long long u64;
47 #endif /* CONFIG_ARM64 */
48
49 #ifdef CONFIG_PHYS_64BIT
50 -typedef unsigned long long dma_addr_t;
51 typedef unsigned long long phys_addr_t;
52 typedef unsigned long long phys_size_t;
53 #else
54 /* DMA addresses are 32-bits wide */
55 -typedef u32 dma_addr_t;
56 typedef unsigned long phys_addr_t;
57 typedef unsigned long phys_size_t;
58 #endif
59
60 +/*
61 + * A dma_addr_t can hold any valid DMA address, i.e., any address returned
62 + * by the DMA API.
63 + *
64 + * If the DMA API only uses 32-bit addresses, dma_addr_t need only be 32
65 + * bits wide. Bus addresses, e.g., PCI BARs, may be wider than 32 bits,
66 + * but drivers do memory-mapped I/O to ioremapped kernel virtual addresses,
67 + * so they don't care about the size of the actual bus addresses.
68 + */
69 +#ifdef CONFIG_DMA_ADDR_T_64BIT
70 +typedef unsigned long long dma_addr_t;
71 +#else
72 +typedef u32 dma_addr_t;
73 +#endif
74 +
75 #endif /* __KERNEL__ */
76
77 typedef unsigned long resource_size_t;
78 --
79 1.7.9.5
80