1 // 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 <cpu_func.h>
8 #include <init.h>
9 #include <asm/armv8/mmu.h>
10 #include <asm/system.h>
11 #include <asm/global_data.h>
12 #include <linux/sizes.h>
13 
14 DECLARE_GLOBAL_DATA_PTR;
15 
dram_init(void)16 int dram_init(void)
17 {
18 	gd->ram_size = get_ram_size((void *)CFG_SYS_SDRAM_BASE, SZ_2G);
19 
20 	return 0;
21 }
22 
reset_cpu(void)23 void reset_cpu(void)
24 {
25 	psci_system_reset();
26 }
27 
28 static struct mm_region mt7986_mem_map[] = {
29 	{
30 		/* DDR */
31 		.virt = 0x40000000UL,
32 		.phys = 0x40000000UL,
33 		.size = 0x80000000UL,
34 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
35 	}, {
36 		.virt = 0x00000000UL,
37 		.phys = 0x00000000UL,
38 		.size = 0x40000000UL,
39 		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
40 			 PTE_BLOCK_NON_SHARE |
41 			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
42 	}, {
43 		0,
44 	}
45 };
46 
47 struct mm_region *mem_map = mt7986_mem_map;
48