Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Alexey Brodkin | 288aaac | 2014-02-04 12:56:13 +0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved. |
Alexey Brodkin | 288aaac | 2014-02-04 12:56:13 +0400 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __ASM_ARC_CACHE_H |
| 7 | #define __ASM_ARC_CACHE_H |
| 8 | |
| 9 | #include <config.h> |
| 10 | |
Alexey Brodkin | 379b328 | 2015-12-14 17:14:46 +0300 | [diff] [blame] | 11 | /* |
| 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 Brodkin | 288aaac | 2014-02-04 12:56:13 +0400 | [diff] [blame] | 18 | |
Alexey Brodkin | fae3798 | 2019-01-22 19:37:15 +0300 | [diff] [blame] | 19 | /* CONFIG_SYS_CACHELINE_SIZE is used a lot in drivers */ |
| 20 | #define CONFIG_SYS_CACHELINE_SIZE ARCH_DMA_MINALIGN |
| 21 | |
Alexey Brodkin | f13606b | 2015-01-13 18:35:46 +0300 | [diff] [blame] | 22 | #if defined(ARC_MMU_ABSENT) |
| 23 | #define CONFIG_ARC_MMU_VER 0 |
| 24 | #elif defined(CONFIG_ARC_MMU_V2) |
Alexey Brodkin | 812980b | 2015-02-03 13:58:11 +0300 | [diff] [blame] | 25 | #define CONFIG_ARC_MMU_VER 2 |
| 26 | #elif defined(CONFIG_ARC_MMU_V3) |
| 27 | #define CONFIG_ARC_MMU_VER 3 |
Alexey Brodkin | f13606b | 2015-01-13 18:35:46 +0300 | [diff] [blame] | 28 | #elif defined(CONFIG_ARC_MMU_V4) |
| 29 | #define CONFIG_ARC_MMU_VER 4 |
Alexey Brodkin | 812980b | 2015-02-03 13:58:11 +0300 | [diff] [blame] | 30 | #endif |
| 31 | |
Alexey Brodkin | 6eb15e5 | 2015-03-30 13:36:04 +0300 | [diff] [blame] | 32 | #ifndef __ASSEMBLY__ |
| 33 | |
Alexey Brodkin | ef639e6 | 2015-05-18 16:56:26 +0300 | [diff] [blame] | 34 | void cache_init(void); |
Eugeniy Paltsev | c27814b | 2018-03-21 15:58:50 +0300 | [diff] [blame] | 35 | void flush_n_invalidate_dcache_all(void); |
Eugeniy Paltsev | 375945b | 2018-03-21 15:59:02 +0300 | [diff] [blame] | 36 | void sync_n_cleanup_cache_all(void); |
Alexey Brodkin | 6eb15e5 | 2015-03-30 13:36:04 +0300 | [diff] [blame] | 37 | |
Eugeniy Paltsev | 48b0483 | 2018-03-21 15:58:59 +0300 | [diff] [blame] | 38 | static const inline int is_ioc_enabled(void) |
| 39 | { |
| 40 | return IS_ENABLED(CONFIG_ARC_DBG_IOC_ENABLE); |
| 41 | } |
| 42 | |
Alexey Brodkin | 6eb15e5 | 2015-03-30 13:36:04 +0300 | [diff] [blame] | 43 | #endif /* __ASSEMBLY__ */ |
| 44 | |
Alexey Brodkin | 288aaac | 2014-02-04 12:56:13 +0400 | [diff] [blame] | 45 | #endif /* __ASM_ARC_CACHE_H */ |