bios/sdram: show all read scans when failing.

This commit is contained in:
Florent Kermarrec 2018-09-13 05:26:51 +02:00
parent 07e4c183cd
commit 1468b9f3ba
3 changed files with 16 additions and 8 deletions

View File

@ -403,7 +403,7 @@ static void do_command(char *c)
else if(strcmp(token, "sdrwlon") == 0) sdrwlon();
else if(strcmp(token, "sdrwloff") == 0) sdrwloff();
#endif
else if(strcmp(token, "sdrlevel") == 0) sdrlevel();
else if(strcmp(token, "sdrlevel") == 0) sdrlevel(0);
#endif
else if(strcmp(token, "memtest") == 0) memtest();
else if(strcmp(token, "sdrinit") == 0) sdrinit();

View File

@ -719,7 +719,7 @@ int memtest(void)
}
#ifdef CSR_DDRPHY_BASE
int sdrlevel(void)
int sdrlevel(int silent)
{
int delay[DFII_PIX_DATA_SIZE/2];
int high_skew[DFII_PIX_DATA_SIZE/2];
@ -729,6 +729,8 @@ int sdrlevel(void)
int best_score;
int best_bitslip;
sdrsw();
for(i=0; i<DFII_PIX_DATA_SIZE/2; i++) {
ddrphy_dly_sel_write(1<<i);
ddrphy_rdly_dq_rst_write(1);
@ -749,8 +751,10 @@ int sdrlevel(void)
best_score = 0;
best_bitslip = 0;
for(bitslip=0; bitslip<ERR_DDRPHY_BITSLIP; bitslip++) {
if (!silent)
printf("Read bitslip: %d\n", bitslip);
/* compute score */
score = read_level_scan(1);
score = read_level_scan(silent);
if (score > best_score) {
best_bitslip = bitslip;
best_score = score;
@ -764,7 +768,7 @@ int sdrlevel(void)
}
/* select best read window */
printf("Read bitslip: %d\n", best_bitslip);
printf("Best read bitslip: %d\n", best_bitslip);
for(i=0; i<DFII_PIX_DATA_SIZE/2; i++) {
ddrphy_dly_sel_write(1<<i);
ddrphy_rdly_dq_bitslip_rst_write(1);
@ -776,6 +780,8 @@ int sdrlevel(void)
read_level_scan(0);
read_level();
sdrhw();
return 1;
}
#endif
@ -789,14 +795,16 @@ int sdrinit(void)
#if CSR_DDRPHY_EN_VTC_ADDR
ddrphy_en_vtc_write(0);
#endif
sdrlevel();
sdrlevel(1);
#if CSR_DDRPHY_EN_VTC_ADDR
ddrphy_en_vtc_write(1);
#endif
#endif
sdram_dfii_control_write(DFII_CONTROL_SEL);
if(!memtest())
if(!memtest()) {
/* show scans */
sdrlevel(0);
return 0;
}
return 1;
}

View File

@ -14,7 +14,7 @@ void sdrwr(char *startaddr);
#ifdef CSR_DDRPHY_BASE
void sdrwlon(void);
void sdrwloff(void);
int sdrlevel(void);
int sdrlevel(int silent);
#endif
int memtest_silent(void);