CRISv32: Add cache flush operations
PATCH 1/1 CRISv32: Add cache flush operations
Add cache flush operations for CRISv32.
These are needed due to a cache bug, and can be used to make sure that the DMA descriptors are flushed to memory and can be safely handled by DMA.
flush_dma_descr - Flush one DMA descriptor. flush_dma_list - Flush a complete list of DMA descriptors. cris_flush_cache - Flush the complete cache. cris_flush_cache_range - Flush only the specified range
Signed-off-by Jesper Nilsson <[email protected]>
--- cache.c | 33 ++++++++++++++++++++ cacheflush.S | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+)
arch/cris/arch-v32/kernel/cache.c new file +33 -0
@@ -0,0 +1,33 @@ +#include <linux/module.h> +#include <asm/io.h> +#include <asm/arch/cache.h> +#include <asm/arch/hwregs/dma.h> + +/* This file is used to workaround a cache bug, Guinness TR 106. */ + +inline void flush_dma_descr (struct dma_descr_data *descr,int flush_buf) +{ +/* Flush descriptor to make sure we get correct in_eop and after. */ + asmvolatile ("ftagd [%0]" ::"r" (descr)); +/* Flush buffer pointed out by descriptor. */ +if (flush_buf) +cris_flush_cache_range (phys_to_virt ((unsigned )descr->buf), + (unsigned )(descr->after - descr->buf)); +} +EXPORT_SYMBOL (flush_dma_descr); + +void flush_dma_list (struct dma_descr_data *descr) +{ +while (1 ) { +flush_dma_descr (descr,1 ); +if (descr->eol) +break ; + descr =phys_to_virt ((unsigned )descr->next); + } +} +EXPORT_SYMBOL (flush_dma_list); + +/* From cacheflush.S */ +EXPORT_SYMBOL (cris_flush_cache); +/* From cacheflush.S */ +EXPORT_SYMBOL (cris_flush_cache_range);
arch/cris/arch-v32/kernel/cacheflush.S new file +94 -0
94 lines not on this page · raw message
/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]