1 #include <linux/module.h>
2 #include <linux/interrupt.h>
5 #include "mach/mt_reg_base.h"
6 #include "mach/sync_write.h"
8 /* config L2 to its size */
9 extern void __inner_flush_dcache_all(void);
10 extern void __inner_flush_dcache_L1(void);
11 extern void __inner_flush_dcache_L2(void);
14 * inner_dcache_flush_all: Flush (clean + invalidate) the entire L1 data cache.
16 * This can be used ONLY by the M4U driver!!
17 * Other drivers should NOT use this function at all!!
18 * Others should use DMA-mapping APIs!!
20 * After calling the function, the buffer should not be touched anymore.
21 * And the M4U driver should then call outer_flush_all() immediately.
22 * Here is the example:
23 * // Cannot touch the buffer from here.
24 * inner_dcache_flush_all();
26 * // Can touch the buffer from here.
27 * If preemption occurs and the driver cannot guarantee that no other process will touch the buffer,
28 * the driver should use LOCK to protect this code segment.
31 void inner_dcache_flush_all(void)
33 __inner_flush_dcache_all();
36 void inner_dcache_flush_L1(void)
38 __inner_flush_dcache_L1();
41 void inner_dcache_flush_L2(void)
43 __inner_flush_dcache_L2();
47 * smp_inner_dcache_flush_all: Flush (clean + invalidate) the entire L1 data cache.
49 * This can be used ONLY by the M4U driver!!
50 * Other drivers should NOT use this function at all!!
51 * Others should use DMA-mapping APIs!!
53 * This is the smp version of inner_dcache_flush_all().
54 * It will use IPI to do flush on all CPUs.
55 * Must not call this function with disabled interrupts or from a
56 * hardware interrupt handler or from a bottom half handler.
58 void smp_inner_dcache_flush_all(void)
62 "Cannot invoke smp_inner_dcache_flush_all() in interrupt/softirq context\n");
67 on_each_cpu((smp_call_func_t
)inner_dcache_flush_L1
, NULL
, true);
68 inner_dcache_flush_L2();
74 EXPORT_SYMBOL(inner_dcache_flush_all
);
75 EXPORT_SYMBOL(smp_inner_dcache_flush_all
);