blob: 2fd3162ec4df13db67b8ba62bc4a6d7e9a603763 [file] [log] [blame]
Vineet Gupta3be80aa2013-01-18 15:12:17 +05301/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ARC_ASM_CACHE_H
10#define __ARC_ASM_CACHE_H
11
12/* In case $$ not config, setup a dummy number for rest of kernel */
13#ifndef CONFIG_ARC_CACHE_LINE_SHIFT
14#define L1_CACHE_SHIFT 6
15#else
16#define L1_CACHE_SHIFT CONFIG_ARC_CACHE_LINE_SHIFT
17#endif
18
19#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
Vineet Gupta63d2dfd2013-09-05 13:17:49 +053020#define CACHE_LINE_MASK (~(L1_CACHE_BYTES - 1))
Vineet Gupta95d69762013-01-18 15:12:19 +053021
Vineet Guptada1677b2013-05-14 13:28:17 +053022/*
23 * ARC700 doesn't cache any access in top 256M.
24 * Ideal for wiring memory mapped peripherals as we don't need to do
25 * explicit uncached accesses (LD.di/ST.di) hence more portable drivers
26 */
27#define ARC_UNCACHED_ADDR_SPACE 0xc0000000
28
Vineet Gupta95d69762013-01-18 15:12:19 +053029#ifndef __ASSEMBLY__
30
31/* Uncached access macros */
32#define arc_read_uncached_32(ptr) \
33({ \
34 unsigned int __ret; \
35 __asm__ __volatile__( \
36 " ld.di %0, [%1] \n" \
37 : "=r"(__ret) \
38 : "r"(ptr)); \
39 __ret; \
40})
41
42#define arc_write_uncached_32(ptr, data)\
43({ \
44 __asm__ __volatile__( \
45 " st.di %0, [%1] \n" \
46 : \
47 : "r"(data), "r"(ptr)); \
48})
49
Vineet Gupta95d69762013-01-18 15:12:19 +053050#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
51
Vineet Gupta95d69762013-01-18 15:12:19 +053052extern void arc_cache_init(void);
53extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len);
Vineet Gupta07b9b652013-09-05 19:19:06 +053054extern void read_decode_cache_bcr(void);
Vineet Guptada1677b2013-05-14 13:28:17 +053055
56#endif /* !__ASSEMBLY__ */
Vineet Gupta95d69762013-01-18 15:12:19 +053057
Vineet Gupta3be80aa2013-01-18 15:12:17 +053058#endif /* _ASM_CACHE_H */