blob: 6a3349b42af23f2aa896d17fab6ff89dcf8b9e08 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Bin Meng08e484c2014-12-17 15:50:36 +08002/*
3 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
Bin Meng08e484c2014-12-17 15:50:36 +08004 */
5
6#include <common.h>
Simon Glassddb39b22019-08-24 14:10:32 -06007#include <asm/fsp/fsp_support.h>
Bin Meng08e484c2014-12-17 15:50:36 +08008
9int dram_init(void)
10{
Simon Glassddb39b22019-08-24 14:10:32 -060011 int ret;
Bin Meng08e484c2014-12-17 15:50:36 +080012
Simon Glassddb39b22019-08-24 14:10:32 -060013 /* The FSP has already set up DRAM, so grab the info we need */
14 ret = fsp_scan_for_ram_size();
15 if (ret)
16 return ret;
Bin Meng08e484c2014-12-17 15:50:36 +080017
Simon Glassf755a452019-09-25 08:11:27 -060018 if (IS_ENABLED(CONFIG_ENABLE_MRC_CACHE))
19 gd->arch.mrc_output = fsp_get_nvs_data(gd->arch.hob_list,
Bin Meng07793c082015-10-11 21:37:42 -070020 &gd->arch.mrc_output_len);
Bin Meng07793c082015-10-11 21:37:42 -070021
Bin Meng08e484c2014-12-17 15:50:36 +080022 return 0;
23}
24
Bin Meng08e484c2014-12-17 15:50:36 +080025/*
26 * This function looks for the highest region of memory lower than 4GB which
27 * has enough space for U-Boot where U-Boot is aligned on a page boundary.
28 * It overrides the default implementation found elsewhere which simply
29 * picks the end of ram, wherever that may be. The location of the stack,
30 * the relocation address, and how far U-Boot is moved by relocation are
31 * set in the global data structure.
32 */
33ulong board_get_usable_ram_top(ulong total_size)
34{
Bin Mengdb60d862014-12-17 15:50:49 +080035 return fsp_get_usable_lowmem_top(gd->arch.hob_list);
Bin Meng08e484c2014-12-17 15:50:36 +080036}