blob: aa5f4585c6f50ce94ad04f7c1ff0d579143e708d [file] [log] [blame]
Suneel Garapatiaddfabc2019-10-19 18:37:55 -07001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2018 Marvell International Ltd.
4 *
5 * https://spdx.org/licenses
6 */
7
8#include <common.h>
9#include <asm/armv8/mmu.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060010#include <asm/global_data.h>
Suneel Garapatiaddfabc2019-10-19 18:37:55 -070011#include <asm/io.h>
12#include <asm/arch/board.h>
13
14DECLARE_GLOBAL_DATA_PTR;
15
16#define OTX_MEM_MAP_USED 3
17
18/* 1 for 83xx, +1 is end of list which needs to be empty */
19#define OTX_MEM_MAP_MAX (OTX_MEM_MAP_USED + 1 + CONFIG_NR_DRAM_BANKS + 1)
20
21static struct mm_region otx_mem_map[OTX_MEM_MAP_MAX] = {
22 {
23 .virt = 0x800000000000UL,
24 .phys = 0x800000000000UL,
25 .size = 0x40000000000UL,
26 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
27 PTE_BLOCK_NON_SHARE
28 }, {
29 .virt = 0x840000000000UL,
30 .phys = 0x840000000000UL,
31 .size = 0x40000000000UL,
32 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
33 PTE_BLOCK_NON_SHARE
34 }, {
35 .virt = 0x880000000000UL,
36 .phys = 0x880000000000UL,
37 .size = 0x40000000000UL,
38 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
39 PTE_BLOCK_NON_SHARE
40 }
41
42};
43
44struct mm_region *mem_map = otx_mem_map;
45
46void mem_map_fill(void)
47{
48 int banks = OTX_MEM_MAP_USED;
Simon Glass72cc5382022-10-20 18:22:39 -060049 u32 dram_start = CONFIG_TEXT_BASE;
Suneel Garapatiaddfabc2019-10-19 18:37:55 -070050
51 if (otx_is_soc(CN83XX)) {
52 otx_mem_map[banks].virt = 0x8c0000000000UL;
53 otx_mem_map[banks].phys = 0x8c0000000000UL;
54 otx_mem_map[banks].size = 0x40000000000UL;
55 otx_mem_map[banks].attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
56 PTE_BLOCK_NON_SHARE;
57 banks = banks + 1;
58 }
59
60 for (int i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
61 otx_mem_map[banks].virt = dram_start;
62 otx_mem_map[banks].phys = dram_start;
63 otx_mem_map[banks].size = gd->ram_size;
64 otx_mem_map[banks].attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
65 PTE_BLOCK_NON_SHARE;
66 banks = banks + 1;
67 }
68}
69
70u64 get_page_table_size(void)
71{
72 return 0x80000;
73}
74
Harald Seiler6f14d5f2020-12-15 16:47:52 +010075void reset_cpu(void)
Suneel Garapatiaddfabc2019-10-19 18:37:55 -070076{
77}