liblitedram/sdram: Add option to disable cdelay()

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>
This commit is contained in:
Benjamin Herrenschmidt 2020-05-22 17:37:37 +10:00 committed by Florent Kermarrec
parent 6d72ef28a8
commit f8bb500a43
1 changed files with 2 additions and 0 deletions

View File

@ -29,10 +29,12 @@
__attribute__((unused)) static void cdelay(int i) __attribute__((unused)) static void cdelay(int i)
{ {
#ifndef CONFIG_SIM_DISABLE_DELAYS
while(i > 0) { while(i > 0) {
__asm__ volatile(CONFIG_CPU_NOP); __asm__ volatile(CONFIG_CPU_NOP);
i--; i--;
} }
#endif
} }
#ifdef CSR_SDRAM_BASE #ifdef CSR_SDRAM_BASE