developer | b73d795 | 2020-01-10 16:30:26 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* |
| 3 | * Copyright (C) 2019 MediaTek Inc. |
| 4 | * Author: Sam Shih <sam.shih@mediatek.com> |
| 5 | */ |
| 6 | |
developer | b73d795 | 2020-01-10 16:30:26 +0800 | [diff] [blame] | 7 | #include <fdtdec.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 8 | #include <init.h> |
developer | b73d795 | 2020-01-10 16:30:26 +0800 | [diff] [blame] | 9 | #include <asm/armv8/mmu.h> |
developer | 87bf1bc | 2023-07-19 17:15:41 +0800 | [diff] [blame] | 10 | #include <asm/system.h> |
| 11 | #include <asm/global_data.h> |
developer | 87bf1bc | 2023-07-19 17:15:41 +0800 | [diff] [blame] | 12 | #include <linux/sizes.h> |
| 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
developer | b73d795 | 2020-01-10 16:30:26 +0800 | [diff] [blame] | 15 | |
| 16 | int print_cpuinfo(void) |
| 17 | { |
| 18 | printf("CPU: MediaTek MT7622\n"); |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | int dram_init(void) |
| 23 | { |
| 24 | int ret; |
| 25 | |
developer | 87bf1bc | 2023-07-19 17:15:41 +0800 | [diff] [blame] | 26 | ret = fdtdec_setup_mem_size_base(); |
developer | b73d795 | 2020-01-10 16:30:26 +0800 | [diff] [blame] | 27 | if (ret) |
| 28 | return ret; |
developer | b73d795 | 2020-01-10 16:30:26 +0800 | [diff] [blame] | 29 | |
Frank Wunderlich | def764e | 2024-06-15 11:34:56 +0200 | [diff] [blame] | 30 | gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_1G); |
developer | 87bf1bc | 2023-07-19 17:15:41 +0800 | [diff] [blame] | 31 | |
| 32 | return 0; |
developer | b73d795 | 2020-01-10 16:30:26 +0800 | [diff] [blame] | 33 | } |
| 34 | |
Harald Seiler | 6f14d5f | 2020-12-15 16:47:52 +0100 | [diff] [blame] | 35 | void reset_cpu(void) |
developer | b73d795 | 2020-01-10 16:30:26 +0800 | [diff] [blame] | 36 | { |
| 37 | psci_system_reset(); |
| 38 | } |
| 39 | |
| 40 | static struct mm_region mt7622_mem_map[] = { |
| 41 | { |
| 42 | /* DDR */ |
| 43 | .virt = 0x40000000UL, |
| 44 | .phys = 0x40000000UL, |
| 45 | .size = 0x40000000UL, |
| 46 | .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE, |
| 47 | }, { |
| 48 | .virt = 0x00000000UL, |
| 49 | .phys = 0x00000000UL, |
| 50 | .size = 0x40000000UL, |
| 51 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 52 | PTE_BLOCK_NON_SHARE | |
| 53 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 54 | }, { |
| 55 | 0, |
| 56 | } |
| 57 | }; |
| 58 | struct mm_region *mem_map = mt7622_mem_map; |