Skip to content

Commit

Permalink
liblitedram/sdram_leveling_center_module: Do a check after final dela…
Browse files Browse the repository at this point in the history
…y configuration.

On ECP5/DDR3, final configuration does not seem to be done correctly each time.
Add a retry/check mechanism to workaround the issue for now.
  • Loading branch information
enjoy-digital committed Mar 22, 2022
1 parent 153f9f3 commit dd7a04a
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions litex/soc/software/liblitedram/sdram.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ static void sdram_leveling_center_module(
if (show_long)
printf("| ");

delay_mid = (delay_min+delay_max)/2 % SDRAM_PHY_DELAYS;
delay_mid = (delay_min+delay_max)/2 % SDRAM_PHY_DELAYS;
delay_range = (delay_max-delay_min)/2;
if (show_short) {
if (delay_min < 0)
Expand All @@ -447,12 +447,25 @@ static void sdram_leveling_center_module(
if (show_long)
printf("\n");

/* Set delay to the middle */
rst_delay(module);
cdelay(100);
for(i = 0; i < delay_mid; i++) {
inc_delay(module);
cdelay(100);
/* Set delay to the middle and check */
if (delay_min >= 0) {
int retries = 8; /* Do N configs/checks and give up if failing */
while (retries > 0) {
/* Set delay. */
rst_delay(module);
cdelay(100);
for(i = 0; i < delay_mid; i++) {
inc_delay(module);
cdelay(100);
}

/* Check */
errors = sdram_write_read_check_test_pattern(module, 42);
errors += sdram_write_read_check_test_pattern(module, 84);
if (errors == 0)
break;
retries--;
}
}
}

Expand Down

0 comments on commit dd7a04a

Please sign in to comment.