Merge pull request #986 from antmicro/jboc/lpddr5

soc/software/liblitedram: fix pattern checking for low DFI databits
This commit is contained in:
enjoy-digital 2021-08-23 19:11:18 +02:00 committed by GitHub
commit 17a7ac19b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -6,6 +6,7 @@
// This file is Copyright (c) 2018 Jean-François Nguyen <jf@lambdaconcept.fr>
// This file is Copyright (c) 2018 Sergiusz Bazanski <q3k@q3k.org>
// This file is Copyright (c) 2018 Tim 'mithro' Ansell <me@mith.ro>
// This file is Copyright (c) 2021 Antmicro <www.antmicro.com>
// License: BSD
#include <generated/csr.h>
@ -57,7 +58,7 @@ __attribute__((unused)) void cdelay(int i)
#define MEMTEST_DATA_SIZE (2*1024*1024)
#endif
#define DFII_PIX_DATA_BYTES SDRAM_PHY_DATABITS*SDRAM_PHY_XDR/8
#define DFII_PIX_DATA_BYTES SDRAM_PHY_DFI_DATABITS/8
int sdram_get_databits(void) {
return SDRAM_PHY_DATABITS;
@ -299,7 +300,7 @@ static void print_scan_errors(unsigned int errors) {
#endif
}
#define READ_CHECK_TEST_PATTERN_MAX_ERRORS (SDRAM_PHY_PHASES*2*32)
#define READ_CHECK_TEST_PATTERN_MAX_ERRORS (8*SDRAM_PHY_PHASES*SDRAM_PHY_XDR)
static unsigned int sdram_write_read_check_test_pattern(int module, unsigned int seed) {
int p, i;
@ -346,8 +347,12 @@ static unsigned int sdram_write_read_check_test_pattern(int module, unsigned int
/* Read back test pattern */
csr_rd_buf_uint8(sdram_dfii_pix_rddata_addr(p), tst, DFII_PIX_DATA_BYTES);
/* Verify bytes matching current 'module' */
errors += popcount(prs[p][ SDRAM_PHY_MODULES-1-module] ^ tst[ SDRAM_PHY_MODULES-1-module]);
errors += popcount(prs[p][2*SDRAM_PHY_MODULES-1-module] ^ tst[2*SDRAM_PHY_MODULES-1-module]);
for (int i = 0; i < DFII_PIX_DATA_BYTES; ++i) {
int j = p * DFII_PIX_DATA_BYTES + i;
if (j % SDRAM_PHY_MODULES == SDRAM_PHY_MODULES-1-module) {
errors += popcount(prs[p][i] ^ tst[i]);
}
}
}
#ifdef SDRAM_PHY_ECP5DDRPHY