[U-Boot] [Patch v3] socfpga: stratix10: fix sdram_calculate_size
Marek Vasut
marex at denx.de
Tue Sep 11 17:38:03 UTC 2018
On 09/11/2018 07:06 PM, Dalon Westergreen wrote:
> 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 at gmail.com>
> ---
> v3: Fix commit message
> v2: Move function type to phys_size_t to match gd->ram_size
> ---
> arch/arm/mach-socfpga/include/mach/sdram_s10.h | 2 +-
> drivers/ddr/altera/sdram_s10.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-socfpga/include/mach/sdram_s10.h b/arch/arm/mach-socfpga/include/mach/sdram_s10.h
> index 91bfc0e5ec..ca68594445 100644
> --- a/arch/arm/mach-socfpga/include/mach/sdram_s10.h
> +++ b/arch/arm/mach-socfpga/include/mach/sdram_s10.h
> @@ -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);
>
> diff --git a/drivers/ddr/altera/sdram_s10.c b/drivers/ddr/altera/sdram_s10.c
> index 48f4f47b14..a48567c109 100644
> --- a/drivers/ddr/altera/sdram_s10.c
> +++ b/drivers/ddr/altera/sdram_s10.c
> @@ -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) +
>
Updated in socfpga/master, thanks
--
Best regards,
Marek Vasut
More information about the U-Boot
mailing list