]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0 |
ad8783cb PB |
2 | /* |
3 | * Copyright (C) 2016 Imagination Technologies | |
ad8783cb PB |
4 | */ |
5 | ||
6 | #include <common.h> | |
67c4e9f8 | 7 | #include <init.h> |
401d1c4f | 8 | #include <asm/global_data.h> |
ad8783cb PB |
9 | |
10 | #include <asm/io.h> | |
11 | ||
12 | #include "boston-regs.h" | |
13 | ||
088454cd SG |
14 | DECLARE_GLOBAL_DATA_PTR; |
15 | ||
f1683aa7 | 16 | int dram_init(void) |
ad8783cb PB |
17 | { |
18 | u32 ddrconf0 = __raw_readl((uint32_t *)BOSTON_PLAT_DDRCONF0); | |
19 | ||
088454cd SG |
20 | gd->ram_size = (phys_size_t)(ddrconf0 & BOSTON_PLAT_DDRCONF0_SIZE) << |
21 | 30; | |
22 | ||
23 | return 0; | |
ad8783cb PB |
24 | } |
25 | ||
26 | ulong board_get_usable_ram_top(ulong total_size) | |
27 | { | |
28 | DECLARE_GLOBAL_DATA_PTR; | |
29 | ||
30 | if (gd->ram_top < CONFIG_SYS_SDRAM_BASE) { | |
31 | /* 2GB wrapped around to 0 */ | |
32 | return CKSEG0ADDR(256 << 20); | |
33 | } | |
34 | ||
35 | return min_t(unsigned long, gd->ram_top, CKSEG0ADDR(256 << 20)); | |
36 | } |