2018-09-26 13:55:21 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <fdtdec.h>
|
2019-11-14 19:57:45 +00:00
|
|
|
#include <init.h>
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <asm/global_data.h>
|
2019-02-25 08:14:30 +00:00
|
|
|
#include <linux/sizes.h>
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
2018-09-26 13:55:21 +00:00
|
|
|
|
|
|
|
int dram_init(void)
|
|
|
|
{
|
|
|
|
return fdtdec_setup_mem_size_base();
|
|
|
|
}
|
|
|
|
|
|
|
|
int dram_init_banksize(void)
|
|
|
|
{
|
|
|
|
return fdtdec_setup_memory_banksize();
|
|
|
|
}
|
2019-02-25 08:14:30 +00:00
|
|
|
|
|
|
|
ulong board_get_usable_ram_top(ulong total_size)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Ensure that we run from first 4GB so that all
|
|
|
|
* addresses used by U-Boot are 32bit addresses.
|
|
|
|
*
|
|
|
|
* This in-turn ensures that 32bit DMA capable
|
|
|
|
* devices work fine because DMA mapping APIs will
|
|
|
|
* provide 32bit DMA addresses only.
|
|
|
|
*/
|
2021-01-31 12:35:57 +00:00
|
|
|
if (gd->ram_top >= SZ_4G)
|
|
|
|
return SZ_4G - 1;
|
|
|
|
|
2019-02-25 08:14:30 +00:00
|
|
|
return gd->ram_top;
|
|
|
|
}
|