
Current flush_cache code does
1. clean the dcache with dcbst, but not invalidate dcache 2. invalidate icache
This patch use the dcbf instead of dcbst to have stronger semantic, clean the dcache and invalidate dcache.
Signed-off-by: Dave Liu daveliu@freescale.com ---
To meet DMA safe operation on cache enabled system, such as DMA_TO_DEVICE/DMA_FROM_DEVICE/DMA_BIDIRECTIONAL
We have two options:
1. Separate functions for them like linux kernel. A. clean dcache (dcbst) for DMA_TO_DEVICE B. invalidate dcache (dcbi) for DMA_FROM_DEVICE C. flush dcache (dcbf) for DMA_BIDIRECTIONAL. 2. Make current flush_cache stronger semanctic. use the dcbf instead of dcbst.
Which one is better? or you have better option? Please suggest.
Thanks, Dave
lib_ppc/cache.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib_ppc/cache.c b/lib_ppc/cache.c index 27e1a82..f4039ba 100644 --- a/lib_ppc/cache.c +++ b/lib_ppc/cache.c @@ -34,9 +34,9 @@ void flush_cache (ulong start_addr, ulong size) for (addr = start_addr; addr < end_addr; addr += CFG_CACHELINE_SIZE) { - asm ("dcbst 0,%0": :"r" (addr)); + asm ("dcbf 0,%0": :"r" (addr)); } - asm ("sync"); /* Wait for all dcbst to complete on bus */ + asm ("sync"); /* Wait for all dcbf to complete on bus */
for (addr = start_addr; addr < end_addr;