aboutsummaryrefslogtreecommitdiff
path: root/src/soc/rockchip/rk3399
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/rockchip/rk3399')
-rw-r--r--src/soc/rockchip/rk3399/include/soc/addressmap.h2
-rw-r--r--src/soc/rockchip/rk3399/romstage.c4
-rw-r--r--src/soc/rockchip/rk3399/soc.c7
3 files changed, 9 insertions, 4 deletions
diff --git a/src/soc/rockchip/rk3399/include/soc/addressmap.h b/src/soc/rockchip/rk3399/include/soc/addressmap.h
index 8c1dacc08c..28cbd7a56e 100644
--- a/src/soc/rockchip/rk3399/include/soc/addressmap.h
+++ b/src/soc/rockchip/rk3399/include/soc/addressmap.h
@@ -16,6 +16,8 @@
#ifndef __SOC_ROCKCHIP_RK3399_ADDRESSMAP_H__
#define __SOC_ROCKCHIP_RK3399_ADDRESSMAP_H__
+#define MAX_DRAM_ADDRESS 0xF8000000
+
#define PMUGRF_BASE 0xff320000
#define PMUSGRF_BASE 0xff330000
#define PMUCRU_BASE 0xff750000
diff --git a/src/soc/rockchip/rk3399/romstage.c b/src/soc/rockchip/rk3399/romstage.c
index c7183b671e..05c853eb84 100644
--- a/src/soc/rockchip/rk3399/romstage.c
+++ b/src/soc/rockchip/rk3399/romstage.c
@@ -25,10 +25,12 @@
#include <program_loading.h>
#include <romstage_handoff.h>
#include <symbols.h>
+#include <soc/addressmap.h>
#include <soc/mmu_operations.h>
#include <soc/sdram.h>
-static const uint64_t dram_size = (uint64_t)CONFIG_DRAM_SIZE_MB * MiB;
+static const uint64_t dram_size =
+ (uint64_t)min((uint64_t)CONFIG_DRAM_SIZE_MB * MiB, MAX_DRAM_ADDRESS);
void main(void)
{
diff --git a/src/soc/rockchip/rk3399/soc.c b/src/soc/rockchip/rk3399/soc.c
index aa21038e64..453dc0f595 100644
--- a/src/soc/rockchip/rk3399/soc.c
+++ b/src/soc/rockchip/rk3399/soc.c
@@ -13,18 +13,19 @@
* GNU General Public License for more details.
*/
-#include <cpu/cpu.h>
#include <console/console.h>
+#include <cpu/cpu.h>
#include <device/device.h>
-#include <stdlib.h>
+#include <soc/addressmap.h>
#include <stddef.h>
+#include <stdlib.h>
#include <string.h>
#include <symbols.h>
static void soc_read_resources(device_t dev)
{
ram_resource(dev, 0, (uintptr_t)_dram / KiB,
- CONFIG_DRAM_SIZE_MB * KiB);
+ min(CONFIG_DRAM_SIZE_MB * KiB, MAX_DRAM_ADDRESS / KiB));
}
static void soc_init(device_t dev)