Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 2 | * Common header file for Blackfin family of processors. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 3 | * |
Mike Frysinger | 9695645 | 2011-06-17 17:54:40 -0400 | [diff] [blame] | 4 | * Copyright 2004-2009 Analog Devices Inc. |
5 | * | ||||
6 | * Licensed under the GPL-2 or later. | ||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 7 | */ |
8 | |||||
9 | #ifndef _BLACKFIN_H_ | ||||
10 | #define _BLACKFIN_H_ | ||||
11 | |||||
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 12 | #include <mach/anomaly.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 13 | |
14 | #ifndef __ASSEMBLY__ | ||||
15 | |||||
16 | /* SSYNC implementation for C file */ | ||||
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 17 | static inline void SSYNC(void) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 18 | { |
19 | int _tmp; | ||||
Bob Liu | 0db07a9 | 2012-01-27 22:10:04 +0800 | [diff] [blame^] | 20 | if (ANOMALY_05000312 || ANOMALY_05000244) |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 21 | __asm__ __volatile__( |
22 | "cli %0;" | ||||
23 | "nop;" | ||||
24 | "nop;" | ||||
Bob Liu | 0db07a9 | 2012-01-27 22:10:04 +0800 | [diff] [blame^] | 25 | "nop;" |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 26 | "ssync;" |
27 | "sti %0;" | ||||
28 | : "=d" (_tmp) | ||||
29 | ); | ||||
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 30 | else |
31 | __asm__ __volatile__("ssync;"); | ||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 32 | } |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 33 | |
34 | /* CSYNC implementation for C file */ | ||||
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 35 | static inline void CSYNC(void) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 36 | { |
37 | int _tmp; | ||||
Bob Liu | 0db07a9 | 2012-01-27 22:10:04 +0800 | [diff] [blame^] | 38 | if (ANOMALY_05000312 || ANOMALY_05000244) |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 39 | __asm__ __volatile__( |
40 | "cli %0;" | ||||
41 | "nop;" | ||||
42 | "nop;" | ||||
Bob Liu | 0db07a9 | 2012-01-27 22:10:04 +0800 | [diff] [blame^] | 43 | "nop;" |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 44 | "csync;" |
45 | "sti %0;" | ||||
46 | : "=d" (_tmp) | ||||
47 | ); | ||||
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 48 | else |
49 | __asm__ __volatile__("csync;"); | ||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 50 | } |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 51 | |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 52 | #else /* __ASSEMBLY__ */ |
53 | |||||
Mike Frysinger | b5e986c | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 54 | #define LO(con32) ((con32) & 0xFFFF) |
55 | #define lo(con32) ((con32) & 0xFFFF) | ||||
56 | #define HI(con32) (((con32) >> 16) & 0xFFFF) | ||||
57 | #define hi(con32) (((con32) >> 16) & 0xFFFF) | ||||
58 | |||||
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 59 | /* SSYNC & CSYNC implementations for assembly files */ |
60 | |||||
61 | #define ssync(x) SSYNC(x) | ||||
62 | #define csync(x) CSYNC(x) | ||||
63 | |||||
Bob Liu | 0db07a9 | 2012-01-27 22:10:04 +0800 | [diff] [blame^] | 64 | #if ANOMALY_05000312 || ANOMALY_05000244 |
65 | #define SSYNC(scratch) \ | ||||
66 | do { \ | ||||
67 | cli scratch; \ | ||||
68 | nop; nop; nop; \ | ||||
69 | SSYNC; \ | ||||
70 | sti scratch; \ | ||||
71 | } while (0) | ||||
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 72 | |
Bob Liu | 0db07a9 | 2012-01-27 22:10:04 +0800 | [diff] [blame^] | 73 | #define CSYNC(scratch) \ |
74 | do { \ | ||||
75 | cli scratch; \ | ||||
76 | nop; nop; nop; \ | ||||
77 | CSYNC; \ | ||||
78 | sti scratch; \ | ||||
79 | } while (0) | ||||
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 80 | |
Robin Getz | fb51d56 | 2007-08-03 17:56:29 +0800 | [diff] [blame] | 81 | #else |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 82 | #define SSYNC(scratch) SSYNC; |
83 | #define CSYNC(scratch) CSYNC; | ||||
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 84 | #endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */ |
85 | |||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 86 | #endif /* __ASSEMBLY__ */ |
87 | |||||
Mike Frysinger | fa48f84 | 2009-06-17 11:25:06 -0400 | [diff] [blame] | 88 | #include <asm/mem_map.h> |
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 89 | #include <mach/blackfin.h> |
Mike Frysinger | 36a1548 | 2007-07-25 12:01:19 +0800 | [diff] [blame] | 90 | #include <asm/bfin-global.h> |
91 | |||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 92 | #endif /* _BLACKFIN_H_ */ |