From f9104b201a17ec22586a39950f4de5a5904e9fcb Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Fri, 6 Jul 2018 19:21:17 +0200 Subject: [PATCH] bios/sdram: improve read leveling (artix7 read-leveling is now done automatically at startup) --- litex/boards/targets/arty.py | 2 - litex/soc/software/bios/sdram.c | 74 +++++++++++++-------------------- 2 files changed, 29 insertions(+), 47 deletions(-) diff --git a/litex/boards/targets/arty.py b/litex/boards/targets/arty.py index e074c47ee..5e0b5aecd 100755 --- a/litex/boards/targets/arty.py +++ b/litex/boards/targets/arty.py @@ -108,8 +108,6 @@ class BaseSoC(SoCSDRAM): # sdram self.submodules.ddrphy = s7ddrphy.A7DDRPHY(platform.request("ddram")) - self.add_constant("READ_LEVELING_BITSLIP", 3) - self.add_constant("READ_LEVELING_DELAY", 14) sdram_module = MT41K128M16(self.clk_freq, "1:4") self.register_sdram(self.ddrphy, sdram_module.geom_settings, diff --git a/litex/soc/software/bios/sdram.c b/litex/soc/software/bios/sdram.c index 9b9a900d5..457515697 100644 --- a/litex/soc/software/bios/sdram.c +++ b/litex/soc/software/bios/sdram.c @@ -406,6 +406,7 @@ static int read_level_scan(int silent) /* Calibrate each DQ in turn */ sdram_dfii_pird_address_write(0); sdram_dfii_pird_baddress_write(0); + working = 0; optimal = 1; for(i=DFII_PIX_DATA_SIZE/2-1;i>=0;i--) { if (!silent) @@ -413,20 +414,22 @@ static int read_level_scan(int silent) ddrphy_dly_sel_write(1 << (DFII_PIX_DATA_SIZE/2-i-1)); ddrphy_rdly_dq_rst_write(1); for(j=0; j