162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * include/asm-xtensa/cache.h
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
562306a36Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
662306a36Sopenharmony_ci * for more details.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * (C) 2001 - 2005 Tensilica Inc.
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef _XTENSA_CACHE_H
1262306a36Sopenharmony_ci#define _XTENSA_CACHE_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include <asm/core.h>
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define L1_CACHE_SHIFT	XCHAL_DCACHE_LINEWIDTH
1762306a36Sopenharmony_ci#define L1_CACHE_BYTES	XCHAL_DCACHE_LINESIZE
1862306a36Sopenharmony_ci#define SMP_CACHE_BYTES	L1_CACHE_BYTES
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define DCACHE_WAY_SIZE	(XCHAL_DCACHE_SIZE/XCHAL_DCACHE_WAYS)
2162306a36Sopenharmony_ci#define ICACHE_WAY_SIZE	(XCHAL_ICACHE_SIZE/XCHAL_ICACHE_WAYS)
2262306a36Sopenharmony_ci#define DCACHE_WAY_SHIFT (XCHAL_DCACHE_SETWIDTH + XCHAL_DCACHE_LINEWIDTH)
2362306a36Sopenharmony_ci#define ICACHE_WAY_SHIFT (XCHAL_ICACHE_SETWIDTH + XCHAL_ICACHE_LINEWIDTH)
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci/* Maximum cache size per way. */
2662306a36Sopenharmony_ci#if DCACHE_WAY_SIZE >= ICACHE_WAY_SIZE
2762306a36Sopenharmony_ci# define CACHE_WAY_SIZE DCACHE_WAY_SIZE
2862306a36Sopenharmony_ci#else
2962306a36Sopenharmony_ci# define CACHE_WAY_SIZE ICACHE_WAY_SIZE
3062306a36Sopenharmony_ci#endif
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define ARCH_DMA_MINALIGN	L1_CACHE_BYTES
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/*
3562306a36Sopenharmony_ci * R/O after init is actually writable, it cannot go to .rodata
3662306a36Sopenharmony_ci * according to vmlinux linker script.
3762306a36Sopenharmony_ci */
3862306a36Sopenharmony_ci#define __ro_after_init __read_mostly
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#endif	/* _XTENSA_CACHE_H */
41