Skip to content

Commit f44956b

Browse files
committedJun 19, 2015
soc/sdram: add L2_SIZE constant and avoid declaring an empty flush_l2_cache function when L2_SIZE is not defined
1 parent 7c2d0fa commit f44956b

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed
 

Diff for: ‎misoclib/soc/sdram.py

+2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def register_sdram_phy(self, phy):
5353
# XXX: Limit main_ram_size to 256MB, we should modify mem_map to allow larger memories.
5454
main_ram_size = min(main_ram_size, 256*1024*1024)
5555
l2_size = self.sdram_controller_settings.l2_size
56+
if l2_size:
57+
self.add_constant("L2_SIZE", l2_size)
5658

5759
# add a Wishbone interface to the DRAM
5860
wb_sdram = wishbone.Interface()

Diff for: ‎software/bios/main.c

+3
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,10 @@ static void do_command(char *c)
355355
else if(strcmp(token, "mw") == 0) mw(get_token(&c), get_token(&c), get_token(&c));
356356
else if(strcmp(token, "mc") == 0) mc(get_token(&c), get_token(&c), get_token(&c));
357357
else if(strcmp(token, "crc") == 0) crc(get_token(&c), get_token(&c));
358+
359+
#ifdef L2_SIZE
358360
else if(strcmp(token, "flushl2") == 0) flush_l2_cache();
361+
#endif
359362

360363
#ifdef FLASH_BOOT_ADDRESS
361364
else if(strcmp(token, "flashboot") == 0) flashboot();

Diff for: ‎software/libbase/system.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,14 @@ void flush_cpu_dcache(void)
6767
#endif
6868
}
6969

70-
#ifdef CSR_L2_CACHE_BASE
70+
#ifdef L2_SIZE
7171
void flush_l2_cache(void)
7272
{
73-
unsigned int l2_nwords;
7473
unsigned int i;
7574
register unsigned int addr;
7675
register unsigned int dummy;
7776

78-
l2_nwords = 1 << l2_cache_size_read();
79-
for(i=0;i<2*l2_nwords;i++) {
77+
for(i=0;i<2*L2_SIZE;i++) {
8078
addr = MAIN_RAM_BASE + i*4;
8179
#if defined (__lm32__)
8280
__asm__ volatile("lw %0, (%1+0)\n":"=r"(dummy):"r"(addr));
@@ -87,8 +85,4 @@ void flush_l2_cache(void)
8785
#endif
8886
}
8987
}
90-
#else
91-
void flush_l2_cache(void)
92-
{
93-
}
9488
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.