bios/sdram: add ERR_DDRPH_BITSLIP constant and some cleanup

This commit is contained in:
Florent Kermarrec 2018-07-19 12:52:00 +02:00
parent 1564b440eb
commit df7e5dbcf6
1 changed files with 9 additions and 7 deletions

View File

@ -203,6 +203,7 @@ void sdrwr(char *startaddr)
#else #else
#define ERR_DDRPHY_DELAY 32 #define ERR_DDRPHY_DELAY 32
#endif #endif
#define ERR_DDRPHY_BITSLIP 8
#ifdef CSR_DDRPHY_WLEVEL_EN_ADDR #ifdef CSR_DDRPHY_WLEVEL_EN_ADDR
@ -748,15 +749,16 @@ int sdrlevel(void)
return 0; return 0;
#endif #endif
/* check for optimal read leveling window */ /* check for optimal read leveling window */
for(i=0; i<8; i++) { for(i=0; i<ERR_DDRPHY_BITSLIP; i++) {
if (read_level_scan(1)) { /* scan */
if (read_level_scan(1))
break; break;
} else { if (i == ERR_DDRPHY_BITSLIP-1)
/* else increment bitslip and re-scan */ return 0;
/* increment bitslip */
for(j=0; j<DFII_PIX_DATA_SIZE/2; j++) for(j=0; j<DFII_PIX_DATA_SIZE/2; j++)
read_bitslip_inc(j); read_bitslip_inc(j);
} }
}
/* show bitslip and scan */ /* show bitslip and scan */
printf("Read bitslip: %d\n", i); printf("Read bitslip: %d\n", i);
read_level_scan(0); read_level_scan(0);