1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * Copyright (c) 2017 Tuomas Tynkkynen
4 */
5 #include <common.h>
6 #include <fdtdec.h>
7
8 #ifdef CONFIG_ARM64
9 #include <asm/armv8/mmu.h>
10
11 static struct mm_region qemu_arm64_mem_map[] = {
12 {
13 /* Flash */
14 .virt = 0x00000000UL,
15 .phys = 0x00000000UL,
16 .size = 0x08000000UL,
17 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
18 PTE_BLOCK_INNER_SHARE
19 }, {
20 /* Peripherals */
21 .virt = 0x08000000UL,
22 .phys = 0x08000000UL,
23 .size = 0x38000000,
24 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
25 PTE_BLOCK_NON_SHARE |
26 PTE_BLOCK_PXN | PTE_BLOCK_UXN
27 }, {
28 /* RAM */
29 .virt = 0x40000000UL,
30 .phys = 0x40000000UL,
31 .size = 255UL * SZ_1G,
32 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
33 PTE_BLOCK_INNER_SHARE
34 }, {
35 /* List terminator */
36 0,
37 }
38 };
39
40 struct mm_region *mem_map = qemu_arm64_mem_map;
41 #endif
42
board_init(void)43 int board_init(void)
44 {
45 return 0;
46 }
47
dram_init(void)48 int dram_init(void)
49 {
50 if (fdtdec_setup_memory_size() != 0)
51 return -EINVAL;
52
53 return 0;
54 }
55
dram_init_banksize(void)56 int dram_init_banksize(void)
57 {
58 fdtdec_setup_memory_banksize();
59
60 return 0;
61 }
62
board_fdt_blob_setup(void)63 void *board_fdt_blob_setup(void)
64 {
65 /* QEMU loads a generated DTB for us at the start of RAM. */
66 return (void *)CONFIG_SYS_SDRAM_BASE;
67 }
68