From 658f7120011bd09e83756bf0ebf5a8d3abe11fdb Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 7 Sep 2020 18:47:18 +0200 Subject: [PATCH] software/liblitedram/write_level: add support for manual command delay. Required on some configurations where automatic cmd/clk scan still has troubles. --- litex/soc/software/liblitedram/sdram.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/litex/soc/software/liblitedram/sdram.c b/litex/soc/software/liblitedram/sdram.c index 86c5e9b98..8fd02be44 100644 --- a/litex/soc/software/liblitedram/sdram.c +++ b/litex/soc/software/liblitedram/sdram.c @@ -409,6 +409,7 @@ int write_level(void) int cdly_range_end; int cdly_range_step; +#ifndef SDRAM_PHY_CMD_DELAY printf("Command/Clk scan:\n"); /* Center write leveling by varying cdly. Searching through all possible @@ -440,8 +441,11 @@ int write_level(void) cdly_range_step /= 4; } printf("| best: %d\n", best_cdly); - - /* if we found any working delay then set it */ +#else + best_cdly = SDRAM_PHY_CMD_DELAY; +#endif + printf("Forcing Command/Clk delay to %d taps.\n", best_cdly); + /* set working or forced delay */ if (best_cdly >= 0) { ddrphy_cdly_rst_write(1); for (int i = 0; i < best_cdly; ++i) {