bios/sdram: flush l2 cache only when present
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 26 Nov 2018 17:37:45 +0000 (18:37 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Mon, 26 Nov 2018 17:37:45 +0000 (18:37 +0100)
litex/soc/software/bios/sdram.c

index 291efc835cd38c89bf451b698c2b5d31359b4502..52532aa46ee0c666ff70be725e08f1f186c197af 100644 (file)
@@ -551,7 +551,9 @@ static int memtest_bus(void)
                array[i] = ONEZERO;
        }
        flush_cpu_dcache();
+#ifdef L2_SIZE
        flush_l2_cache();
+#endif
        for(i=0;i<MEMTEST_BUS_SIZE/4;i++) {
                rdata = array[i];
                if(rdata != ONEZERO) {
@@ -566,7 +568,9 @@ static int memtest_bus(void)
                array[i] = ZEROONE;
        }
        flush_cpu_dcache();
+#ifdef L2_SIZE
        flush_l2_cache();
+#endif
        for(i=0;i<MEMTEST_BUS_SIZE/4;i++) {
                rdata = array[i];
                if(rdata != ZEROONE) {
@@ -604,7 +608,9 @@ static int memtest_data(void)
 
        seed_32 = 0;
        flush_cpu_dcache();
+#ifdef L2_SIZE
        flush_l2_cache();
+#endif
        for(i=0;i<MEMTEST_DATA_SIZE/4;i++) {
                seed_32 = seed_to_data_32(seed_32, MEMTEST_DATA_RANDOM);
                rdata = array[i];
@@ -642,7 +648,9 @@ static int memtest_addr(void)
 
        seed_16 = 0;
        flush_cpu_dcache();
+#ifdef L2_SIZE
        flush_l2_cache();
+#endif
        for(i=0;i<MEMTEST_ADDR_SIZE/4;i++) {
                seed_16 = seed_to_data_16(seed_16, MEMTEST_ADDR_RANDOM);
                rdata = array[(unsigned int) seed_16];