summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Karlman <jonas@kwiboo.se>2023-02-07 20:27:11 +0300
committerKever Yang <kever.yang@rock-chips.com>2023-02-28 13:07:26 +0300
commit2ec15cabe973efd9a4f5324b48f566a03c8663d5 (patch)
tree96bf188bd8650940aa3d3b14f45725be3f5cd0d2
parentbde73b14f0f46760f1a0ec84a9474ed93a22e496 (diff)
downloadu-boot-2ec15cabe973efd9a4f5324b48f566a03c8663d5.tar.xz
rockchip: sdram: add dram bank with usable memory beyond 4GB
Add a second dram bank of usable memory beyond the blob of space for peripheral near 4GB. Any memory that exists beyond the 4GB mark is added to the second bank. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
-rw-r--r--arch/arm/mach-rockchip/sdram.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c
index 91951e4b8c..1d17a740ad 100644
--- a/arch/arm/mach-rockchip/sdram.c
+++ b/arch/arm/mach-rockchip/sdram.c
@@ -37,13 +37,19 @@ struct tos_parameter_t {
int dram_init_banksize(void)
{
- size_t top = min((unsigned long)(gd->ram_size + CFG_SYS_SDRAM_BASE),
- (unsigned long)(gd->ram_top));
+ size_t ram_top = (unsigned long)(gd->ram_size + CFG_SYS_SDRAM_BASE);
+ size_t top = min((unsigned long)ram_top, (unsigned long)(gd->ram_top));
#ifdef CONFIG_ARM64
/* Reserve 0x200000 for ATF bl31 */
gd->bd->bi_dram[0].start = 0x200000;
gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;
+
+ /* Add usable memory beyond the blob of space for peripheral near 4GB */
+ if (ram_top > SZ_4G && top < SZ_4G) {
+ gd->bd->bi_dram[1].start = SZ_4G;
+ gd->bd->bi_dram[1].size = ram_top - gd->bd->bi_dram[1].start;
+ }
#else
#ifdef CONFIG_SPL_OPTEE_IMAGE
struct tos_parameter_t *tos_parameter;
@@ -181,7 +187,7 @@ size_t rockchip_sdram_size(phys_addr_t reg)
* 2. update board_get_usable_ram_top() and dram_init_banksize()
* to reserve memory for peripheral space after previous update.
*/
- if (size_mb > (SDRAM_MAX_SIZE >> 20))
+ if (!IS_ENABLED(CONFIG_ARM64) && size_mb > (SDRAM_MAX_SIZE >> 20))
size_mb = (SDRAM_MAX_SIZE >> 20);
return (size_t)size_mb << 20;