powerpc: Move CONFIG_SYS_DDR_SIZE to CONFIG_SYS_SDRAM_SIZE
authorTom Rini <trini@konsulko.com>
Sat, 23 Jul 2022 17:04:56 +0000 (13:04 -0400)
committerTom Rini <trini@konsulko.com>
Thu, 4 Aug 2022 20:18:47 +0000 (16:18 -0400)
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 <trini@konsulko.com>
board/freescale/mpc837xerdb/mpc837xerdb.c
board/gdsys/mpc8308/sdram.c
board/ids/ids8313/ids8313.c
board/keymile/km83xx/km83xx.c
include/configs/MPC837XERDB.h
include/configs/ids8313.h
include/configs/km/km-mpc83xx.h

index 84671f6..2650d30 100644 (file)
@@ -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 */
 
index bfd55f5..47b8804 100644 (file)
@@ -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,
index 45c77a2..48aea71 100644 (file)
@@ -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);
index 8a0b175..6a7b848 100644 (file)
@@ -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++)
index 67a6cfd..8fffb0c 100644 (file)
@@ -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 \
index a8bb209..26f0741 100644 (file)
@@ -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 |\
index 9f76f48..3c23715 100644 (file)
@@ -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