12 #include <linux/kernel.h>
13 #include <linux/sched.h>
19 #include <asm/pgtable.h>
20 #include <asm/mmu_context.h>
23 #include <asm/bootinfo.h>
27 static unsigned long icache_size, dcache_size;
34 #define TX39_STOP_STREAMING() \
35 __asm__ __volatile__( \
37 ".set noreorder\n\t" \
45 static void tx39h_flush_icache_all(
void)
59 static void tx39h_dma_cache_wback_inv(
unsigned long addr,
unsigned long size)
65 blast_inv_dcache_range(addr, addr + size);
70 static inline void tx39_blast_dcache_page(
unsigned long addr)
73 blast_dcache16_page(addr);
76 static inline void tx39_blast_dcache_page_indexed(
unsigned long addr)
78 blast_dcache16_page_indexed(addr);
81 static inline void tx39_blast_dcache(
void)
86 static inline void tx39_blast_icache_page(
unsigned long addr)
94 blast_icache16_page(addr);
99 static inline void tx39_blast_icache_page_indexed(
unsigned long addr)
107 blast_icache16_page_indexed(addr);
112 static inline void tx39_blast_icache(
void)
125 static void tx39__flush_cache_vmap(
void)
130 static void tx39__flush_cache_vunmap(
void)
135 static inline void tx39_flush_cache_all(
void)
143 static inline void tx39___flush_cache_all(
void)
149 static void tx39_flush_cache_mm(
struct mm_struct *mm)
159 unsigned long start,
unsigned long end)
169 static void tx39_flush_cache_page(
struct vm_area_struct *vma,
unsigned long page,
unsigned long pfn)
206 tx39_blast_dcache_page(page);
208 tx39_blast_icache_page(page);
218 tx39_blast_dcache_page_indexed(page);
220 tx39_blast_icache_page_indexed(page);
223 static void local_tx39_flush_data_cache_page(
void * addr)
225 tx39_blast_dcache_page((
unsigned long)addr);
228 static void tx39_flush_data_cache_page(
unsigned long addr)
230 tx39_blast_dcache_page(addr);
233 static void tx39_flush_icache_range(
unsigned long start,
unsigned long end)
235 if (end - start > dcache_size)
238 protected_blast_dcache_range(start, end);
240 if (end - start > icache_size)
249 protected_blast_icache_range(start, end);
255 static void tx39_flush_kernel_vmap_range(
unsigned long vaddr,
int size)
260 static void tx39_dma_cache_wback_inv(
unsigned long addr,
unsigned long size)
264 if (((size | addr) & (
PAGE_SIZE - 1)) == 0) {
267 tx39_blast_dcache_page(addr);
269 }
while(addr != end);
270 }
else if (size > dcache_size) {
273 blast_dcache_range(addr, addr + size);
277 static void tx39_dma_cache_inv(
unsigned long addr,
unsigned long size)
281 if (((size | addr) & (
PAGE_SIZE - 1)) == 0) {
284 tx39_blast_dcache_page(addr);
286 }
while(addr != end);
287 }
else if (size > dcache_size) {
290 blast_inv_dcache_range(addr, addr + size);
294 static void tx39_flush_cache_sigtramp(
unsigned long addr)
301 protected_writeback_dcache_line(addr & ~(dc_lsize - 1));
308 protected_flush_icache_line(addr & ~(ic_lsize - 1));
313 static __init void tx39_probe_cache(
void)
376 _dma_cache_wback_inv = tx39h_dma_cache_wback_inv;
407 _dma_cache_wback_inv = tx39_dma_cache_wback_inv;
408 _dma_cache_wback = tx39_dma_cache_wback_inv;
409 _dma_cache_inv = tx39_dma_cache_inv;
432 printk(
"Primary instruction cache %ldkB, linesize %d bytes\n",
434 printk(
"Primary data cache %ldkB, linesize %d bytes\n",
439 tx39h_flush_icache_all();