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/bf5xx_timers.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/bf5xx_timers.h')
-rw-r--r-- | include/asm-blackfin/bf5xx_timers.h | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/include/asm-blackfin/bf5xx_timers.h b/include/asm-blackfin/bf5xx_timers.h new file mode 100644 index 000000000000..86c770321b61 --- /dev/null +++ b/include/asm-blackfin/bf5xx_timers.h | |||
@@ -0,0 +1,209 @@ | |||
1 | /* | ||
2 | * include/asm/bf5xx_timers.h | ||
3 | * | ||
4 | * This file contains the major Data structures and constants | ||
5 | * used for General Purpose Timer Implementation in BF5xx | ||
6 | * | ||
7 | * Copyright (C) 2005 John DeHority | ||
8 | * Copyright (C) 2006 Hella Aglaia GmbH (awe@aglaia-gmbh.de) | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | #ifndef _BLACKFIN_TIMERS_H_ | ||
13 | #define _BLACKFIN_TIMERS_H_ | ||
14 | |||
15 | #undef MAX_BLACKFIN_GPTIMERS | ||
16 | /* | ||
17 | * BF537: 8 timers: | ||
18 | */ | ||
19 | #if defined(CONFIG_BF537) | ||
20 | # define MAX_BLACKFIN_GPTIMERS 8 | ||
21 | # define TIMER0_GROUP_REG TIMER_ENABLE | ||
22 | #endif | ||
23 | /* | ||
24 | * BF561: 12 timers: | ||
25 | */ | ||
26 | #if defined(CONFIG_BF561) | ||
27 | # define MAX_BLACKFIN_GPTIMERS 12 | ||
28 | # define TIMER0_GROUP_REG TMRS8_ENABLE | ||
29 | # define TIMER8_GROUP_REG TMRS4_ENABLE | ||
30 | #endif | ||
31 | /* | ||
32 | * All others: 3 timers: | ||
33 | */ | ||
34 | #if !defined(MAX_BLACKFIN_GPTIMERS) | ||
35 | # define MAX_BLACKFIN_GPTIMERS 3 | ||
36 | # define TIMER0_GROUP_REG TIMER_ENABLE | ||
37 | #endif | ||
38 | |||
39 | #define BLACKFIN_GPTIMER_IDMASK ((1UL << MAX_BLACKFIN_GPTIMERS) - 1) | ||
40 | #define BFIN_TIMER_OCTET(x) ((x) >> 3) | ||
41 | |||
42 | /* used in masks for timer_enable() and timer_disable() */ | ||
43 | #define TIMER0bit 0x0001 /* 0001b */ | ||
44 | #define TIMER1bit 0x0002 /* 0010b */ | ||
45 | #define TIMER2bit 0x0004 /* 0100b */ | ||
46 | |||
47 | #if (MAX_BLACKFIN_GPTIMERS > 3) | ||
48 | # define TIMER3bit 0x0008 | ||
49 | # define TIMER4bit 0x0010 | ||
50 | # define TIMER5bit 0x0020 | ||
51 | # define TIMER6bit 0x0040 | ||
52 | # define TIMER7bit 0x0080 | ||
53 | #endif | ||
54 | |||
55 | #if (MAX_BLACKFIN_GPTIMERS > 8) | ||
56 | # define TIMER8bit 0x0100 | ||
57 | # define TIMER9bit 0x0200 | ||
58 | # define TIMER10bit 0x0400 | ||
59 | # define TIMER11bit 0x0800 | ||
60 | #endif | ||
61 | |||
62 | #define TIMER0_id 0 | ||
63 | #define TIMER1_id 1 | ||
64 | #define TIMER2_id 2 | ||
65 | |||
66 | #if (MAX_BLACKFIN_GPTIMERS > 3) | ||
67 | # define TIMER3_id 3 | ||
68 | # define TIMER4_id 4 | ||
69 | # define TIMER5_id 5 | ||
70 | # define TIMER6_id 6 | ||
71 | # define TIMER7_id 7 | ||
72 | #endif | ||
73 | |||
74 | #if (MAX_BLACKFIN_GPTIMERS > 8) | ||
75 | # define TIMER8_id 8 | ||
76 | # define TIMER9_id 9 | ||
77 | # define TIMER10_id 10 | ||
78 | # define TIMER11_id 11 | ||
79 | #endif | ||
80 | |||
81 | /* associated timers for ppi framesync: */ | ||
82 | |||
83 | #if defined(CONFIG_BF561) | ||
84 | # define FS0_1_TIMER_ID TIMER8_id | ||
85 | # define FS0_2_TIMER_ID TIMER9_id | ||
86 | # define FS1_1_TIMER_ID TIMER10_id | ||
87 | # define FS1_2_TIMER_ID TIMER11_id | ||
88 | # define FS0_1_TIMER_BIT TIMER8bit | ||
89 | # define FS0_2_TIMER_BIT TIMER9bit | ||
90 | # define FS1_1_TIMER_BIT TIMER10bit | ||
91 | # define FS1_2_TIMER_BIT TIMER11bit | ||
92 | # undef FS1_TIMER_ID | ||
93 | # undef FS2_TIMER_ID | ||
94 | # undef FS1_TIMER_BIT | ||
95 | # undef FS2_TIMER_BIT | ||
96 | #else | ||
97 | # define FS1_TIMER_ID TIMER0_id | ||
98 | # define FS2_TIMER_ID TIMER1_id | ||
99 | # define FS1_TIMER_BIT TIMER0bit | ||
100 | # define FS2_TIMER_BIT TIMER1bit | ||
101 | #endif | ||
102 | |||
103 | /* | ||
104 | ** Timer Configuration Register Bits | ||
105 | */ | ||
106 | #define TIMER_ERR 0xC000 | ||
107 | #define TIMER_ERR_OVFL 0x4000 | ||
108 | #define TIMER_ERR_PROG_PER 0x8000 | ||
109 | #define TIMER_ERR_PROG_PW 0xC000 | ||
110 | #define TIMER_EMU_RUN 0x0200 | ||
111 | #define TIMER_TOGGLE_HI 0x0100 | ||
112 | #define TIMER_CLK_SEL 0x0080 | ||
113 | #define TIMER_OUT_DIS 0x0040 | ||
114 | #define TIMER_TIN_SEL 0x0020 | ||
115 | #define TIMER_IRQ_ENA 0x0010 | ||
116 | #define TIMER_PERIOD_CNT 0x0008 | ||
117 | #define TIMER_PULSE_HI 0x0004 | ||
118 | #define TIMER_MODE 0x0003 | ||
119 | #define TIMER_MODE_PWM 0x0001 | ||
120 | #define TIMER_MODE_WDTH 0x0002 | ||
121 | #define TIMER_MODE_EXT_CLK 0x0003 | ||
122 | |||
123 | /* | ||
124 | ** Timer Status Register Bits | ||
125 | */ | ||
126 | #define TIMER_STATUS_TIMIL0 0x0001 | ||
127 | #define TIMER_STATUS_TIMIL1 0x0002 | ||
128 | #define TIMER_STATUS_TIMIL2 0x0004 | ||
129 | #if (MAX_BLACKFIN_GPTIMERS > 3) | ||
130 | # define TIMER_STATUS_TIMIL3 0x00000008 | ||
131 | # define TIMER_STATUS_TIMIL4 0x00010000 | ||
132 | # define TIMER_STATUS_TIMIL5 0x00020000 | ||
133 | # define TIMER_STATUS_TIMIL6 0x00040000 | ||
134 | # define TIMER_STATUS_TIMIL7 0x00080000 | ||
135 | # if (MAX_BLACKFIN_GPTIMERS > 8) | ||
136 | # define TIMER_STATUS_TIMIL8 0x0001 | ||
137 | # define TIMER_STATUS_TIMIL9 0x0002 | ||
138 | # define TIMER_STATUS_TIMIL10 0x0004 | ||
139 | # define TIMER_STATUS_TIMIL11 0x0008 | ||
140 | # endif | ||
141 | # define TIMER_STATUS_INTR 0x000F000F | ||
142 | #else | ||
143 | # define TIMER_STATUS_INTR 0x0007 /* any timer interrupt */ | ||
144 | #endif | ||
145 | |||
146 | #define TIMER_STATUS_TOVF0 0x0010 /* timer 0 overflow error */ | ||
147 | #define TIMER_STATUS_TOVF1 0x0020 | ||
148 | #define TIMER_STATUS_TOVF2 0x0040 | ||
149 | #if (MAX_BLACKFIN_GPTIMERS > 3) | ||
150 | # define TIMER_STATUS_TOVF3 0x00000080 | ||
151 | # define TIMER_STATUS_TOVF4 0x00100000 | ||
152 | # define TIMER_STATUS_TOVF5 0x00200000 | ||
153 | # define TIMER_STATUS_TOVF6 0x00400000 | ||
154 | # define TIMER_STATUS_TOVF7 0x00800000 | ||
155 | # if (MAX_BLACKFIN_GPTIMERS > 8) | ||
156 | # define TIMER_STATUS_TOVF8 0x0010 | ||
157 | # define TIMER_STATUS_TOVF9 0x0020 | ||
158 | # define TIMER_STATUS_TOVF10 0x0040 | ||
159 | # define TIMER_STATUS_TOVF11 0x0080 | ||
160 | # endif | ||
161 | # define TIMER_STATUS_OFLOW 0x00F000F0 | ||
162 | #else | ||
163 | # define TIMER_STATUS_OFLOW 0x0070 /* any timer overflow */ | ||
164 | #endif | ||
165 | |||
166 | /* | ||
167 | ** Timer Slave Enable Status : write 1 to clear | ||
168 | */ | ||
169 | #define TIMER_STATUS_TRUN0 0x1000 | ||
170 | #define TIMER_STATUS_TRUN1 0x2000 | ||
171 | #define TIMER_STATUS_TRUN2 0x4000 | ||
172 | #if (MAX_BLACKFIN_GPTIMERS > 3) | ||
173 | # define TIMER_STATUS_TRUN3 0x00008000 | ||
174 | # define TIMER_STATUS_TRUN4 0x10000000 | ||
175 | # define TIMER_STATUS_TRUN5 0x20000000 | ||
176 | # define TIMER_STATUS_TRUN6 0x40000000 | ||
177 | # define TIMER_STATUS_TRUN7 0x80000000 | ||
178 | # define TIMER_STATUS_TRUN 0xF000F000 | ||
179 | # if (MAX_BLACKFIN_GPTIMERS > 8) | ||
180 | # define TIMER_STATUS_TRUN8 0x1000 | ||
181 | # define TIMER_STATUS_TRUN9 0x2000 | ||
182 | # define TIMER_STATUS_TRUN10 0x4000 | ||
183 | # define TIMER_STATUS_TRUN11 0x8000 | ||
184 | # endif | ||
185 | #else | ||
186 | # define TIMER_STATUS_TRUN 0x7000 | ||
187 | #endif | ||
188 | |||
189 | /******************************************************************************* | ||
190 | * GP_TIMER API's | ||
191 | *******************************************************************************/ | ||
192 | |||
193 | void set_gptimer_pwidth (int timer_id, int width); | ||
194 | int get_gptimer_pwidth (int timer_id); | ||
195 | void set_gptimer_period (int timer_id, int period); | ||
196 | int get_gptimer_period (int timer_id); | ||
197 | int get_gptimer_count (int timer_id); | ||
198 | short get_gptimer_intr (int timer_id); | ||
199 | void set_gptimer_config (int timer_id, short config); | ||
200 | short get_gptimer_config (int timer_id); | ||
201 | void set_gptimer_pulse_hi (int timer_id); | ||
202 | void clear_gptimer_pulse_hi(int timer_id); | ||
203 | void enable_gptimers (short mask); | ||
204 | void disable_gptimers (short mask); | ||
205 | short get_enabled_timers (void); | ||
206 | int get_gptimer_status (int octet); | ||
207 | void set_gptimer_status (int octet, int value); | ||
208 | |||
209 | #endif | ||