From c6fb9ef9393723affe2af008a0afe9a02a9a560f Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 8 Dec 2020 10:01:18 +0100 Subject: [PATCH] software/liblitedram: limit clk/cmd scan to 1/2 tCK. Restrict the clk/cmd scan to 1/2 tCK since the full scan is not required and in some cases can compromise the calibration with the wrong best clk/cmd value selection. This should also allow using cmd_latency=0 in all cases. --- litex/soc/software/liblitedram/sdram.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/litex/soc/software/liblitedram/sdram.c b/litex/soc/software/liblitedram/sdram.c index 433c5b535..8d8284649 100644 --- a/litex/soc/software/liblitedram/sdram.c +++ b/litex/soc/software/liblitedram/sdram.c @@ -533,13 +533,12 @@ int sdram_write_leveling(void) int cdly_range_step; if (_sdram_write_leveling_cmd_scan) { - printf(" Cmd/Clk scan:\n"); - /* Center write leveling by varying cdly. Searching through all possible * values is slow, but we can use a simple optimization method of iterativly * scanning smaller ranges with decreasing step */ cdly_range_start = 0; - cdly_range_end = SDRAM_PHY_DELAYS; + cdly_range_end = 2*ddrphy_half_sys8x_taps_read(); /* Limit Clk/Cmd scan to 1/2 tCK */ + printf(" Cmd/Clk scan (%d-%d)\n", cdly_range_start, cdly_range_end); if (SDRAM_PHY_DELAYS > 32) cdly_range_step = SDRAM_PHY_DELAYS/8; else