Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Tuomas Tynkkynen | 32f1182 | 2017-09-19 23:18:07 +0300 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2017 Tuomas Tynkkynen |
Tuomas Tynkkynen | 32f1182 | 2017-09-19 23:18:07 +0300 | [diff] [blame] | 4 | */ |
| 5 | #include <common.h> |
| 6 | #include <fdtdec.h> |
| 7 | |
Tuomas Tynkkynen | ddcca73 | 2018-01-11 16:11:23 +0200 | [diff] [blame] | 8 | #ifdef CONFIG_ARM64 |
| 9 | #include <asm/armv8/mmu.h> |
| 10 | |
| 11 | static struct mm_region qemu_arm64_mem_map[] = { |
| 12 | { |
| 13 | /* Flash */ |
| 14 | .virt = 0x00000000UL, |
| 15 | .phys = 0x00000000UL, |
| 16 | .size = 0x08000000UL, |
| 17 | .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | |
| 18 | PTE_BLOCK_INNER_SHARE |
| 19 | }, { |
| 20 | /* Peripherals */ |
| 21 | .virt = 0x08000000UL, |
| 22 | .phys = 0x08000000UL, |
| 23 | .size = 0x38000000, |
| 24 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 25 | PTE_BLOCK_NON_SHARE | |
| 26 | PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| 27 | }, { |
| 28 | /* RAM */ |
| 29 | .virt = 0x40000000UL, |
| 30 | .phys = 0x40000000UL, |
Tuomas Tynkkynen | f37770c | 2018-05-14 18:47:51 +0300 | [diff] [blame] | 31 | .size = 255UL * SZ_1G, |
Tuomas Tynkkynen | ddcca73 | 2018-01-11 16:11:23 +0200 | [diff] [blame] | 32 | .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | |
| 33 | PTE_BLOCK_INNER_SHARE |
| 34 | }, { |
| 35 | /* List terminator */ |
| 36 | 0, |
| 37 | } |
| 38 | }; |
| 39 | |
| 40 | struct mm_region *mem_map = qemu_arm64_mem_map; |
| 41 | #endif |
| 42 | |
Tuomas Tynkkynen | 32f1182 | 2017-09-19 23:18:07 +0300 | [diff] [blame] | 43 | int board_init(void) |
| 44 | { |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | int dram_init(void) |
| 49 | { |
Siva Durga Prasad Paladugu | 12308b1 | 2018-07-16 15:56:11 +0530 | [diff] [blame^] | 50 | if (fdtdec_setup_mem_size_base() != 0) |
Tuomas Tynkkynen | 32f1182 | 2017-09-19 23:18:07 +0300 | [diff] [blame] | 51 | return -EINVAL; |
| 52 | |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | int dram_init_banksize(void) |
| 57 | { |
| 58 | fdtdec_setup_memory_banksize(); |
| 59 | |
| 60 | return 0; |
| 61 | } |
| 62 | |
| 63 | void *board_fdt_blob_setup(void) |
| 64 | { |
| 65 | /* QEMU loads a generated DTB for us at the start of RAM. */ |
| 66 | return (void *)CONFIG_SYS_SDRAM_BASE; |
| 67 | } |