[U-Boot] [PATCH] rockchip: sdram-common: fix size for 4GB in 32bit SoC

Kever Yang kever.yang at rock-chips.com
Thu Dec 27 01:07:43 UTC 2018


System will get size '0' in 32bit system if the size is 4GB
for the address is 32bit only, return the max space available
instead of actual DDR size in rockchip_sdram_size().

Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
---

 arch/arm/mach-rockchip/sdram_common.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/mach-rockchip/sdram_common.c b/arch/arm/mach-rockchip/sdram_common.c
index 650d53e4d9..297859c390 100644
--- a/arch/arm/mach-rockchip/sdram_common.c
+++ b/arch/arm/mach-rockchip/sdram_common.c
@@ -48,6 +48,13 @@ size_t rockchip_sdram_size(phys_addr_t reg)
 		      rank, col, bk, cs0_row, bw, row_3_4);
 	}
 
+	/*
+	 * There is always a blob of space reserved for peripheral device near
+	 * 4GB, this can avoid system get 0byte for 4GB ran in 32bit system.
+	 */
+	if (size_mb > (SDRAM_MAX_SIZE >> 20))
+		size_mb = (SDRAM_MAX_SIZE >> 20);
+
 	return (size_t)size_mb << 20;
 }
 
-- 
2.20.1



More information about the U-Boot mailing list