Skip to content
Snippets Groups Projects
Commit 03d3bfb0 authored by Stefan Roese's avatar Stefan Roese Committed by Shinya Kuribayashi
Browse files

MIPS: Add flush_dcache_range() and invalidate_dcache_range()


This patch adds flush_/invalidate_dcache_range() to the MIPS architecture.
Those functions are needed for the upcoming dcache support for the USB
EHCI driver. I chose this API because those cache handling functions are
already present in the PPC architecture.

Signed-off-by: default avatarStefan Roese <sr@denx.de>
Signed-off-by: default avatarShinya Kuribayashi <skuribay@ruby.dti.ne.jp>
parent 8f86a363
No related branches found
No related tags found
No related merge requests found
...@@ -65,6 +65,34 @@ void flush_cache(ulong start_addr, ulong size) ...@@ -65,6 +65,34 @@ void flush_cache(ulong start_addr, ulong size)
} }
} }
void flush_dcache_range(ulong start_addr, ulong stop)
{
unsigned long lsize = CONFIG_SYS_CACHELINE_SIZE;
unsigned long addr = start_addr & ~(lsize - 1);
unsigned long aend = (stop - 1) & ~(lsize - 1);
while (1) {
cache_op(Hit_Writeback_Inv_D, addr);
if (addr == aend)
break;
addr += lsize;
}
}
void invalidate_dcache_range(ulong start_addr, ulong stop)
{
unsigned long lsize = CONFIG_SYS_CACHELINE_SIZE;
unsigned long addr = start_addr & ~(lsize - 1);
unsigned long aend = (stop - 1) & ~(lsize - 1);
while (1) {
cache_op(Hit_Invalidate_D, addr);
if (addr == aend)
break;
addr += lsize;
}
}
void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1) void write_one_tlb(int index, u32 pagemask, u32 hi, u32 low0, u32 low1)
{ {
write_c0_entrylo0(low0); write_c0_entrylo0(low0);
......
...@@ -597,6 +597,8 @@ ulong video_setmem (ulong); ...@@ -597,6 +597,8 @@ ulong video_setmem (ulong);
/* lib_$(ARCH)/cache.c */ /* lib_$(ARCH)/cache.c */
void flush_cache (unsigned long, unsigned long); void flush_cache (unsigned long, unsigned long);
void flush_dcache_range(unsigned long start, unsigned long stop);
void invalidate_dcache_range(unsigned long start, unsigned long stop);
/* lib_$(ARCH)/ticks.S */ /* lib_$(ARCH)/ticks.S */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment