Bin Meng | 8a8694d | 2018-09-26 06:55:21 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com> |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <fdtdec.h> |
Anup Patel | 0bbe9cf | 2019-02-25 08:14:30 +0000 | [diff] [blame^] | 8 | #include <linux/sizes.h> |
| 9 | |
| 10 | DECLARE_GLOBAL_DATA_PTR; |
Bin Meng | 8a8694d | 2018-09-26 06:55:21 -0700 | [diff] [blame] | 11 | |
| 12 | int dram_init(void) |
| 13 | { |
| 14 | return fdtdec_setup_mem_size_base(); |
| 15 | } |
| 16 | |
| 17 | int dram_init_banksize(void) |
| 18 | { |
| 19 | return fdtdec_setup_memory_banksize(); |
| 20 | } |
Anup Patel | 0bbe9cf | 2019-02-25 08:14:30 +0000 | [diff] [blame^] | 21 | |
| 22 | ulong board_get_usable_ram_top(ulong total_size) |
| 23 | { |
| 24 | #ifdef CONFIG_64BIT |
| 25 | /* |
| 26 | * Ensure that we run from first 4GB so that all |
| 27 | * addresses used by U-Boot are 32bit addresses. |
| 28 | * |
| 29 | * This in-turn ensures that 32bit DMA capable |
| 30 | * devices work fine because DMA mapping APIs will |
| 31 | * provide 32bit DMA addresses only. |
| 32 | */ |
| 33 | if (gd->ram_top > SZ_4G) |
| 34 | return SZ_4G; |
| 35 | #endif |
| 36 | return gd->ram_top; |
| 37 | } |