aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32')
-rw-r--r--arch/avr32/mm/cache.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/avr32/mm/cache.c b/arch/avr32/mm/cache.c
index 8f7b1c3cd0f9..c1233c615e67 100644
--- a/arch/avr32/mm/cache.c
+++ b/arch/avr32/mm/cache.c
@@ -23,7 +23,6 @@
23void invalidate_dcache_region(void *start, size_t size) 23void invalidate_dcache_region(void *start, size_t size)
24{ 24{
25 unsigned long v, begin, end, linesz, mask; 25 unsigned long v, begin, end, linesz, mask;
26 int flush = 0;
27 26
28 linesz = boot_cpu_data.dcache.linesz; 27 linesz = boot_cpu_data.dcache.linesz;
29 mask = linesz - 1; 28 mask = linesz - 1;
@@ -32,24 +31,21 @@ void invalidate_dcache_region(void *start, size_t size)
32 * instead of invalidating ... never discard valid data! 31 * instead of invalidating ... never discard valid data!
33 */ 32 */
34 begin = (unsigned long)start; 33 begin = (unsigned long)start;
35 end = begin + size - 1; 34 end = begin + size;
36 35
37 if (begin & mask) { 36 if (begin & mask) {
38 flush_dcache_line(start); 37 flush_dcache_line(start);
39 begin += linesz; 38 begin += linesz;
40 flush = 1;
41 } 39 }
42 if ((end & mask) != mask) { 40 if (end & mask) {
43 flush_dcache_line((void *)end); 41 flush_dcache_line((void *)end);
44 end -= linesz; 42 end &= ~mask;
45 flush = 1;
46 } 43 }
47 44
48 /* remaining cachelines only need invalidation */ 45 /* remaining cachelines only need invalidation */
49 for (v = begin; v <= end; v += linesz) 46 for (v = begin; v < end; v += linesz)
50 invalidate_dcache_line((void *)v); 47 invalidate_dcache_line((void *)v);
51 if (flush) 48 flush_write_buffer();
52 flush_write_buffer();
53} 49}
54 50
55void clean_dcache_region(void *start, size_t size) 51void clean_dcache_region(void *start, size_t size)