blob: 812c90636d7cc59a5581558f8f8791b1dd9a0525 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Tuomas Tynkkynen28cac522017-09-19 23:18:07 +03002/*
3 * Copyright (c) 2017 Tuomas Tynkkynen
Tuomas Tynkkynen28cac522017-09-19 23:18:07 +03004 */
5#include <common.h>
6#include <fdtdec.h>
7
Tuomas Tynkkynendfdd46d2018-01-11 16:11:23 +02008#ifdef CONFIG_ARM64
9#include <asm/armv8/mmu.h>
10
11static 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 }, {
Tuomas Tynkkynene09ca642018-09-04 18:16:52 +030020 /* Lowmem peripherals */
Tuomas Tynkkynendfdd46d2018-01-11 16:11:23 +020021 .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,
Tuomas Tynkkynenac927392018-05-14 18:47:51 +030031 .size = 255UL * SZ_1G,
Tuomas Tynkkynendfdd46d2018-01-11 16:11:23 +020032 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
33 PTE_BLOCK_INNER_SHARE
34 }, {
Tuomas Tynkkynene09ca642018-09-04 18:16:52 +030035 /* Highmem PCI-E ECAM memory area */
36 .virt = 0x4010000000ULL,
37 .phys = 0x4010000000ULL,
38 .size = 0x10000000,
39 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
40 PTE_BLOCK_NON_SHARE |
41 PTE_BLOCK_PXN | PTE_BLOCK_UXN
42 }, {
43 /* Highmem PCI-E MMIO memory area */
44 .virt = 0x8000000000ULL,
45 .phys = 0x8000000000ULL,
46 .size = 0x8000000000ULL,
47 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
48 PTE_BLOCK_NON_SHARE |
49 PTE_BLOCK_PXN | PTE_BLOCK_UXN
50 }, {
Tuomas Tynkkynendfdd46d2018-01-11 16:11:23 +020051 /* List terminator */
52 0,
53 }
54};
55
56struct mm_region *mem_map = qemu_arm64_mem_map;
57#endif
58
Tuomas Tynkkynen28cac522017-09-19 23:18:07 +030059int board_init(void)
60{
61 return 0;
62}
63
64int dram_init(void)
65{
Siva Durga Prasad Paladugub3d55ea2018-07-16 15:56:11 +053066 if (fdtdec_setup_mem_size_base() != 0)
Tuomas Tynkkynen28cac522017-09-19 23:18:07 +030067 return -EINVAL;
68
69 return 0;
70}
71
72int dram_init_banksize(void)
73{
74 fdtdec_setup_memory_banksize();
75
76 return 0;
77}
78
79void *board_fdt_blob_setup(void)
80{
81 /* QEMU loads a generated DTB for us at the start of RAM. */
82 return (void *)CONFIG_SYS_SDRAM_BASE;
83}