mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
bios/sdram: changes to ease manual read window selection
This commit is contained in:
parent
a760322fbd
commit
9547938527
1 changed files with 18 additions and 8 deletions
|
@ -731,6 +731,7 @@ int sdrlevel(void)
|
||||||
int delay[DFII_PIX_DATA_SIZE/2];
|
int delay[DFII_PIX_DATA_SIZE/2];
|
||||||
int high_skew[DFII_PIX_DATA_SIZE/2];
|
int high_skew[DFII_PIX_DATA_SIZE/2];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
int bitslip;
|
||||||
|
|
||||||
for(i=0; i<DFII_PIX_DATA_SIZE/2; i++) {
|
for(i=0; i<DFII_PIX_DATA_SIZE/2; i++) {
|
||||||
ddrphy_dly_sel_write(1<<i);
|
ddrphy_dly_sel_write(1<<i);
|
||||||
|
@ -748,20 +749,29 @@ int sdrlevel(void)
|
||||||
if(!write_level(delay, high_skew))
|
if(!write_level(delay, high_skew))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
/* check for optimal read leveling window */
|
/* check possible read windows (based on bitslip) */
|
||||||
for(i=0; i<ERR_DDRPHY_BITSLIP; i++) {
|
for(bitslip=0; bitslip<ERR_DDRPHY_BITSLIP; bitslip++) {
|
||||||
/* scan */
|
/* scan */
|
||||||
if (read_level_scan(1))
|
if (read_level_scan(1))
|
||||||
break;
|
break;
|
||||||
if (i == ERR_DDRPHY_BITSLIP-1)
|
if (bitslip == ERR_DDRPHY_BITSLIP-1)
|
||||||
return 0;
|
return 0;
|
||||||
/* increment bitslip */
|
/* increment bitslip */
|
||||||
for(j=0; j<DFII_PIX_DATA_SIZE/2; j++)
|
for(i=0; i<DFII_PIX_DATA_SIZE/2; i++)
|
||||||
read_bitslip_inc(j);
|
read_bitslip_inc(i);
|
||||||
}
|
}
|
||||||
/* show bitslip and scan */
|
|
||||||
printf("Read bitslip: %d\n", i);
|
/* select read window (bitslip)*/
|
||||||
read_level_scan(0);
|
printf("Read bitslip: %d\n", bitslip);
|
||||||
|
for(i=0; i<DFII_PIX_DATA_SIZE/2; i++) {
|
||||||
|
ddrphy_dly_sel_write(1<<i);
|
||||||
|
ddrphy_rdly_dq_bitslip_rst_write(1);
|
||||||
|
for (j=0; j<bitslip; j++)
|
||||||
|
read_bitslip_inc(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* scan selected read window */
|
||||||
|
read_level_scan(0);
|
||||||
read_level();
|
read_level();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue