blob: 082f12bf65e5bb5dde30f5a520f36050ca118629 [file] [log] [blame]
developerf596c1a2023-07-19 17:17:49 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2022 MediaTek Inc.
4 * Author: Sam Shih <sam.shih@mediatek.com>
5 */
6
7#include <fdtdec.h>
8#include <init.h>
9#include <asm/armv8/mmu.h>
10#include <asm/global_data.h>
11#include <asm/u-boot.h>
12#include <asm/system.h>
13
14DECLARE_GLOBAL_DATA_PTR;
15
16#define SZ_8G _AC(0x200000000, ULL)
17
18int dram_init(void)
19{
20 int ret;
21
22 ret = fdtdec_setup_mem_size_base();
23 if (ret)
24 return ret;
25
26 gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_8G);
27
28 return 0;
29}
30
31int dram_init_banksize(void)
32{
33 gd->bd->bi_dram[0].start = gd->ram_base;
34 gd->bd->bi_dram[0].size = gd->ram_size;
35
36 return 0;
37}
38
39void reset_cpu(ulong addr)
40{
41 psci_system_reset();
42}
43
44static struct mm_region mt7988_mem_map[] = {
45 {
46 /* DDR */
47 .virt = 0x40000000UL,
48 .phys = 0x40000000UL,
49 .size = 0x200000000ULL,
50 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
51 }, {
52 .virt = 0x00000000UL,
53 .phys = 0x00000000UL,
54 .size = 0x40000000UL,
55 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
56 PTE_BLOCK_NON_SHARE |
57 PTE_BLOCK_PXN | PTE_BLOCK_UXN
58 }, {
59 0,
60 }
61};
62
63struct mm_region *mem_map = mt7988_mem_map;