2 * File: arch/blackfin/mach-common/dpmc.S
4 * Author: LG Soft India
7 * Description: Watchdog Timer APIs
10 * Copyright 2004-2006 Analog Devices Inc.
12 * Bugs: Enter bugs at http://blackfin.uclinux.org/
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.
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.
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
30 #include <linux/linkage.h>
31 #include <asm/blackfin.h>
32 #include <asm/mach/irq.h>
36 ENTRY(_unmask_wdog_wakeup_evt)
37 [--SP] = ( R7:0, P5:0 );
38 #if defined(CONFIG_BF561)
42 P0.h = (SIC_IWR >> 16);
43 P0.l = (SIC_IWR & 0xFFFF);
46 #if defined(CONFIG_BF561)
49 BITSET(R7,(IRQ_WATCH - IVG7));
54 ( R7:0, P5:0 ) = [SP++];
58 /* When watch dog timer is enabled, a write to STAT will load the
59 * contents of CNT to STAT
62 #if defined(CONFIG_BF561)
63 P0.h = (WDOGA_STAT >> 16);
64 P0.l = (WDOGA_STAT & 0xFFFF);
66 P0.h = (WDOG_STAT >> 16);
67 P0.l = (WDOG_STAT & 0xFFFF);
71 JUMP .LSKIP_WRITE_TO_STAT;
73 ENTRY(_program_wdog_timer)
74 [--SP] = ( R7:0, P5:0 );
75 #if defined(CONFIG_BF561)
76 P0.h = (WDOGA_CNT >> 16);
77 P0.l = (WDOGA_CNT & 0xFFFF);
79 P0.h = (WDOG_CNT >> 16);
80 P0.l = (WDOG_CNT & 0xFFFF);
85 #if defined(CONFIG_BF561)
86 P0.h = (WDOGA_CTL >> 16);
87 P0.l = (WDOGA_CTL & 0xFFFF);
89 P0.h = (WDOG_CTL >> 16);
90 P0.l = (WDOG_CTL & 0xFFFF);
94 if !CC JUMP .LWRITE_TO_STAT;
96 if !CC JUMP .LWRITE_TO_STAT;
99 #if defined(CONFIG_BF561)
100 P0.h = (WDOGA_CTL >> 16);
101 P0.l = (WDOGA_CTL & 0xFFFF);
103 P0.h = (WDOG_CTL >> 16);
104 P0.l = (WDOG_CTL & 0xFFFF);
107 BITCLR(R7,1); /* Enable GP event */
114 BITCLR(R7,4); /* Enable the wdog counter */
118 ( R7:0, P5:0 ) = [SP++];
121 ENTRY(_clear_wdog_wakeup_evt)
122 [--SP] = ( R7:0, P5:0 );
124 #if defined(CONFIG_BF561)
125 P0.h = (WDOGA_CTL >> 16);
126 P0.l = (WDOGA_CTL & 0xFFFF);
128 P0.h = (WDOG_CTL >> 16);
129 P0.l = (WDOG_CTL & 0xFFFF);
146 ( R7:0, P5:0 ) = [SP++];
149 ENTRY(_disable_wdog_timer)
150 [--SP] = ( R7:0, P5:0 );
151 #if defined(CONFIG_BF561)
152 P0.h = (WDOGA_CTL >> 16);
153 P0.l = (WDOGA_CTL & 0xFFFF);
155 P0.h = (WDOG_CTL >> 16);
156 P0.l = (WDOG_CTL & 0xFFFF);
161 ( R7:0, P5:0 ) = [SP++];
164 #if !defined(CONFIG_BF561)
169 [--SP] = ( R7:0, P5:0 );
188 call _test_pll_locked;
200 call _test_pll_locked;
203 ( R7:0, P5:0 ) = [SP++];
206 ENTRY(_hibernate_mode)
207 [--SP] = ( R7:0, P5:0 );
227 /* Actually, adding anything may not be necessary...SDRAM contents
232 [--SP] = ( R7:0, P5:0 );
239 call _set_sdram_srfs;
241 /* Clear all the interrupts,bits sticky */
251 call _test_pll_locked;
256 call _unset_sdram_srfs;
258 call _test_pll_locked;
271 call _test_pll_locked;
276 ( R7:0, P5:0 ) = [SP++];
280 [--SP] = ( R7:0, P5:0 );
288 call _set_sdram_srfs;
290 /* Clear all the interrupts,bits sticky */
303 R0.L = (MIN_VC/CONFIG_CLKIN_HZ) << 9;
309 call _test_pll_locked;
319 R2 = DEPOSIT(R7, R1);
325 call _test_pll_locked;
339 call _test_pll_locked;
351 call _test_pll_locked;
361 call _test_pll_locked;
363 call _unset_sdram_srfs;
368 ( R7:0, P5:0 ) = [SP++];
371 ENTRY(_set_sdram_srfs)
372 /* set the sdram to self refresh mode */
373 P0.H = hi(EBIU_SDGCTL);
374 P0.L = lo(EBIU_SDGCTL);
383 ENTRY(_unset_sdram_srfs)
384 /* set the sdram out of self refresh mode */
385 P0.H = hi(EBIU_SDGCTL);
386 P0.L = lo(EBIU_SDGCTL);
403 ENTRY(_set_rtc_istat)
404 P0.H = hi(RTC_ISTAT);
405 P0.L = lo(RTC_ISTAT);
410 ENTRY(_test_pll_locked)