Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Common header file for blackfin family of processors. |
| 3 | * |
| 4 | */ |
| 5 | |
| 6 | #ifndef _BLACKFIN_H_ |
| 7 | #define _BLACKFIN_H_ |
| 8 | |
Mike Frysinger | df30b11 | 2007-06-11 17:47:27 +0800 | [diff] [blame] | 9 | #define LO(con32) ((con32) & 0xFFFF) |
| 10 | #define lo(con32) ((con32) & 0xFFFF) |
| 11 | #define HI(con32) (((con32) >> 16) & 0xFFFF) |
| 12 | #define hi(con32) (((con32) >> 16) & 0xFFFF) |
| 13 | |
Mike Frysinger | 36a1548 | 2007-07-25 12:01:19 +0800 | [diff] [blame^] | 14 | #include <asm/mach/anomaly.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 15 | |
| 16 | #ifndef __ASSEMBLY__ |
| 17 | |
| 18 | /* SSYNC implementation for C file */ |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 19 | static inline void SSYNC(void) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 20 | { |
| 21 | int _tmp; |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 22 | if (ANOMALY_05000312 && ANOMALY_05000244) |
| 23 | __asm__ __volatile__( |
| 24 | "cli %0;" |
| 25 | "nop;" |
| 26 | "nop;" |
| 27 | "ssync;" |
| 28 | "sti %0;" |
| 29 | : "=d" (_tmp) |
| 30 | ); |
| 31 | else if (ANOMALY_05000312 && !ANOMALY_05000244) |
| 32 | __asm__ __volatile__( |
| 33 | "cli %0;" |
| 34 | "ssync;" |
| 35 | "sti %0;" |
| 36 | : "=d" (_tmp) |
| 37 | ); |
| 38 | else if (!ANOMALY_05000312 && ANOMALY_05000244) |
| 39 | __asm__ __volatile__( |
| 40 | "nop;" |
| 41 | "nop;" |
| 42 | "nop;" |
| 43 | "ssync;" |
| 44 | ); |
| 45 | else |
| 46 | __asm__ __volatile__("ssync;"); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 47 | } |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 48 | |
| 49 | /* CSYNC implementation for C file */ |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 50 | static inline void CSYNC(void) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 51 | { |
| 52 | int _tmp; |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 53 | if (ANOMALY_05000312 && ANOMALY_05000244) |
| 54 | __asm__ __volatile__( |
| 55 | "cli %0;" |
| 56 | "nop;" |
| 57 | "nop;" |
| 58 | "csync;" |
| 59 | "sti %0;" |
| 60 | : "=d" (_tmp) |
| 61 | ); |
| 62 | else if (ANOMALY_05000312 && !ANOMALY_05000244) |
| 63 | __asm__ __volatile__( |
| 64 | "cli %0;" |
| 65 | "csync;" |
| 66 | "sti %0;" |
| 67 | : "=d" (_tmp) |
| 68 | ); |
| 69 | else if (!ANOMALY_05000312 && ANOMALY_05000244) |
| 70 | __asm__ __volatile__( |
| 71 | "nop;" |
| 72 | "nop;" |
| 73 | "nop;" |
| 74 | "ssync;" |
| 75 | ); |
| 76 | else |
| 77 | __asm__ __volatile__("csync;"); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 78 | } |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 79 | |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 80 | #else /* __ASSEMBLY__ */ |
| 81 | |
| 82 | /* SSYNC & CSYNC implementations for assembly files */ |
| 83 | |
| 84 | #define ssync(x) SSYNC(x) |
| 85 | #define csync(x) CSYNC(x) |
| 86 | |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 87 | #if ANOMALY_05000312 && ANOMALY_05000244 |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 88 | #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; |
| 89 | #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; |
| 90 | |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 91 | #elif ANOMALY_05000312 && !ANOMALY_05000244 |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 92 | #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; |
| 93 | #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; |
| 94 | |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 95 | #elif !ANOMALY_05000312 && ANOMALY_05000244 |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 96 | #define SSYNC(scratch) nop; nop; nop; SSYNC; |
| 97 | #define CSYNC(scratch) nop; nop; nop; CSYNC; |
| 98 | |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 99 | #elif !ANOMALY_05000312 && !ANOMALY_05000244 |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 100 | #define SSYNC(scratch) SSYNC; |
| 101 | #define CSYNC(scratch) CSYNC; |
| 102 | |
| 103 | #endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */ |
| 104 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 105 | #endif /* __ASSEMBLY__ */ |
| 106 | |
Mike Frysinger | 36a1548 | 2007-07-25 12:01:19 +0800 | [diff] [blame^] | 107 | #include <asm/mach/blackfin.h> |
| 108 | #include <asm/bfin-global.h> |
| 109 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 110 | #endif /* _BLACKFIN_H_ */ |