From: Matt Johnston Date: Thu, 27 Oct 2022 03:20:27 +0000 (+0800) Subject: litedram: only run sdram init at first boot X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1874cad5b70309f5a690527661bc1ad2b0276e08;p=microwatt.git litedram: only run sdram init at first boot Subsequent boots can skip the dram configuration, it will already be in a usable state. Signed-off-by: Matt Johnston --- diff --git a/litedram/gen-src/sdram_init/main.c b/litedram/gen-src/sdram_init/main.c index b42502d..2d99410 100644 --- a/litedram/gen-src/sdram_init/main.c +++ b/litedram/gen-src/sdram_init/main.c @@ -285,10 +285,14 @@ uint64_t main(void) try_flash = true; } printf("\n"); - if (ftr & SYS_REG_INFO_HAS_DRAM) { + if (ftr & SYS_REG_INFO_HAS_DRAM && !ddrctrl_init_done_read()) { printf("LiteDRAM built from LiteX %s\n", LITEX_GIT_SHA1); sdram_init(); } + + val = readq(SYSCON_BASE + SYS_REG_CTRL); + writeq(val & ~SYS_REG_CTRL_ALT_RESET, SYSCON_BASE + SYS_REG_CTRL); + if (ftr & SYS_REG_INFO_HAS_BRAM) { printf("Booting from BRAM...\n"); return 0;