bios: add more Ultrascale SDRAM debug with sdram_cdly command to set clk/cmd delay.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 10 Mar 2020 12:08:49 +0000 (13:08 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 10 Mar 2020 12:08:49 +0000 (13:08 +0100)
litex/soc/software/bios/main.c
litex/soc/software/bios/sdram.c
litex/soc/software/bios/sdram.h

index 4c3824c7847d9af811f9d787bb45dc4a44f54fa5..83bff1e1048446c912a769bc503b492882e21267 100644 (file)
@@ -390,6 +390,7 @@ static void help(void)
 #endif
 #ifdef USDDRPHY_DEBUG
        puts("");
+       puts("sdram_cdly value                - Set SDRAM clk/cmd delay");
        puts("sdram_cal                       - run SDRAM calibration");
        puts("sdram_mpr                       - read SDRAM MPR");
        puts("sdram_mrwr reg value            - write SDRAM mode registers");
@@ -486,6 +487,8 @@ static void do_command(char *c)
        else if(strcmp(token, "sdtest") == 0) sdcard_test(atoi(get_token(&c)));
 #endif
 #ifdef USDDRPHY_DEBUG
+       else if(strcmp(token, "sdram_cdly") == 0)
+               ddrphy_cdly(atoi(get_token(&c)));
        else if(strcmp(token, "sdram_cal") == 0)
                sdrcal();
        else if(strcmp(token, "sdram_mpr") == 0)
index 7654caafa478e496a209b496abbd93ba7ff1d5ca..c0fec254400345c8e951e1bbb9d2297e9c3098b8 100644 (file)
@@ -257,8 +257,9 @@ void sdrwr(char *startaddr)
 #define NBMODULES DFII_PIX_DATA_BYTES/2
 #endif
 
-#ifdef DDRPHY_CMD_DELAY
-static void ddrphy_cdly(unsigned int delay) {
+#if defined(DDRPHY_CMD_DELAY) || defined(USDDRPHY_DEBUG)
+void ddrphy_cdly(unsigned int delay) {
+       printf("Setting clk/cmd delay to %d taps\n", delay);
 #if CSR_DDRPHY_EN_VTC_ADDR
        ddrphy_en_vtc_write(0);
 #endif
@@ -994,7 +995,6 @@ int sdrinit(void)
        ddrphy_en_vtc_write(0);
 #endif
 #ifdef DDRPHY_CMD_DELAY
-       printf("Setting clk/cmd delay to %d taps\n", DDRPHY_CMD_DELAY);
        ddrphy_cdly(DDRPHY_CMD_DELAY);
 #endif
        sdrlevel();
index 7844c1e8716d806c24521370787876d729d19d8c..58509bb0fa200b0c4934c5fbed507b3a9c0a521a 100644 (file)
@@ -27,6 +27,10 @@ int memtest_silent(void);
 int memtest(void);
 int sdrinit(void);
 
+#if defined(DDRPHY_CMD_DELAY) || defined(USDDRPHY_DEBUG)
+void ddrphy_cdly(unsigned int delay);
+#endif
+
 #ifdef USDDRPHY_DEBUG
 void sdrcal(void);
 void sdrmrwr(char reg, int value);