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.
This commit is contained in:
Florent Kermarrec 2020-12-08 10:01:18 +01:00
parent c19c343ecf
commit c6fb9ef939
1 changed files with 2 additions and 3 deletions

View File

@ -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