From 9a56ab96aa3206001c89151eb2755479f708f084 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sat, 23 Jul 2022 13:04:56 -0400 Subject: [PATCH] powerpc: Move CONFIG_SYS_DDR_SIZE to CONFIG_SYS_SDRAM_SIZE We have a number of CONFIG_SYS_xxx_SIZE options to describe the amount main memory available. Rework CONFIG_SYS_DDR_SIZE, which described a size in number of MiB to use CONFIG_SYS_SDRAM_SIZE which is most often used as a number of bytes. Use shifts of this option when required. Signed-off-by: Tom Rini --- board/freescale/mpc837xerdb/mpc837xerdb.c | 4 ++-- board/gdsys/mpc8308/sdram.c | 2 +- board/ids/ids8313/ids8313.c | 4 ++-- board/keymile/km83xx/km83xx.c | 5 ++--- include/configs/MPC837XERDB.h | 2 +- include/configs/ids8313.h | 2 +- include/configs/km/km-mpc83xx.h | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c index 84671f63c6..2650d300e3 100644 --- a/board/freescale/mpc837xerdb/mpc837xerdb.c +++ b/board/freescale/mpc837xerdb/mpc837xerdb.c @@ -97,7 +97,7 @@ int dram_init(void) int fixed_sdram(void) { immap_t *im = (immap_t *) CONFIG_SYS_IMMR; - u32 msize = CONFIG_SYS_DDR_SIZE * 1024 * 1024; + u32 msize = CONFIG_SYS_SDRAM_SIZE; u32 msize_log2 = __ilog2(msize); im->sysconf.ddrlaw[0].bar = CONFIG_SYS_SDRAM_BASE & 0xfffff000; @@ -127,7 +127,7 @@ int fixed_sdram(void) im->ddr.sdram_cfg |= SDRAM_CFG_MEM_EN; udelay(2000); - return CONFIG_SYS_DDR_SIZE; + return CONFIG_SYS_SDRAM_SIZE >> 20; } #endif /*!CONFIG_SYS_SPD_EEPROM */ diff --git a/board/gdsys/mpc8308/sdram.c b/board/gdsys/mpc8308/sdram.c index bfd55f54e4..47b8804352 100644 --- a/board/gdsys/mpc8308/sdram.c +++ b/board/gdsys/mpc8308/sdram.c @@ -34,7 +34,7 @@ DECLARE_GLOBAL_DATA_PTR; static long fixed_sdram(void) { immap_t *im = (immap_t *)CONFIG_SYS_IMMR; - u32 msize = CONFIG_SYS_DDR_SIZE * 1024 * 1024; + u32 msize = CONFIG_SYS_SDRAM_SIZE; u32 msize_log2 = __ilog2(msize); out_be32(&im->sysconf.ddrlaw[0].bar, diff --git a/board/ids/ids8313/ids8313.c b/board/ids/ids8313/ids8313.c index 45c77a249a..48aea71be6 100644 --- a/board/ids/ids8313/ids8313.c +++ b/board/ids/ids8313/ids8313.c @@ -56,7 +56,7 @@ int checkboard(void) int fixed_sdram(unsigned long config) { immap_t *im = (immap_t *)CONFIG_SYS_IMMR; - u32 msize = CONFIG_SYS_DDR_SIZE << 20; + u32 msize = CONFIG_SYS_SDRAM_SIZE; #ifndef CONFIG_SYS_RAMBOOT u32 msize_log2 = __ilog2(msize); @@ -109,7 +109,7 @@ int fixed_sdram(unsigned long config) static int setup_sdram(void) { - u32 msize = CONFIG_SYS_DDR_SIZE << 20; + u32 msize = CONFIG_SYS_SDRAM_SIZE; long int size_01, size_02; size_01 = fixed_sdram(CONFIG_SYS_DDR_CONFIG); diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 8a0b175856..6a7b848161 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -141,12 +141,11 @@ static int fixed_sdram(void) udelay(200); setbits_be32(&im->ddr.sdram_cfg, SDRAM_CFG_MEM_EN); - msize = CONFIG_SYS_DDR_SIZE << 20; disable_addr_trans(); - msize = get_ram_size(CONFIG_SYS_SDRAM_BASE, msize); + msize = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_SIZE); enable_addr_trans(); msize /= (1024 * 1024); - if (CONFIG_SYS_DDR_SIZE != msize) { + if (CONFIG_SYS_SDRAM_SIZE >> 20 != msize) { for (ddr_size = msize << 20, ddr_size_log2 = 0; (ddr_size > 1); ddr_size = ddr_size >> 1, ddr_size_log2++) diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h index 67a6cfd1ed..8fffb0c5cc 100644 --- a/include/configs/MPC837XERDB.h +++ b/include/configs/MPC837XERDB.h @@ -69,7 +69,7 @@ /* * Manually set up DDR parameters */ -#define CONFIG_SYS_DDR_SIZE 256 /* MB */ +#define CONFIG_SYS_SDRAM_SIZE 0x10000000 /* 256 MiB */ #define CONFIG_SYS_DDR_CS0_BNDS 0x0000000f #define CONFIG_SYS_DDR_CS0_CONFIG (CSCONFIG_EN \ | CSCONFIG_ODT_WR_ONLY_CURRENT \ diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h index a8bb2090ec..26f0741be3 100644 --- a/include/configs/ids8313.h +++ b/include/configs/ids8313.h @@ -41,7 +41,7 @@ * Manually set up DDR parameters, * as this board has not the SPD connected to I2C. */ -#define CONFIG_SYS_DDR_SIZE 256 /* MB */ +#define CONFIG_SYS_SDRAM_SIZE 0x10000000 /* 256 MiB */ #define CONFIG_SYS_DDR_CONFIG (CSCONFIG_EN |\ 0x00010000 |\ CSCONFIG_ROW_BIT_13 |\ diff --git a/include/configs/km/km-mpc83xx.h b/include/configs/km/km-mpc83xx.h index 9f76f48a5c..3c23715a77 100644 --- a/include/configs/km/km-mpc83xx.h +++ b/include/configs/km/km-mpc83xx.h @@ -18,7 +18,7 @@ /* * Manually set up DDR parameters */ -#define CONFIG_SYS_DDR_SIZE 2048 /* MB */ +#define CONFIG_SYS_SDRAM_SIZE 0x80000000 /* 2048 MiB */ /* * The reserved memory -- 2.39.5