blob: f111f366d758e0eb8c41731534fe5ca122d2c26d [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;
Bob Liu0db07a92012-01-27 22:10:04 +080020 if (ANOMALY_05000312 || ANOMALY_05000244)
Mike Frysinger1aafd902007-07-25 11:19:14 +080021 __asm__ __volatile__(
22 "cli %0;"
23 "nop;"
24 "nop;"
Bob Liu0db07a92012-01-27 22:10:04 +080025 "nop;"
Mike Frysinger1aafd902007-07-25 11:19:14 +080026 "ssync;"
27 "sti %0;"
28 : "=d" (_tmp)
29 );
Mike Frysinger1aafd902007-07-25 11:19:14 +080030 else
31 __asm__ __volatile__("ssync;");
Bryan Wu1394f032007-05-06 14:50:22 -070032}
Bryan Wu1394f032007-05-06 14:50:22 -070033
34/* CSYNC implementation for C file */
Mike Frysinger1aafd902007-07-25 11:19:14 +080035static inline void CSYNC(void)
Bryan Wu1394f032007-05-06 14:50:22 -070036{
37 int _tmp;
Bob Liu0db07a92012-01-27 22:10:04 +080038 if (ANOMALY_05000312 || ANOMALY_05000244)
Mike Frysinger1aafd902007-07-25 11:19:14 +080039 __asm__ __volatile__(
40 "cli %0;"
41 "nop;"
42 "nop;"
Bob Liu0db07a92012-01-27 22:10:04 +080043 "nop;"
Mike Frysinger1aafd902007-07-25 11:19:14 +080044 "csync;"
45 "sti %0;"
46 : "=d" (_tmp)
47 );
Mike Frysinger1aafd902007-07-25 11:19:14 +080048 else
49 __asm__ __volatile__("csync;");
Bryan Wu1394f032007-05-06 14:50:22 -070050}
Bryan Wu1394f032007-05-06 14:50:22 -070051
Robin Getz4bf3f3c2007-06-21 11:34:16 +080052#else /* __ASSEMBLY__ */
53
Mike Frysingerb5e986c2008-11-18 17:48:22 +080054#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 Getz4bf3f3c2007-06-21 11:34:16 +080059/* SSYNC & CSYNC implementations for assembly files */
60
61#define ssync(x) SSYNC(x)
62#define csync(x) CSYNC(x)
63
Bob Liu0db07a92012-01-27 22:10:04 +080064#if ANOMALY_05000312 || ANOMALY_05000244
65#define SSYNC(scratch) \
Bob Liu0db07a92012-01-27 22:10:04 +080066 cli scratch; \
67 nop; nop; nop; \
68 SSYNC; \
Bob Liub2286f22012-04-28 17:12:32 +080069 sti scratch;
Robin Getz4bf3f3c2007-06-21 11:34:16 +080070
Bob Liu0db07a92012-01-27 22:10:04 +080071#define CSYNC(scratch) \
Bob Liu0db07a92012-01-27 22:10:04 +080072 cli scratch; \
73 nop; nop; nop; \
74 CSYNC; \
Bob Liub2286f22012-04-28 17:12:32 +080075 sti scratch;
Robin Getz4bf3f3c2007-06-21 11:34:16 +080076
Robin Getzfb51d562007-08-03 17:56:29 +080077#else
Robin Getz4bf3f3c2007-06-21 11:34:16 +080078#define SSYNC(scratch) SSYNC;
79#define CSYNC(scratch) CSYNC;
Robin Getz4bf3f3c2007-06-21 11:34:16 +080080#endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */
81
Bryan Wu1394f032007-05-06 14:50:22 -070082#endif /* __ASSEMBLY__ */
83
Mike Frysingerfa48f842009-06-17 11:25:06 -040084#include <asm/mem_map.h>
Bryan Wu639f6572008-08-27 10:51:02 +080085#include <mach/blackfin.h>
Mike Frysinger36a15482007-07-25 12:01:19 +080086#include <asm/bfin-global.h>
87
Bryan Wu1394f032007-05-06 14:50:22 -070088#endif /* _BLACKFIN_H_ */