diff options
author | Bryan Wu <bryan.wu@analog.com> | 2007-05-06 17:50:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:12:58 -0400 |
commit | 1394f03221790a988afc3e4b3cb79f2e477246a9 (patch) | |
tree | 2c1963c9a4f2d84a5e021307fde240c5d567cf70 /include/asm-blackfin/processor.h | |
parent | 73243284463a761e04d69d22c7516b2be7de096c (diff) |
blackfin architecture
This adds support for the Analog Devices Blackfin processor architecture, and
currently supports the BF533, BF532, BF531, BF537, BF536, BF534, and BF561
(Dual Core) devices, with a variety of development platforms including those
avaliable from Analog Devices (BF533-EZKit, BF533-STAMP, BF537-STAMP,
BF561-EZKIT), and Bluetechnix! Tinyboards.
The Blackfin architecture was jointly developed by Intel and Analog Devices
Inc. (ADI) as the Micro Signal Architecture (MSA) core and introduced it in
December of 2000. Since then ADI has put this core into its Blackfin
processor family of devices. The Blackfin core has the advantages of a clean,
orthogonal,RISC-like microprocessor instruction set. It combines a dual-MAC
(Multiply/Accumulate), state-of-the-art signal processing engine and
single-instruction, multiple-data (SIMD) multimedia capabilities into a single
instruction-set architecture.
The Blackfin architecture, including the instruction set, is described by the
ADSP-BF53x/BF56x Blackfin Processor Programming Reference
http://blackfin.uclinux.org/gf/download/frsrelease/29/2549/Blackfin_PRM.pdf
The Blackfin processor is already supported by major releases of gcc, and
there are binary and source rpms/tarballs for many architectures at:
http://blackfin.uclinux.org/gf/project/toolchain/frs There is complete
documentation, including "getting started" guides available at:
http://docs.blackfin.uclinux.org/ which provides links to the sources and
patches you will need in order to set up a cross-compiling environment for
bfin-linux-uclibc
This patch, as well as the other patches (toolchain, distribution,
uClibc) are actively supported by Analog Devices Inc, at:
http://blackfin.uclinux.org/
We have tested this on LTP, and our test plan (including pass/fails) can
be found at:
http://docs.blackfin.uclinux.org/doku.php?id=testing_the_linux_kernel
[m.kozlowski@tuxland.pl: balance parenthesis in blackfin header files]
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Aubrey Li <aubrey.li@analog.com>
Signed-off-by: Jie Zhang <jie.zhang@analog.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-blackfin/processor.h')
-rw-r--r-- | include/asm-blackfin/processor.h | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/include/asm-blackfin/processor.h b/include/asm-blackfin/processor.h new file mode 100644 index 000000000000..997465c93e82 --- /dev/null +++ b/include/asm-blackfin/processor.h | |||
@@ -0,0 +1,130 @@ | |||
1 | #ifndef __ASM_BFIN_PROCESSOR_H | ||
2 | #define __ASM_BFIN_PROCESSOR_H | ||
3 | |||
4 | /* | ||
5 | * Default implementation of macro that returns current | ||
6 | * instruction pointer ("program counter"). | ||
7 | */ | ||
8 | #define current_text_addr() ({ __label__ _l; _l: &&_l;}) | ||
9 | |||
10 | #include <asm/blackfin.h> | ||
11 | #include <asm/segment.h> | ||
12 | #include <linux/compiler.h> | ||
13 | |||
14 | static inline unsigned long rdusp(void) | ||
15 | { | ||
16 | unsigned long usp; | ||
17 | |||
18 | __asm__ __volatile__("%0 = usp;\n\t":"=da"(usp)); | ||
19 | return usp; | ||
20 | } | ||
21 | |||
22 | static inline void wrusp(unsigned long usp) | ||
23 | { | ||
24 | __asm__ __volatile__("usp = %0;\n\t"::"da"(usp)); | ||
25 | } | ||
26 | |||
27 | /* | ||
28 | * User space process size: 1st byte beyond user address space. | ||
29 | */ | ||
30 | extern unsigned long memory_end; | ||
31 | #define TASK_SIZE (memory_end) | ||
32 | |||
33 | #define TASK_UNMAPPED_BASE 0 | ||
34 | |||
35 | struct thread_struct { | ||
36 | unsigned long ksp; /* kernel stack pointer */ | ||
37 | unsigned long usp; /* user stack pointer */ | ||
38 | unsigned short seqstat; /* saved status register */ | ||
39 | unsigned long esp0; /* points to SR of stack frame pt_regs */ | ||
40 | unsigned long pc; /* instruction pointer */ | ||
41 | void * debuggerinfo; | ||
42 | }; | ||
43 | |||
44 | #define INIT_THREAD { \ | ||
45 | sizeof(init_stack) + (unsigned long) init_stack, 0, \ | ||
46 | PS_S, 0, 0 \ | ||
47 | } | ||
48 | |||
49 | /* | ||
50 | * Do necessary setup to start up a newly executed thread. | ||
51 | * | ||
52 | * pass the data segment into user programs if it exists, | ||
53 | * it can't hurt anything as far as I can tell | ||
54 | */ | ||
55 | #define start_thread(_regs, _pc, _usp) \ | ||
56 | do { \ | ||
57 | set_fs(USER_DS); \ | ||
58 | (_regs)->pc = (_pc); \ | ||
59 | if (current->mm) \ | ||
60 | (_regs)->p5 = current->mm->start_data; \ | ||
61 | current->thread_info->l1_task_info.stack_start \ | ||
62 | = (void *)current->mm->context.stack_start; \ | ||
63 | current->thread_info->l1_task_info.lowest_sp = (void *)(_usp); \ | ||
64 | memcpy(L1_SCRATCH_TASK_INFO, ¤t->thread_info->l1_task_info, \ | ||
65 | sizeof(*L1_SCRATCH_TASK_INFO)); \ | ||
66 | wrusp(_usp); \ | ||
67 | } while(0) | ||
68 | |||
69 | /* Forward declaration, a strange C thing */ | ||
70 | struct task_struct; | ||
71 | |||
72 | /* Free all resources held by a thread. */ | ||
73 | static inline void release_thread(struct task_struct *dead_task) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | #define prepare_to_copy(tsk) do { } while (0) | ||
78 | |||
79 | extern int kernel_thread(int (*fn) (void *), void *arg, unsigned long flags); | ||
80 | |||
81 | /* | ||
82 | * Free current thread data structures etc.. | ||
83 | */ | ||
84 | static inline void exit_thread(void) | ||
85 | { | ||
86 | } | ||
87 | |||
88 | /* | ||
89 | * Return saved PC of a blocked thread. | ||
90 | */ | ||
91 | #define thread_saved_pc(tsk) (tsk->thread.pc) | ||
92 | |||
93 | unsigned long get_wchan(struct task_struct *p); | ||
94 | |||
95 | #define KSTK_EIP(tsk) \ | ||
96 | ({ \ | ||
97 | unsigned long eip = 0; \ | ||
98 | if ((tsk)->thread.esp0 > PAGE_SIZE && \ | ||
99 | MAP_NR((tsk)->thread.esp0) < max_mapnr) \ | ||
100 | eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \ | ||
101 | eip; }) | ||
102 | #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) | ||
103 | |||
104 | #define cpu_relax() barrier() | ||
105 | |||
106 | /* Get the Silicon Revision of the chip */ | ||
107 | static inline uint32_t bfin_revid(void) | ||
108 | { | ||
109 | /* stored in the upper 4 bits */ | ||
110 | return bfin_read_CHIPID() >> 28; | ||
111 | } | ||
112 | |||
113 | static inline uint32_t bfin_compiled_revid(void) | ||
114 | { | ||
115 | #if defined(CONFIG_BF_REV_0_0) | ||
116 | return 0; | ||
117 | #elif defined(CONFIG_BF_REV_0_1) | ||
118 | return 1; | ||
119 | #elif defined(CONFIG_BF_REV_0_2) | ||
120 | return 2; | ||
121 | #elif defined(CONFIG_BF_REV_0_3) | ||
122 | return 3; | ||
123 | #elif defined(CONFIG_BF_REV_0_4) | ||
124 | return 4; | ||
125 | #elif defined(CONFIG_BF_REV_0_5) | ||
126 | return 5; | ||
127 | #endif | ||
128 | } | ||
129 | |||
130 | #endif | ||