Path: blob/master/arch/m68k/include/asm/cacheflush_no.h
26481 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef _M68KNOMMU_CACHEFLUSH_H2#define _M68KNOMMU_CACHEFLUSH_H34/*5* (C) Copyright 2000-2010, Greg Ungerer <[email protected]>6*/7#include <linux/mm.h>8#include <asm/mcfsim.h>910#define flush_cache_all() __flush_cache_all()11#define flush_dcache_range(start, len) __flush_dcache_all()12#define flush_icache_range(start, len) __flush_icache_all()1314void mcf_cache_push(void);1516static inline void __clear_cache_all(void)17{18#ifdef CACHE_INVALIDATE19__asm__ __volatile__ (20"movec %0, %%CACR\n\t"21"nop\n\t"22: : "r" (CACHE_INVALIDATE) );23#endif24}2526static inline void __flush_cache_all(void)27{28#ifdef CACHE_PUSH29mcf_cache_push();30#endif31__clear_cache_all();32}3334/*35* Some ColdFire parts implement separate instruction and data caches,36* on those we should just flush the appropriate cache. If we don't need37* to do any specific flushing then this will be optimized away.38*/39static inline void __flush_icache_all(void)40{41#ifdef CACHE_INVALIDATEI42__asm__ __volatile__ (43"movec %0, %%CACR\n\t"44"nop\n\t"45: : "r" (CACHE_INVALIDATEI) );46#endif47}4849static inline void __flush_dcache_all(void)50{51#ifdef CACHE_PUSH52mcf_cache_push();53#endif54#ifdef CACHE_INVALIDATED55__asm__ __volatile__ (56"movec %0, %%CACR\n\t"57"nop\n\t"58: : "r" (CACHE_INVALIDATED) );59#else60/* Flush the write buffer */61__asm__ __volatile__ ( "nop" );62#endif63}6465/*66* Push cache entries at supplied address. We want to write back any dirty67* data and then invalidate the cache lines associated with this address.68*/69static inline void cache_push(unsigned long paddr, int len)70{71__flush_cache_all();72}7374/*75* Clear cache entries at supplied address (that is don't write back any76* dirty data).77*/78static inline void cache_clear(unsigned long paddr, int len)79{80__clear_cache_all();81}8283#include <asm-generic/cacheflush.h>8485#endif /* _M68KNOMMU_CACHEFLUSH_H */868788