1 /* 2 * Common header file for Blackfin family of processors. 3 * 4 * Copyright 2004-2009 Analog Devices Inc. 5 * 6 * Licensed under the GPL-2 or later. 7 */ 8 9 #ifndef _BLACKFIN_H_ 10 #define _BLACKFIN_H_ 11 12 #include <mach/anomaly.h> 13 14 #ifndef __ASSEMBLY__ 15 16 /* SSYNC implementation for C file */ SSYNC(void)17static inline void SSYNC(void) 18 { 19 int _tmp; 20 if (ANOMALY_05000312) 21 __asm__ __volatile__( 22 "cli %0;" 23 "nop;" 24 "nop;" 25 "ssync;" 26 "sti %0;" 27 : "=d" (_tmp) 28 ); 29 else if (ANOMALY_05000244) 30 __asm__ __volatile__( 31 "nop;" 32 "nop;" 33 "nop;" 34 "ssync;" 35 ); 36 else 37 __asm__ __volatile__("ssync;"); 38 } 39 40 /* CSYNC implementation for C file */ CSYNC(void)41static inline void CSYNC(void) 42 { 43 int _tmp; 44 if (ANOMALY_05000312) 45 __asm__ __volatile__( 46 "cli %0;" 47 "nop;" 48 "nop;" 49 "csync;" 50 "sti %0;" 51 : "=d" (_tmp) 52 ); 53 else if (ANOMALY_05000244) 54 __asm__ __volatile__( 55 "nop;" 56 "nop;" 57 "nop;" 58 "csync;" 59 ); 60 else 61 __asm__ __volatile__("csync;"); 62 } 63 64 #else /* __ASSEMBLY__ */ 65 66 #define LO(con32) ((con32) & 0xFFFF) 67 #define lo(con32) ((con32) & 0xFFFF) 68 #define HI(con32) (((con32) >> 16) & 0xFFFF) 69 #define hi(con32) (((con32) >> 16) & 0xFFFF) 70 71 /* SSYNC & CSYNC implementations for assembly files */ 72 73 #define ssync(x) SSYNC(x) 74 #define csync(x) CSYNC(x) 75 76 #if ANOMALY_05000312 77 #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; 78 #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; 79 80 #elif ANOMALY_05000244 81 #define SSYNC(scratch) nop; nop; nop; SSYNC; 82 #define CSYNC(scratch) nop; nop; nop; CSYNC; 83 84 #else 85 #define SSYNC(scratch) SSYNC; 86 #define CSYNC(scratch) CSYNC; 87 88 #endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */ 89 90 #endif /* __ASSEMBLY__ */ 91 92 #include <asm/mem_map.h> 93 #include <mach/blackfin.h> 94 #include <asm/bfin-global.h> 95 96 #endif /* _BLACKFIN_H_ */ 97