blob: 95f830b7ffe43304b36e05d97cfa07311f155667 [file] [log] [blame]
Lokesh Vutlae0918322018-08-27 15:57:13 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * K3: ARM64 MMU setup
4 *
5 * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
6 * Lokesh Vutla <lokeshvutla@ti.com>
Michal Simek274ccb52019-01-17 08:22:43 +01007 * (This file is derived from arch/arm/mach-zynqmp/cpu.c)
Lokesh Vutlae0918322018-08-27 15:57:13 +05308 *
9 */
10
11#include <common.h>
12#include <asm/system.h>
13#include <asm/armv8/mmu.h>
14
Suman Anna5bc22e32019-06-13 10:29:48 +053015#ifdef CONFIG_SOC_K3_AM6
Lokesh Vutlae0918322018-08-27 15:57:13 +053016/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */
Suman Anna60bdc6b2019-09-04 16:01:49 +053017#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 5)
Lokesh Vutlae0918322018-08-27 15:57:13 +053018
19/* ToDo: Add 64bit IO */
20struct mm_region am654_mem_map[NR_MMU_REGIONS] = {
21 {
22 .virt = 0x0UL,
23 .phys = 0x0UL,
24 .size = 0x80000000UL,
25 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
26 PTE_BLOCK_NON_SHARE |
27 PTE_BLOCK_PXN | PTE_BLOCK_UXN
28 }, {
29 .virt = 0x80000000UL,
30 .phys = 0x80000000UL,
Suman Anna60bdc6b2019-09-04 16:01:49 +053031 .size = 0x20000000UL,
32 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
33 PTE_BLOCK_INNER_SHARE
34 }, {
35 .virt = 0xa0000000UL,
36 .phys = 0xa0000000UL,
37 .size = 0x02100000UL,
38 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) |
39 PTE_BLOCK_INNER_SHARE
40 }, {
41 .virt = 0xa2100000UL,
42 .phys = 0xa2100000UL,
43 .size = 0x5df00000UL,
Lokesh Vutlae0918322018-08-27 15:57:13 +053044 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
45 PTE_BLOCK_INNER_SHARE
46 }, {
47 .virt = 0x880000000UL,
48 .phys = 0x880000000UL,
49 .size = 0x80000000UL,
50 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
51 PTE_BLOCK_INNER_SHARE
52 }, {
Vignesh Raghavendra8915a402020-02-04 11:09:49 +053053 .virt = 0x500000000UL,
54 .phys = 0x500000000UL,
55 .size = 0x400000000UL,
56 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
57 PTE_BLOCK_NON_SHARE |
58 PTE_BLOCK_PXN | PTE_BLOCK_UXN
59 }, {
Lokesh Vutlae0918322018-08-27 15:57:13 +053060 /* List terminator */
61 0,
62 }
63};
64
65struct mm_region *mem_map = am654_mem_map;
Suman Anna5bc22e32019-06-13 10:29:48 +053066#endif /* CONFIG_SOC_K3_AM6 */
67
68#ifdef CONFIG_SOC_K3_J721E
69/* NR_DRAM_BANKS + 32bit IO + 64bit IO + terminator */
Suman Anna8f4109e2020-03-10 16:05:55 -050070#define NR_MMU_REGIONS (CONFIG_NR_DRAM_BANKS + 6)
Suman Anna5bc22e32019-06-13 10:29:48 +053071
72/* ToDo: Add 64bit IO */
73struct mm_region j721e_mem_map[NR_MMU_REGIONS] = {
74 {
75 .virt = 0x0UL,
76 .phys = 0x0UL,
77 .size = 0x80000000UL,
78 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
79 PTE_BLOCK_NON_SHARE |
80 PTE_BLOCK_PXN | PTE_BLOCK_UXN
81 }, {
82 .virt = 0x80000000UL,
83 .phys = 0x80000000UL,
84 .size = 0x20000000UL,
85 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
86 PTE_BLOCK_INNER_SHARE
87 }, {
88 .virt = 0xa0000000UL,
89 .phys = 0xa0000000UL,
Kedar Chitnis8bdd83e2019-09-04 16:01:50 +053090 .size = 0x1bc00000UL,
Suman Anna5bc22e32019-06-13 10:29:48 +053091 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) |
92 PTE_BLOCK_NON_SHARE
93 }, {
Kedar Chitnis8bdd83e2019-09-04 16:01:50 +053094 .virt = 0xbbc00000UL,
95 .phys = 0xbbc00000UL,
96 .size = 0x44400000UL,
Suman Anna5bc22e32019-06-13 10:29:48 +053097 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
98 PTE_BLOCK_INNER_SHARE
99 }, {
100 .virt = 0x880000000UL,
101 .phys = 0x880000000UL,
102 .size = 0x80000000UL,
103 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
104 PTE_BLOCK_INNER_SHARE
105 }, {
106 .virt = 0x500000000UL,
107 .phys = 0x500000000UL,
108 .size = 0x400000000UL,
109 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
110 PTE_BLOCK_NON_SHARE |
111 PTE_BLOCK_PXN | PTE_BLOCK_UXN
112 }, {
Suman Anna8f4109e2020-03-10 16:05:55 -0500113 .virt = 0x4d80000000UL,
114 .phys = 0x4d80000000UL,
115 .size = 0x0002000000UL,
116 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL_NC) |
117 PTE_BLOCK_INNER_SHARE
118 }, {
Suman Anna5bc22e32019-06-13 10:29:48 +0530119 /* List terminator */
120 0,
121 }
122};
123
124struct mm_region *mem_map = j721e_mem_map;
125#endif /* CONFIG_SOC_K3_J721E */