[U-Boot] [PATCH] socfpga: stratix10: fix sdram_calculate_size

Dalon L Westergreen dalon.westergreen at linux.intel.com
Tue Sep 11 13:28:55 UTC 2018


On Tue, 2018-09-11 at 11:31 +0200, Marek Vasut wrote:
> On 09/10/2018 10:41 PM, Dalon Westergreen wrote:
> Incorrect type of size variable results in 0 beingreturned for sdram sizes
> greater than or equal to4GB.
> Signed-off-by: Dalon Westergreen <dwesterg at gmail.com>---
> drivers/ddr/altera/sdram_s10.c | 2 +- 1 file changed, 1 insertion(+), 1
> deletion(-)
> diff --git a/drivers/ddr/altera/sdram_s10.c
> b/drivers/ddr/altera/sdram_s10.cindex 48f4f47b14..dad0147b64 100644---
> a/drivers/ddr/altera/sdram_s10.c+++ b/drivers/ddr/altera/sdram_s10.c@@ -375,7
> +375,7 @@ unsigned long sdram_calculate_size(void) { 	u32 dramaddrw =
> hmc_readl(DRAMADDRW); -	u32 size = 1 <<
> (DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw) ++	unsigned long  size = 1 <<
> (DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw) + 			 DRAMADDRW_CFG_B
> ANK_GRP_ADDR_WIDTH(dramaddrw) + 			 DRAMADDRW_CFG_BANK_ADDR
> _WIDTH(dramaddrw) + 			 DRAMADDRW_CFG_ROW_ADDR_WIDTH(dramaddrw)
> +
> 
> Change the function to report size in MiB, prescale it here and youwon't have
> problems for a while . How does that sound ?

Prefer not to as this will be used for comparisons later which would mean we
would need to scale #defines from linux/sizes.h.
--dalon


More information about the U-Boot mailing list