Make memtest work with 4x DQ / DQS ratio

This commit is contained in:
Piotr Binkowski 2022-01-25 17:11:43 +01:00 committed by Ryszard Różak
parent aa3506a393
commit f49d2953ed
1 changed files with 14 additions and 0 deletions

View File

@ -346,9 +346,19 @@ static unsigned int sdram_write_read_check_test_pattern(int module, unsigned int
/* Verify bytes matching current 'module' */ /* Verify bytes matching current 'module' */
for (int i = 0; i < DFII_PIX_DATA_BYTES; ++i) { for (int i = 0; i < DFII_PIX_DATA_BYTES; ++i) {
int j = p * DFII_PIX_DATA_BYTES + i; int j = p * DFII_PIX_DATA_BYTES + i;
#if SDRAM_PHY_DQ_DQS_RATIO == 4
if (j % (SDRAM_PHY_MODULES/2) == ((SDRAM_PHY_MODULES-1)/2)-(module/2)) {
if(module % 2) {
errors += popcount((prs[p][i] & 0xf0) ^ (tst[i] & 0xf0));
} else {
errors += popcount((prs[p][i] & 0x0f) ^ (tst[i] & 0x0f));
}
}
#else
if (j % SDRAM_PHY_MODULES == SDRAM_PHY_MODULES-1-module) { if (j % SDRAM_PHY_MODULES == SDRAM_PHY_MODULES-1-module) {
errors += popcount(prs[p][i] ^ tst[i]); errors += popcount(prs[p][i] ^ tst[i]);
} }
#endif
} }
} }
@ -636,7 +646,11 @@ static int sdram_write_leveling_scan(int *delays, int loops, int show)
ddrphy_wlevel_strobe_write(1); ddrphy_wlevel_strobe_write(1);
cdelay(100); cdelay(100);
csr_rd_buf_uint8(sdram_dfii_pix_rddata_addr(0), buf, DFII_PIX_DATA_BYTES); csr_rd_buf_uint8(sdram_dfii_pix_rddata_addr(0), buf, DFII_PIX_DATA_BYTES);
#if SDRAM_PHY_DQ_DQS_RATIO == 4
if (buf[SDRAM_PHY_MODULES-1-(i/2)] != 0)
#else
if (buf[SDRAM_PHY_MODULES-1-i] != 0) if (buf[SDRAM_PHY_MODULES-1-i] != 0)
#endif
one_count++; one_count++;
else else
zero_count++; zero_count++;