]> err.no Git - linux-2.6/blob - arch/blackfin/mach-common/dpmc.S
[Blackfin] arch: Remove DPMC char driver option
[linux-2.6] / arch / blackfin / mach-common / dpmc.S
1 /*
2  * File:         arch/blackfin/mach-common/dpmc.S
3  * Based on:
4  * Author:       LG Soft India
5  *
6  * Created:      ?
7  * Description:  Watchdog Timer APIs
8  *
9  * Modified:
10  *               Copyright 2004-2006 Analog Devices Inc.
11  *
12  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, see the file COPYING, or write
26  * to the Free Software Foundation, Inc.,
27  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
28  */
29
30 #include <linux/linkage.h>
31 #include <asm/blackfin.h>
32 #include <asm/mach/irq.h>
33
34 .text
35
36 #if !defined(CONFIG_BF561)
37
38 .section .l1.text
39
40 ENTRY(_sleep_mode)
41         [--SP] = ( R7:0, P5:0 );
42         [--SP] =  RETS;
43
44         call _set_sic_iwr;
45
46         R0 = 0xFFFF (Z);
47         call _set_rtc_istat;
48
49         P0.H = hi(PLL_CTL);
50         P0.L = lo(PLL_CTL);
51         R1 = W[P0](z);
52         BITSET (R1, 3);
53         W[P0] = R1.L;
54
55         CLI R2;
56         SSYNC;
57         IDLE;
58         STI R2;
59
60         call _test_pll_locked;
61
62         R0 = IWR_ENABLE(0);
63         R1 = IWR_DISABLE_ALL;
64         R2 = IWR_DISABLE_ALL;
65
66         call _set_sic_iwr;
67
68         P0.H = hi(PLL_CTL);
69         P0.L = lo(PLL_CTL);
70         R7 = w[p0](z);
71         BITCLR (R7, 3);
72         BITCLR (R7, 5);
73         w[p0] = R7.L;
74         IDLE;
75         call _test_pll_locked;
76
77         RETS = [SP++];
78         ( R7:0, P5:0 ) = [SP++];
79         RTS;
80
81 ENTRY(_hibernate_mode)
82         [--SP] = ( R7:0, P5:0 );
83         [--SP] =  RETS;
84
85         call _set_sic_iwr;
86
87         R0 = 0xFFFF (Z);
88         call _set_rtc_istat;
89
90         P0.H = hi(VR_CTL);
91         P0.L = lo(VR_CTL);
92         R1 = W[P0](z);
93         BITSET (R1, 8);
94         BITCLR (R1, 0);
95         BITCLR (R1, 1);
96         W[P0] = R1.L;
97         SSYNC;
98
99         CLI R2;
100         IDLE;
101
102         /* Actually, adding anything may not be necessary...SDRAM contents
103          * are lost
104          */
105
106 ENTRY(_deep_sleep)
107         [--SP] = ( R7:0, P5:0 );
108         [--SP] =  RETS;
109
110         CLI R4;
111
112         R0 = IWR_ENABLE(0);
113         R1 = IWR_DISABLE_ALL;
114         R2 = IWR_DISABLE_ALL;
115
116         call _set_sic_iwr;
117
118         call _set_dram_srfs;
119
120         /* Clear all the interrupts,bits sticky */
121         R0 = 0xFFFF (Z);
122         call _set_rtc_istat
123
124         P0.H = hi(PLL_CTL);
125         P0.L = lo(PLL_CTL);
126         R0 = W[P0](z);
127         BITSET (R0, 5);
128         W[P0] = R0.L;
129
130         call _test_pll_locked;
131
132         SSYNC;
133         IDLE;
134
135         call _unset_dram_srfs;
136
137         call _test_pll_locked;
138
139         R0 = IWR_ENABLE(0);
140         R1 = IWR_DISABLE_ALL;
141         R2 = IWR_DISABLE_ALL;
142
143         call _set_sic_iwr;
144
145         P0.H = hi(PLL_CTL);
146         P0.L = lo(PLL_CTL);
147         R0 = w[p0](z);
148         BITCLR (R0, 3);
149         BITCLR (R0, 5);
150         BITCLR (R0, 8);
151         w[p0] = R0;
152         IDLE;
153         call _test_pll_locked;
154
155         STI R4;
156
157         RETS = [SP++];
158         ( R7:0, P5:0 ) = [SP++];
159         RTS;
160
161 ENTRY(_sleep_deeper)
162         [--SP] = ( R7:0, P5:0 );
163         [--SP] =  RETS;
164
165         CLI R4;
166
167         P3 = R0;
168         P4 = R1;
169         P5 = R2;
170
171         R0 = IWR_ENABLE(0);
172         R1 = IWR_DISABLE_ALL;
173         R2 = IWR_DISABLE_ALL;
174
175         call _set_sic_iwr;
176         call _set_dram_srfs;    /* Set SDRAM Self Refresh */
177
178         /* Clear all the interrupts,bits sticky */
179         R0 = 0xFFFF (Z);
180         call _set_rtc_istat;
181         P0.H = hi(PLL_DIV);
182         P0.L = lo(PLL_DIV);
183         R6 = W[P0](z);
184         R0.L = 0xF;
185         W[P0] = R0.l;           /* Set Max VCO to SCLK divider */
186
187         P0.H = hi(PLL_CTL);
188         P0.L = lo(PLL_CTL);
189         R5 = W[P0](z);
190         R0.L = (CONFIG_MIN_VCO_HZ/CONFIG_CLKIN_HZ) << 9;
191         W[P0] = R0.l;           /* Set Min CLKIN to VCO multiplier */
192
193         SSYNC;
194         IDLE;
195
196         call _test_pll_locked;
197
198         P0.H = hi(VR_CTL);
199         P0.L = lo(VR_CTL);
200         R7 = W[P0](z);
201         R1 = 0x6;
202         R1 <<= 16;
203         R2 = 0x0404(Z);
204         R1 = R1|R2;
205
206         R2 = DEPOSIT(R7, R1);
207         W[P0] = R2;             /* Set Min Core Voltage */
208
209         SSYNC;
210         IDLE;
211
212         call _test_pll_locked;
213
214         R0 = P3;
215         R1 = P4;
216         R3 = P5;
217         call _set_sic_iwr;      /* Set Awake from IDLE */
218
219         P0.H = hi(PLL_CTL);
220         P0.L = lo(PLL_CTL);
221         R0 = W[P0](z);
222         BITSET (R0, 3);
223         W[P0] = R0.L;           /* Turn CCLK OFF */
224         SSYNC;
225         IDLE;
226
227         call _test_pll_locked;
228
229         R0 = IWR_ENABLE(0);
230         R1 = IWR_DISABLE_ALL;
231         R2 = IWR_DISABLE_ALL;
232
233         call _set_sic_iwr;      /* Set Awake from IDLE PLL */
234
235         P0.H = hi(VR_CTL);
236         P0.L = lo(VR_CTL);
237         W[P0]= R7;
238
239         SSYNC;
240         IDLE;
241
242         call _test_pll_locked;
243
244         P0.H = hi(PLL_DIV);
245         P0.L = lo(PLL_DIV);
246         W[P0]= R6;              /* Restore CCLK and SCLK divider */
247
248         P0.H = hi(PLL_CTL);
249         P0.L = lo(PLL_CTL);
250         w[p0] = R5;             /* Restore VCO multiplier */
251         IDLE;
252         call _test_pll_locked;
253
254         call _unset_dram_srfs;  /* SDRAM Self Refresh Off */
255
256         STI R4;
257
258         RETS = [SP++];
259         ( R7:0, P5:0 ) = [SP++];
260         RTS;
261
262 ENTRY(_set_dram_srfs)
263         /*  set the dram to self refresh mode */
264 #if defined(CONFIG_BF54x)
265         P0.H = hi(EBIU_RSTCTL);
266         P0.L = lo(EBIU_RSTCTL);
267         R2 = [P0];
268         R3.H = hi(SRREQ);
269         R3.L = lo(SRREQ);
270 #else
271         P0.H = hi(EBIU_SDGCTL);
272         P0.L = lo(EBIU_SDGCTL);
273         R2 = [P0];
274         R3.H = hi(SRFS);
275         R3.L = lo(SRFS);
276 #endif
277         R2 = R2|R3;
278         [P0] = R2;
279         ssync;
280 #if defined(CONFIG_BF54x)
281 .LSRR_MODE:
282         R2 = [P0];
283         CC = BITTST(R2, 4);
284         if !CC JUMP .LSRR_MODE;
285 #endif
286         RTS;
287
288 ENTRY(_unset_dram_srfs)
289         /*  set the dram out of self refresh mode */
290 #if defined(CONFIG_BF54x)
291         P0.H = hi(EBIU_RSTCTL);
292         P0.L = lo(EBIU_RSTCTL);
293         R2 = [P0];
294         R3.H = hi(SRREQ);
295         R3.L = lo(SRREQ);
296 #else
297         P0.H = hi(EBIU_SDGCTL);
298         P0.L = lo(EBIU_SDGCTL);
299         R2 = [P0];
300         R3.H = hi(SRFS);
301         R3.L = lo(SRFS);
302 #endif
303         R3 = ~R3;
304         R2 = R2&R3;
305         [P0] = R2;
306         ssync;
307         RTS;
308
309 ENTRY(_set_sic_iwr)
310 #if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)  || defined(CONFIG_BF561)
311         P0.H = hi(SIC_IWR0);
312         P0.L = lo(SIC_IWR0);
313         P1.H = hi(SIC_IWR1);
314         P1.L = lo(SIC_IWR1);
315         [P1] = R1;
316 #if defined(CONFIG_BF54x)
317         P1.H = hi(SIC_IWR2);
318         P1.L = lo(SIC_IWR2);
319         [P1] = R2;
320 #endif
321 #else
322         P0.H = hi(SIC_IWR);
323         P0.L = lo(SIC_IWR);
324 #endif
325         [P0] = R0;
326
327         SSYNC;
328         RTS;
329
330 ENTRY(_set_rtc_istat)
331         P0.H = hi(RTC_ISTAT);
332         P0.L = lo(RTC_ISTAT);
333         w[P0] = R0.L;
334         SSYNC;
335         RTS;
336
337 ENTRY(_test_pll_locked)
338         P0.H = hi(PLL_STAT);
339         P0.L = lo(PLL_STAT);
340 1:
341         R0 = W[P0] (Z);
342         CC = BITTST(R0,5);
343         IF !CC JUMP 1b;
344         RTS;
345 #endif