Skip to content

Commit

Permalink
liblitedram: Consider 1s window is valid when indirectly seen before …
Browse files Browse the repository at this point in the history
…0 (start at 0 and long enough).
  • Loading branch information
enjoy-digital committed Jun 29, 2021
1 parent 8192ad3 commit f9f1b8e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions litex/soc/software/liblitedram/sdram.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,13 @@ static int sdram_write_leveling_scan(int *delays, int loops, int show)
sdram_write_leveling_inc_delay(i);
cdelay(100);
}
/* Succeed only if the start of a 1s window has been found */
} else if (one_window_best_count > 0 && one_window_best_start > 0) {
/* Succeed only if the start of a 1s window has been found: */
} 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
/* Ensure write delay is just before transition */
one_window_start -= min(one_window_start, 16);
Expand Down

0 comments on commit f9f1b8e

Please sign in to comment.