summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuele Ghidoli <emanuele.ghidoli@toradex.com>2023-05-25 09:03:02 +0200
committerEmanuele Ghidoli <emanuele.ghidoli@toradex.com>2023-06-01 16:53:45 +0200
commitdd4740e83be05182e801ff4296fe8a30715075c3 (patch)
treeafda33349f2880f5e0c96607bb99bf1b2d23bdb0
parent3986754ee4a1fa8537dea77cfac3e5ce05c44607 (diff)
verdin-am62: add memory size autodetection
Add memory size auto-detection, maximum size for Verdin AM62 is 2GB. Upstream-Status: Pending Initial U-Boot to be used for bring-up and validation of the V1.0 design, we'll decide on the step forward to mainline this once the bring-up and validation will be done. Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
-rw-r--r--board/toradex/verdin-am62/verdin-am62.c63
-rw-r--r--include/configs/verdin-am62.h1
2 files changed, 4 insertions, 60 deletions
diff --git a/board/toradex/verdin-am62/verdin-am62.c b/board/toradex/verdin-am62/verdin-am62.c
index a59466511c..5cb26f4899 100644
--- a/board/toradex/verdin-am62/verdin-am62.c
+++ b/board/toradex/verdin-am62/verdin-am62.c
@@ -14,6 +14,7 @@
#include <env.h>
#include <fdt_support.h>
#include <i2c.h>
+#include <init.h>
#include <k3-ddrss.h>
#include <power/tps65219.h>
#include <spl.h>
@@ -53,12 +54,8 @@ int board_init(void)
int dram_init(void)
{
- return fdtdec_setup_mem_size_base();
-}
-
-int dram_init_banksize(void)
-{
- return fdtdec_setup_memory_banksize();
+ gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_SIZE);
+ return 0;
}
#if defined(CONFIG_SPL_LOAD_FIT)
@@ -68,57 +65,6 @@ int board_fit_config_name_match(const char *name)
}
#endif
-#if IS_ENABLED(CONFIG_SPL_BUILD)
-#if IS_ENABLED(CONFIG_K3_AM64_DDRSS)
-static void fixup_ddr_driver_for_ecc(struct spl_image_info *spl_image)
-{
- struct udevice *dev;
- int ret;
-
- dram_init_banksize();
-
- ret = uclass_get_device(UCLASS_RAM, 0, &dev);
- if (ret)
- panic("Cannot get RAM device for ddr size fixup: %d\n", ret);
-
- ret = k3_ddrss_ddr_fdt_fixup(dev, spl_image->fdt_addr, gd->bd);
- if (ret)
- printf("Error fixing up ddr node for ECC use! %d\n", ret);
-}
-#else
-static void fixup_memory_node(struct spl_image_info *spl_image)
-{
- u64 start[CONFIG_NR_DRAM_BANKS];
- u64 size[CONFIG_NR_DRAM_BANKS];
- int bank;
- int ret;
-
- dram_init();
- dram_init_banksize();
-
- for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
- start[bank] = gd->bd->bi_dram[bank].start;
- size[bank] = gd->bd->bi_dram[bank].size;
- }
-
- /* dram_init functions use SPL fdt, and we must fixup u-boot fdt */
- ret = fdt_fixup_memory_banks(spl_image->fdt_addr, start, size,
- CONFIG_NR_DRAM_BANKS);
- if (ret)
- printf("Error fixing up memory node! %d\n", ret);
-}
-#endif
-
-void spl_perform_fixups(struct spl_image_info *spl_image)
-{
-#if IS_ENABLED(CONFIG_K3_AM64_DDRSS)
- fixup_ddr_driver_for_ecc(spl_image);
-#else
- fixup_memory_node(spl_image);
-#endif
-}
-#endif
-
#if IS_ENABLED(CONFIG_OF_LIBFDT) && IS_ENABLED(CONFIG_OF_BOARD_SETUP)
int ft_board_setup(void *blob, struct bd_info *bd)
{
@@ -193,8 +139,5 @@ void spl_board_init(void)
/* Make sure to mux up to take the SoC 32k from the LFOSC input */
writel(MCU_CTRL_DEVICE_CLKOUT_LFOSC_SELECT_VAL,
MCU_CTRL_DEVICE_CLKOUT_32K_CTRL);
-
- /* Init DRAM size for R5/A53 SPL */
- dram_init_banksize();
}
#endif
diff --git a/include/configs/verdin-am62.h b/include/configs/verdin-am62.h
index dec078c806..287b395bc5 100644
--- a/include/configs/verdin-am62.h
+++ b/include/configs/verdin-am62.h
@@ -15,6 +15,7 @@
#define SCRIPTADDR 0x90280000
/* DDR Configuration */
+#define CONFIG_SYS_SDRAM_SIZE SZ_2G /* Maximum supported size */
#define CONFIG_SYS_SDRAM_BASE1 0x880000000
#define CONFIG_SYS_BOOTM_LEN SZ_64M