bios: allow testing main_ram at init when using an external controller

This commit is contained in:
Florent Kermarrec 2018-11-26 15:21:00 +01:00
parent cdfe0454bb
commit 2ad83778bf
2 changed files with 12 additions and 1 deletions

View File

@ -540,8 +540,12 @@ int main(int i, char **c)
#endif #endif
#ifdef CSR_SDRAM_BASE #ifdef CSR_SDRAM_BASE
sdr_ok = sdrinit(); sdr_ok = sdrinit();
#else
#ifdef MAIN_RAM_TEST
sdr_ok = memtest();
#else #else
sdr_ok = 1; sdr_ok = 1;
#endif
#endif #endif
if(sdr_ok) if(sdr_ok)
boot_sequence(); boot_sequence();

View File

@ -1,10 +1,11 @@
#include <generated/csr.h> #include <generated/csr.h>
#ifdef CSR_SDRAM_BASE
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef CSR_SDRAM_BASE
#include <generated/sdram_phy.h> #include <generated/sdram_phy.h>
#endif
#include <generated/mem.h> #include <generated/mem.h>
#include <hw/flags.h> #include <hw/flags.h>
#include <system.h> #include <system.h>
@ -31,6 +32,8 @@ static void cdelay(int i)
} }
} }
#ifdef CSR_SDRAM_BASE
void sdrsw(void) void sdrsw(void)
{ {
sdram_dfii_control_write(DFII_CONTROL_CKE|DFII_CONTROL_ODT|DFII_CONTROL_RESET_N); sdram_dfii_control_write(DFII_CONTROL_CKE|DFII_CONTROL_ODT|DFII_CONTROL_RESET_N);
@ -509,6 +512,8 @@ static void read_level(int module)
} }
#endif /* CSR_DDRPHY_BASE */ #endif /* CSR_DDRPHY_BASE */
#endif /* CSR_SDRAM_BASE */
static unsigned int seed_to_data_32(unsigned int seed, int random) static unsigned int seed_to_data_32(unsigned int seed, int random)
{ {
if (random) if (random)
@ -676,6 +681,8 @@ int memtest(void)
} }
} }
#ifdef CSR_SDRAM_BASE
#ifdef CSR_DDRPHY_BASE #ifdef CSR_DDRPHY_BASE
int sdrlevel(void) int sdrlevel(void)
{ {