Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Paul Burton | d2b12a5 | 2017-04-30 21:22:42 +0200 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2016 Imagination Technologies |
Paul Burton | d2b12a5 | 2017-04-30 21:22:42 +0200 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <fdt_support.h> |
| 8 | |
Masahiro Yamada | b75d8dc | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 9 | int ft_board_setup(void *blob, struct bd_info *bd) |
Paul Burton | d2b12a5 | 2017-04-30 21:22:42 +0200 | [diff] [blame] | 10 | { |
| 11 | DECLARE_GLOBAL_DATA_PTR; |
| 12 | u64 mem_start[2], mem_size[2]; |
| 13 | int mem_regions; |
| 14 | |
| 15 | mem_start[0] = 0; |
| 16 | mem_size[0] = min_t(u64, 256llu << 20, gd->ram_size); |
| 17 | mem_regions = 1; |
| 18 | |
| 19 | if (gd->ram_size > mem_size[0]) { |
| 20 | mem_start[1] = 0x80000000 + mem_size[0]; |
| 21 | mem_size[1] = gd->ram_size - mem_size[0]; |
| 22 | mem_regions++; |
| 23 | } |
| 24 | |
| 25 | return fdt_fixup_memory_banks(blob, mem_start, mem_size, mem_regions); |
| 26 | } |