blob: ab61846b5ab9983cebc1f0bfdc3fe4e88b24ff12 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Alexey Brodkin544c5f52014-02-04 12:56:13 +04002/*
3 * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
Alexey Brodkin544c5f52014-02-04 12:56:13 +04004 */
5
6#ifndef __ASM_ARC_CACHE_H
7#define __ASM_ARC_CACHE_H
8
9#include <config.h>
10
Alexey Brodkindff5df22015-12-14 17:14:46 +030011/*
12 * As of today we may handle any L1 cache line length right in software.
13 * For that essentially cache line length is a variable not constant.
14 * And to satisfy users of ARCH_DMA_MINALIGN we just use largest line length
15 * that may exist in either L1 or L2 (AKA SLC) caches on ARC.
16 */
17#define ARCH_DMA_MINALIGN 128
Alexey Brodkin544c5f52014-02-04 12:56:13 +040018
Alexey Brodkin76fe0aa2019-01-22 19:37:15 +030019/* CONFIG_SYS_CACHELINE_SIZE is used a lot in drivers */
20#define CONFIG_SYS_CACHELINE_SIZE ARCH_DMA_MINALIGN
21
Alexey Brodkine41a3d52015-01-13 18:35:46 +030022#if defined(ARC_MMU_ABSENT)
23#define CONFIG_ARC_MMU_VER 0
24#elif defined(CONFIG_ARC_MMU_V2)
Alexey Brodkinf431e262015-02-03 13:58:11 +030025#define CONFIG_ARC_MMU_VER 2
26#elif defined(CONFIG_ARC_MMU_V3)
27#define CONFIG_ARC_MMU_VER 3
Alexey Brodkine41a3d52015-01-13 18:35:46 +030028#elif defined(CONFIG_ARC_MMU_V4)
29#define CONFIG_ARC_MMU_VER 4
Alexey Brodkinf431e262015-02-03 13:58:11 +030030#endif
31
Alexey Brodkin275583e2015-03-30 13:36:04 +030032#ifndef __ASSEMBLY__
33
Alexey Brodkin9f916ee2015-05-18 16:56:26 +030034void cache_init(void);
Eugeniy Paltsevbcedf4d2018-03-21 15:58:50 +030035void flush_n_invalidate_dcache_all(void);
Eugeniy Paltsev67fd56a2018-03-21 15:59:02 +030036void sync_n_cleanup_cache_all(void);
Alexey Brodkin275583e2015-03-30 13:36:04 +030037
Eugeniy Paltsev04011ab2018-03-21 15:58:59 +030038static const inline int is_ioc_enabled(void)
39{
40 return IS_ENABLED(CONFIG_ARC_DBG_IOC_ENABLE);
41}
42
Eugeniy Paltsev67c34922020-03-11 15:00:43 +030043/*
44 * We export SLC control functions to use them in platform configuration code.
45 * They maust not be used in any generic code!
46 */
47void slc_enable(void);
48void slc_disable(void);
49
Alexey Brodkin275583e2015-03-30 13:36:04 +030050#endif /* __ASSEMBLY__ */
51
Alexey Brodkin544c5f52014-02-04 12:56:13 +040052#endif /* __ASM_ARC_CACHE_H */