developer | ff9f2d4 | 2022-09-09 19:59:11 +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 | ff9f2d4 | 2022-09-09 19:59:11 +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 | abb9a04 | 2024-05-18 20:20:43 -0600 | [diff] [blame] | 12 | #include <asm/u-boot.h> |
Tom Rini | 5ba346a | 2022-10-28 20:27:08 -0400 | [diff] [blame] | 13 | #include <linux/sizes.h> |
developer | ff9f2d4 | 2022-09-09 19:59:11 +0800 | [diff] [blame] | 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | int dram_init(void) |
| 18 | { |
developer | 87bf1bc | 2023-07-19 17:15:41 +0800 | [diff] [blame] | 19 | int ret; |
| 20 | |
| 21 | ret = fdtdec_setup_mem_size_base(); |
| 22 | if (ret) |
| 23 | return ret; |
| 24 | |
| 25 | gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_1G); |
developer | ff9f2d4 | 2022-09-09 19:59:11 +0800 | [diff] [blame] | 26 | |
| 27 | return 0; |
| 28 | } |
| 29 | |
Tom Rini | e3b3264 | 2023-03-09 11:22:07 -0500 | [diff] [blame] | 30 | void reset_cpu(void) |
developer | ff9f2d4 | 2022-09-09 19:59:11 +0800 | [diff] [blame] | 31 | { |
| 32 | psci_system_reset(); |
| 33 | } |
| 34 | |
| 35 | static struct mm_region mt7981_mem_map[] = { |
| 36 | { |
| 37 | /* DDR */ |
| 38 | .virt = 0x40000000UL, |
| 39 | .phys = 0x40000000UL, |
| 40 | .size = 0x80000000UL, |
| 41 | .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, |
| 42 | }, { |
| 43 | .virt = 0x00000000UL, |
| 44 | .phys = 0x00000000UL, |
| 45 | .size = 0x40000000UL, |
| 46 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 47 | PTE_BLOCK_NON_SHARE | |
| 48 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 49 | }, { |
| 50 | 0, |
| 51 | } |
| 52 | }; |
| 53 | |
| 54 | struct mm_region *mem_map = mt7981_mem_map; |