mirror of
https://github.com/jhswartz/rk3229.git
synced 2024-11-24 16:06:16 +00:00
57 lines
2.2 KiB
Diff
57 lines
2.2 KiB
Diff
From 9fd1a43f8e0b4fec3b056a88f2ac0fa3412a513d Mon Sep 17 00:00:00 2001
|
|
From: Justin Swartz <justin.swartz@risingedge.co.za>
|
|
Date: Tue, 31 Mar 2020 13:50:40 +0000
|
|
Subject: [PATCH] rockchip: sdram: fix DRAM bank declaration around OP-TEE
|
|
|
|
If OP-TEE is configured, it makes sense to use CONFIG_OPTEE_TZDRAM_BASE
|
|
and CONFIG_OPTEE_TZDRAM_SIZE to declare the boundaries of the TrustZone
|
|
memory reserved for OP-TEE instead of assuming that a 32MB reservation is
|
|
always in place.
|
|
|
|
In this case, the following calculations may be used to determine the
|
|
boundaries of DRAM bank 0 and 1 which surround the TrustZone reservation:
|
|
|
|
[DRAM bank 0]
|
|
base = CONFIG_SYS_DRAM_BASE
|
|
size = CONFIG_OPTEE_TZDRAM_BASE - CONFIG_SYS_SDRAM_BASE
|
|
|
|
[DRAM bank 1]
|
|
base = CONFIG_OPTEE_TZDRAM_BASE + CONFIG_OPTEE_TZDRAM_SIZE
|
|
size = top of memory - base of DRAM bank 1
|
|
|
|
Signed-off-by: Justin Swartz <justin.swartz@risingedge.co.za>
|
|
---
|
|
arch/arm/mach-rockchip/sdram.c | 14 ++++++--------
|
|
1 file changed, 6 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c
|
|
index 530644c043..def2c23294 100644
|
|
--- a/arch/arm/mach-rockchip/sdram.c
|
|
+++ b/arch/arm/mach-rockchip/sdram.c
|
|
@@ -55,16 +55,14 @@ int dram_init_banksize(void)
|
|
- CONFIG_SYS_SDRAM_BASE;
|
|
gd->bd->bi_dram[1].start = tos_parameter->tee_mem.phy_addr +
|
|
tos_parameter->tee_mem.size;
|
|
- gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
|
|
- + top - gd->bd->bi_dram[1].start;
|
|
+ gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start;
|
|
} else {
|
|
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
|
|
- gd->bd->bi_dram[0].size = 0x8400000;
|
|
- /* Reserve 32M for OPTEE with TA */
|
|
- gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE
|
|
- + gd->bd->bi_dram[0].size + 0x2000000;
|
|
- gd->bd->bi_dram[1].size = gd->bd->bi_dram[0].start
|
|
- + top - gd->bd->bi_dram[1].start;
|
|
+ gd->bd->bi_dram[0].size = CONFIG_OPTEE_TZDRAM_BASE
|
|
+ - CONFIG_SYS_SDRAM_BASE;
|
|
+ gd->bd->bi_dram[1].start = CONFIG_OPTEE_TZDRAM_BASE
|
|
+ + CONFIG_OPTEE_TZDRAM_SIZE;
|
|
+ gd->bd->bi_dram[1].size = top - gd->bd->bi_dram[1].start;
|
|
}
|
|
#else
|
|
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
|
|
--
|
|
2.11.0
|
|
|