liblitedram/sdram: Add option to disable cdelay()
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 22 May 2020 07:37:37 +0000 (17:37 +1000)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 27 May 2020 19:39:28 +0000 (21:39 +0200)
When running in sim, those delays can take a *long* time, which
isn't always necessary with the simulated litedram PHY.

This allows system.h to optionally set CONFIG_SIM_DISABLE_DELAYS
which  causes cdelay to do nothing.

This is especially useful when using a verilated litedram inside
a bigger/slower simulated design as to not spend a huge amount
of time going through the initializations.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
litex/soc/software/liblitedram/sdram.c

index 44cab02faf0785a725f08a46d0e19e83426e4d15..55ea65f164ad43f443ed5690bb84917ca21557bf 100644 (file)
 
 __attribute__((unused)) static void cdelay(int i)
 {
+#ifndef CONFIG_SIM_DISABLE_DELAYS
        while(i > 0) {
                __asm__ volatile(CONFIG_CPU_NOP);
                i--;
        }
+#endif
 }
 
 #ifdef CSR_SDRAM_BASE