Merge branch '2022-08-04-Kconfig-migrations'
[platform/kernel/u-boot.git] / board / gdsys / mpc8308 / sdram.c
index 5b67a01..47b8804 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2007 Freescale Semiconductor, Inc.
  * Copyright (C) 2010 Ilya Yanok, Emcraft Systems, yanok@emcraft.com
@@ -8,15 +9,17 @@
  *
  * This files is  mostly identical to the original from
  * board\freescale\mpc8315erdb\sdram.c
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
+#ifndef CONFIG_MPC83XX_SDRAM
+
 #include <common.h>
+#include <init.h>
 #include <mpc83xx.h>
 #include <spd_sdram.h>
 
 #include <asm/bitops.h>
+#include <asm/global_data.h>
 #include <asm/io.h>
 
 #include <asm/processor.h>
@@ -31,11 +34,11 @@ 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,
-                CONFIG_SYS_DDR_SDRAM_BASE  & 0xfffff000);
+                CONFIG_SYS_SDRAM_BASE  & 0xfffff000);
        out_be32(&im->sysconf.ddrlaw[0].ar, LBLAWAR_EN | (msize_log2 - 1));
        out_be32(&im->sysconf.ddrcdr, CONFIG_SYS_DDRCDR_VALUE);
 
@@ -63,10 +66,10 @@ static long fixed_sdram(void)
        setbits_be32(&im->ddr.sdram_cfg, SDRAM_CFG_MEM_EN);
        sync();
 
-       return get_ram_size(CONFIG_SYS_DDR_SDRAM_BASE, msize);
+       return get_ram_size(CONFIG_SYS_SDRAM_BASE, msize);
 }
 
-int initdram(void)
+int dram_init(void)
 {
        immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
        u32 msize;
@@ -82,3 +85,5 @@ int initdram(void)
 
        return 0;
 }
+
+#endif /* !CONFIG_MPC83XX_SDRAM */