layerscape: make uImage with zImage for 32-bit kernel
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.4 / 3011-arm-add-new-non-shareable-ioremap.patch
1 From 707627a28924320a7a36bdb8b02c05651c0c384d Mon Sep 17 00:00:00 2001
2 From: Pan Jiafei <Jiafei.Pan@nxp.com>
3 Date: Fri, 8 Jul 2016 11:16:13 +0800
4 Subject: [PATCH 11/70] arm: add new non-shareable ioremap
5
6 commit 17d7448eef0fa57a0899e6a864d875e7a9082561
7 [modify ioremap_cache_ns according to Linux v4.4.7]
8
9 Signed-off-by: Pan Jiafei <Jiafei.Pan@nxp.com>
10 Integrated-by: Zhao Qiang <qiang.zhao@nxp.com>
11 ---
12 arch/arm/include/asm/io.h | 4 ++++
13 arch/arm/include/asm/mach/map.h | 4 ++--
14 arch/arm/mm/ioremap.c | 7 +++++++
15 arch/arm/mm/mmu.c | 9 +++++++++
16 4 files changed, 22 insertions(+), 2 deletions(-)
17
18 --- a/arch/arm/include/asm/io.h
19 +++ b/arch/arm/include/asm/io.h
20 @@ -129,6 +129,7 @@ static inline u32 __raw_readl(const vola
21 #define MT_DEVICE_NONSHARED 1
22 #define MT_DEVICE_CACHED 2
23 #define MT_DEVICE_WC 3
24 +#define MT_MEMORY_RW_NS 4
25 /*
26 * types 4 onwards can be found in asm/mach/map.h and are undefined
27 * for ioremap
28 @@ -399,6 +400,9 @@ void __iomem *ioremap_wc(resource_size_t
29 #define ioremap_wc ioremap_wc
30 #define ioremap_wt ioremap_wc
31
32 +void __iomem *ioremap_cache_ns(resource_size_t res_cookie, size_t size);
33 +#define ioremap_cache_ns ioremap_cache_ns
34 +
35 void iounmap(volatile void __iomem *iomem_cookie);
36 #define iounmap iounmap
37
38 --- a/arch/arm/include/asm/mach/map.h
39 +++ b/arch/arm/include/asm/mach/map.h
40 @@ -21,9 +21,9 @@ struct map_desc {
41 unsigned int type;
42 };
43
44 -/* types 0-3 are defined in asm/io.h */
45 +/* types 0-4 are defined in asm/io.h */
46 enum {
47 - MT_UNCACHED = 4,
48 + MT_UNCACHED = 5,
49 MT_CACHECLEAN,
50 MT_MINICLEAN,
51 MT_LOW_VECTORS,
52 --- a/arch/arm/mm/ioremap.c
53 +++ b/arch/arm/mm/ioremap.c
54 @@ -394,6 +394,13 @@ void __iomem *ioremap_wc(resource_size_t
55 }
56 EXPORT_SYMBOL(ioremap_wc);
57
58 +void __iomem *ioremap_cache_ns(resource_size_t res_cookie, size_t size)
59 +{
60 + return arch_ioremap_caller(res_cookie, size, MT_MEMORY_RW_NS,
61 + __builtin_return_address(0));
62 +}
63 +EXPORT_SYMBOL(ioremap_cache_ns);
64 +
65 /*
66 * Remap an arbitrary physical address space into the kernel virtual
67 * address space as memory. Needed when the kernel wants to execute
68 --- a/arch/arm/mm/mmu.c
69 +++ b/arch/arm/mm/mmu.c
70 @@ -313,6 +313,13 @@ static struct mem_type mem_types[] = {
71 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
72 .domain = DOMAIN_KERNEL,
73 },
74 + [MT_MEMORY_RW_NS] = {
75 + .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
76 + L_PTE_XN,
77 + .prot_l1 = PMD_TYPE_TABLE,
78 + .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_SECT_XN,
79 + .domain = DOMAIN_KERNEL,
80 + },
81 [MT_ROM] = {
82 .prot_sect = PMD_TYPE_SECT,
83 .domain = DOMAIN_KERNEL,
84 @@ -644,6 +651,7 @@ static void __init build_mem_type_table(
85 }
86 kern_pgprot |= PTE_EXT_AF;
87 vecs_pgprot |= PTE_EXT_AF;
88 + mem_types[MT_MEMORY_RW_NS].prot_pte |= PTE_EXT_AF | cp->pte;
89
90 /*
91 * Set PXN for user mappings
92 @@ -672,6 +680,7 @@ static void __init build_mem_type_table(
93 mem_types[MT_MEMORY_RWX].prot_pte |= kern_pgprot;
94 mem_types[MT_MEMORY_RW].prot_sect |= ecc_mask | cp->pmd;
95 mem_types[MT_MEMORY_RW].prot_pte |= kern_pgprot;
96 + mem_types[MT_MEMORY_RW_NS].prot_sect |= ecc_mask | cp->pmd;
97 mem_types[MT_MEMORY_DMA_READY].prot_pte |= kern_pgprot;
98 mem_types[MT_MEMORY_RWX_NONCACHED].prot_sect |= ecc_mask;
99 mem_types[MT_ROM].prot_sect |= cp->pmd;