socfpga: stratix10: fix sdram_calculate_size
authorDalon Westergreen <dwesterg@gmail.com>
Tue, 11 Sep 2018 17:06:14 +0000 (10:06 -0700)
committerMarek Vasut <marex@denx.de>
Sat, 15 Sep 2018 01:17:01 +0000 (03:17 +0200)
Incorrect type of size variable results in 0 being
returned for sdram sizes greater than or equal to
4GB.

Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
arch/arm/mach-socfpga/include/mach/sdram_s10.h
drivers/ddr/altera/sdram_s10.c

index 91bfc0e5ec8f4bb7ed3aa12f10d89c3ac6af8725..ca685944453dfb8b44ba8042d8fc96312809487b 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef        _SDRAM_S10_H_
 #define        _SDRAM_S10_H_
 
-unsigned long sdram_calculate_size(void);
+phys_size_t sdram_calculate_size(void);
 int sdram_mmr_init_full(unsigned int sdr_phy_reg);
 int sdram_calibration_full(void);
 
index 48f4f47b14b1b1a2e65664df93707537502d7bd3..a48567c109375d34e034d19ec833d9a0343e0670 100644 (file)
@@ -371,11 +371,11 @@ int sdram_mmr_init_full(unsigned int unused)
  * Calculate SDRAM device size based on SDRAM controller parameters.
  * Size is specified in bytes.
  */
-unsigned long sdram_calculate_size(void)
+phys_size_t sdram_calculate_size(void)
 {
        u32 dramaddrw = hmc_readl(DRAMADDRW);
 
-       u32 size = 1 << (DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw) +
+       phys_size_t size = 1 << (DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw) +
                         DRAMADDRW_CFG_BANK_GRP_ADDR_WIDTH(dramaddrw) +
                         DRAMADDRW_CFG_BANK_ADDR_WIDTH(dramaddrw) +
                         DRAMADDRW_CFG_ROW_ADDR_WIDTH(dramaddrw) +