developer | e021c15 | 2022-09-09 19:59:09 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2022 MediaTek Inc. |
| 4 | * Author: Sam Shih <sam.shih@mediatek.com> |
| 5 | */ |
| 6 | |
developer | 87bf1bc | 2023-07-19 17:15:41 +0800 | [diff] [blame] | 7 | #include <fdtdec.h> |
developer | e021c15 | 2022-09-09 19:59:09 +0800 | [diff] [blame] | 8 | #include <init.h> |
| 9 | #include <asm/armv8/mmu.h> |
| 10 | #include <asm/system.h> |
| 11 | #include <asm/global_data.h> |
Tom Rini | 5ba346a | 2022-10-28 20:27:08 -0400 | [diff] [blame] | 12 | #include <linux/sizes.h> |
developer | e021c15 | 2022-09-09 19:59:09 +0800 | [diff] [blame] | 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
| 16 | int dram_init(void) |
| 17 | { |
developer | 87bf1bc | 2023-07-19 17:15:41 +0800 | [diff] [blame] | 18 | int ret; |
| 19 | |
| 20 | ret = fdtdec_setup_mem_size_base(); |
| 21 | if (ret) |
| 22 | return ret; |
| 23 | |
| 24 | gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_2G); |
developer | e021c15 | 2022-09-09 19:59:09 +0800 | [diff] [blame] | 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |
Tom Rini | e3b3264 | 2023-03-09 11:22:07 -0500 | [diff] [blame] | 29 | void reset_cpu(void) |
developer | e021c15 | 2022-09-09 19:59:09 +0800 | [diff] [blame] | 30 | { |
| 31 | psci_system_reset(); |
| 32 | } |
| 33 | |
| 34 | static struct mm_region mt7986_mem_map[] = { |
| 35 | { |
| 36 | /* DDR */ |
| 37 | .virt = 0x40000000UL, |
| 38 | .phys = 0x40000000UL, |
| 39 | .size = 0x80000000UL, |
| 40 | .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, |
| 41 | }, { |
| 42 | .virt = 0x00000000UL, |
| 43 | .phys = 0x00000000UL, |
| 44 | .size = 0x40000000UL, |
| 45 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 46 | PTE_BLOCK_NON_SHARE | |
| 47 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 48 | }, { |
| 49 | 0, |
| 50 | } |
| 51 | }; |
| 52 | |
| 53 | struct mm_region *mem_map = mt7986_mem_map; |