blob: 568885a2c2862bc12699207515650d5342ddb6fd [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Copyright 2004-2009 Analog Devices Inc.
3 *
4 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07005 */
Robin Getz96f10502009-09-24 14:11:24 +00006
Bryan Wu1394f032007-05-06 14:50:22 -07007#ifndef __ARCH_BLACKFIN_CACHE_H
8#define __ARCH_BLACKFIN_CACHE_H
9
Mike Frysinger05c34572010-10-27 10:07:33 -040010#include <linux/linkage.h> /* for asmlinkage */
11
Bryan Wu1394f032007-05-06 14:50:22 -070012/*
13 * Bytes per L1 cache line
14 * Blackfin loads 32 bytes for cache
15 */
16#define L1_CACHE_SHIFT 5
17#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
18#define SMP_CACHE_BYTES L1_CACHE_BYTES
19
FUJITA Tomonoria6eb9fe2010-08-10 18:03:22 -070020#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
FUJITA Tomonori76b99692010-05-19 23:21:38 -040021
Graf Yang6b3087c2009-01-07 23:14:39 +080022#ifdef CONFIG_SMP
23#define __cacheline_aligned
24#else
25#define ____cacheline_aligned
26
Bryan Wu1394f032007-05-06 14:50:22 -070027/*
28 * Put cacheline_aliged data to L1 data memory
29 */
30#ifdef CONFIG_CACHELINE_ALIGNED_L1
31#define __cacheline_aligned \
32 __attribute__((__aligned__(L1_CACHE_BYTES), \
33 __section__(".data_l1.cacheline_aligned")))
34#endif
35
Graf Yang6b3087c2009-01-07 23:14:39 +080036#endif
37
Bryan Wu1394f032007-05-06 14:50:22 -070038/*
39 * largest L1 which this arch supports
40 */
41#define L1_CACHE_SHIFT_MAX 5
42
Graf Yang6b3087c2009-01-07 23:14:39 +080043#if defined(CONFIG_SMP) && \
Sonic Zhang47e9ded2009-06-10 08:57:08 +000044 !defined(CONFIG_BFIN_CACHE_COHERENT)
Graf Yang19a3b602009-09-22 04:55:28 +000045# if defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) || defined(CONFIG_BFIN_L2_ICACHEABLE)
Sonic Zhang47e9ded2009-06-10 08:57:08 +000046# define __ARCH_SYNC_CORE_ICACHE
47# endif
Graf Yang19a3b602009-09-22 04:55:28 +000048# if defined(CONFIG_BFIN_EXTMEM_DCACHEABLE) || defined(CONFIG_BFIN_L2_DCACHEABLE)
Sonic Zhang47e9ded2009-06-10 08:57:08 +000049# define __ARCH_SYNC_CORE_DCACHE
50# endif
Graf Yang6b3087c2009-01-07 23:14:39 +080051#ifndef __ASSEMBLY__
52asmlinkage void __raw_smp_mark_barrier_asm(void);
53asmlinkage void __raw_smp_check_barrier_asm(void);
54
55static inline void smp_mark_barrier(void)
56{
57 __raw_smp_mark_barrier_asm();
58}
59static inline void smp_check_barrier(void)
60{
61 __raw_smp_check_barrier_asm();
62}
63
64void resync_core_dcache(void);
Sonic Zhang47e9ded2009-06-10 08:57:08 +000065void resync_core_icache(void);
Graf Yang6b3087c2009-01-07 23:14:39 +080066#endif
67#endif
68
69
Bryan Wu1394f032007-05-06 14:50:22 -070070#endif