liblitedram: Consider 1s window is valid when indirectly seen before 0 (start at 0 and long enough).

This commit is contained in:
Florent Kermarrec 2021-06-29 11:21:12 +02:00
parent 8192ad335f
commit f9f1b8e25d
1 changed files with 7 additions and 2 deletions

View File

@ -674,8 +674,13 @@ static int sdram_write_leveling_scan(int *delays, int loops, int show)
sdram_write_leveling_inc_delay(i); sdram_write_leveling_inc_delay(i);
cdelay(100); cdelay(100);
} }
/* Succeed only if the start of a 1s window has been found */ /* Succeed only if the start of a 1s window has been found: */
} else if (one_window_best_count > 0 && one_window_best_start > 0) { } else if (
/* Start of 1s window directly seen after 0. */
((one_window_best_start) > 0 && (one_window_best_count > 0)) ||
/* Start of 1s window indirectly seen before 0. */
((one_window_best_start == 0) && (one_window_best_count > _sdram_tck_taps/4))
){
#if SDRAM_PHY_DELAYS > 32 #if SDRAM_PHY_DELAYS > 32
/* Ensure write delay is just before transition */ /* Ensure write delay is just before transition */
one_window_start -= min(one_window_start, 16); one_window_start -= min(one_window_start, 16);