bios/sdram: fix read_level_scan result
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 14 Aug 2018 16:33:28 +0000 (18:33 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 14 Aug 2018 16:33:36 +0000 (18:33 +0200)
litex/soc/software/bios/sdram.c

index 59cfa8a92684de5ee0a1f736ce5d1911297f065a..b55f13f7a7d3b90e7861e740b62c6454814f0faf 100644 (file)
@@ -446,8 +446,8 @@ static int read_level_scan(int silent)
        command_p0(DFII_COMMAND_RAS|DFII_COMMAND_WE|DFII_COMMAND_CS);
        cdelay(15);
 
-       /* Successful if working and optimal or if number of working delays > 3/4 of the taps */
-       return (working & optimal) | (working_delays > 3*ERR_DDRPHY_DELAY/4);
+       /* Successful if working and optimal or number of working delays > 3/4 of the taps */
+       return working & (optimal | working_delays > 3*(DFII_PIX_DATA_SIZE/2)*ERR_DDRPHY_DELAY/4);
 }
 
 static void read_level(void)