blob: 0928700b6bc4b5225c8cdd7a7629bf50776da380 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * Common header file for Blackfin family of processors.
Bryan Wu1394f032007-05-06 14:50:22 -07003 *
Mike Frysinger96956452011-06-17 17:54:40 -04004 * Copyright 2004-2009 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07007 */
8
9#ifndef _BLACKFIN_H_
10#define _BLACKFIN_H_
11
Bryan Wu639f6572008-08-27 10:51:02 +080012#include <mach/anomaly.h>
Bryan Wu1394f032007-05-06 14:50:22 -070013
14#ifndef __ASSEMBLY__
15
16/* SSYNC implementation for C file */
Mike Frysinger1aafd902007-07-25 11:19:14 +080017static inline void SSYNC(void)
Bryan Wu1394f032007-05-06 14:50:22 -070018{
19 int _tmp;
Robin Getzfb51d562007-08-03 17:56:29 +080020 if (ANOMALY_05000312)
Mike Frysinger1aafd902007-07-25 11:19:14 +080021 __asm__ __volatile__(
22 "cli %0;"
23 "nop;"
24 "nop;"
25 "ssync;"
26 "sti %0;"
27 : "=d" (_tmp)
28 );
Robin Getzfb51d562007-08-03 17:56:29 +080029 else if (ANOMALY_05000244)
Mike Frysinger1aafd902007-07-25 11:19:14 +080030 __asm__ __volatile__(
31 "nop;"
32 "nop;"
33 "nop;"
34 "ssync;"
35 );
36 else
37 __asm__ __volatile__("ssync;");
Bryan Wu1394f032007-05-06 14:50:22 -070038}
Bryan Wu1394f032007-05-06 14:50:22 -070039
40/* CSYNC implementation for C file */
Mike Frysinger1aafd902007-07-25 11:19:14 +080041static inline void CSYNC(void)
Bryan Wu1394f032007-05-06 14:50:22 -070042{
43 int _tmp;
Robin Getzfb51d562007-08-03 17:56:29 +080044 if (ANOMALY_05000312)
Mike Frysinger1aafd902007-07-25 11:19:14 +080045 __asm__ __volatile__(
46 "cli %0;"
47 "nop;"
48 "nop;"
49 "csync;"
50 "sti %0;"
51 : "=d" (_tmp)
52 );
Robin Getzfb51d562007-08-03 17:56:29 +080053 else if (ANOMALY_05000244)
Mike Frysinger1aafd902007-07-25 11:19:14 +080054 __asm__ __volatile__(
55 "nop;"
56 "nop;"
57 "nop;"
Mike Frysinger35c724f2007-08-03 16:48:13 +080058 "csync;"
Mike Frysinger1aafd902007-07-25 11:19:14 +080059 );
60 else
61 __asm__ __volatile__("csync;");
Bryan Wu1394f032007-05-06 14:50:22 -070062}
Bryan Wu1394f032007-05-06 14:50:22 -070063
Robin Getz4bf3f3c2007-06-21 11:34:16 +080064#else /* __ASSEMBLY__ */
65
Mike Frysingerb5e986c2008-11-18 17:48:22 +080066#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
Robin Getz4bf3f3c2007-06-21 11:34:16 +080071/* SSYNC & CSYNC implementations for assembly files */
72
73#define ssync(x) SSYNC(x)
74#define csync(x) CSYNC(x)
75
Robin Getzfb51d562007-08-03 17:56:29 +080076#if ANOMALY_05000312
Robin Getz4bf3f3c2007-06-21 11:34:16 +080077#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
78#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
79
Robin Getzfb51d562007-08-03 17:56:29 +080080#elif ANOMALY_05000244
Robin Getz4bf3f3c2007-06-21 11:34:16 +080081#define SSYNC(scratch) nop; nop; nop; SSYNC;
82#define CSYNC(scratch) nop; nop; nop; CSYNC;
83
Robin Getzfb51d562007-08-03 17:56:29 +080084#else
Robin Getz4bf3f3c2007-06-21 11:34:16 +080085#define SSYNC(scratch) SSYNC;
86#define CSYNC(scratch) CSYNC;
87
88#endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */
89
Bryan Wu1394f032007-05-06 14:50:22 -070090#endif /* __ASSEMBLY__ */
91
Mike Frysingerfa48f842009-06-17 11:25:06 -040092#include <asm/mem_map.h>
Bryan Wu639f6572008-08-27 10:51:02 +080093#include <mach/blackfin.h>
Mike Frysinger36a15482007-07-25 12:01:19 +080094#include <asm/bfin-global.h>
95
Bryan Wu1394f032007-05-06 14:50:22 -070096#endif /* _BLACKFIN_H_ */