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)
41 #elif defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
49 #if defined(CONFIG_BF561)
52 BITSET(R7,(IRQ_WATCH - IVG7));
57 ( R7:0, P5:0 ) = [SP++];
61 /* When watch dog timer is enabled, a write to STAT will load the
62 * contents of CNT to STAT
65 #if defined(CONFIG_BF561)
66 P0.h = HI(WDOGA_STAT);
67 P0.l = LO(WDOGA_STAT);
74 JUMP .LSKIP_WRITE_TO_STAT;
76 ENTRY(_program_wdog_timer)
77 [--SP] = ( R7:0, P5:0 );
78 #if defined(CONFIG_BF561)
88 #if defined(CONFIG_BF561)
97 if !CC JUMP .LWRITE_TO_STAT;
99 if !CC JUMP .LWRITE_TO_STAT;
101 .LSKIP_WRITE_TO_STAT:
102 #if defined(CONFIG_BF561)
103 P0.h = HI(WDOGA_CTL);
104 P0.l = LO(WDOGA_CTL);
110 BITCLR(R7,1); /* Enable GP event */
117 BITCLR(R7,4); /* Enable the wdog counter */
121 ( R7:0, P5:0 ) = [SP++];
124 ENTRY(_clear_wdog_wakeup_evt)
125 [--SP] = ( R7:0, P5:0 );
127 #if defined(CONFIG_BF561)
128 P0.h = HI(WDOGA_CTL);
129 P0.l = LO(WDOGA_CTL);
149 ( R7:0, P5:0 ) = [SP++];
152 ENTRY(_disable_wdog_timer)
153 [--SP] = ( R7:0, P5:0 );
154 #if defined(CONFIG_BF561)
155 P0.h = HI(WDOGA_CTL);
156 P0.l = LO(WDOGA_CTL);
164 ( R7:0, P5:0 ) = [SP++];
167 #if !defined(CONFIG_BF561)
172 [--SP] = ( R7:0, P5:0 );
191 call _test_pll_locked;
203 call _test_pll_locked;
206 ( R7:0, P5:0 ) = [SP++];
209 ENTRY(_hibernate_mode)
210 [--SP] = ( R7:0, P5:0 );
230 /* Actually, adding anything may not be necessary...SDRAM contents
235 [--SP] = ( R7:0, P5:0 );
244 /* Clear all the interrupts,bits sticky */
254 call _test_pll_locked;
259 call _unset_dram_srfs;
261 call _test_pll_locked;
274 call _test_pll_locked;
279 ( R7:0, P5:0 ) = [SP++];
283 [--SP] = ( R7:0, P5:0 );
291 call _set_dram_srfs; /* Set SDRAM Self Refresh */
293 /* Clear all the interrupts,bits sticky */
300 W[P0] = R0.l; /* Set Max VCO to SCLK divider */
305 R0.L = (CONFIG_MIN_VCO_HZ/CONFIG_CLKIN_HZ) << 9;
306 W[P0] = R0.l; /* Set Min CLKIN to VCO multiplier */
311 call _test_pll_locked;
321 R2 = DEPOSIT(R7, R1);
322 W[P0] = R2; /* Set Min Core Voltage */
327 call _test_pll_locked;
330 call _set_sic_iwr; /* Set Awake from IDLE */
336 W[P0] = R0.L; /* Turn CCLK OFF */
340 call _test_pll_locked;
343 call _set_sic_iwr; /* Set Awake from IDLE PLL */
352 call _test_pll_locked;
356 W[P0]= R6; /* Restore CCLK and SCLK divider */
360 w[p0] = R5; /* Restore VCO multiplier */
362 call _test_pll_locked;
364 call _unset_dram_srfs; /* SDRAM Self Refresh Off */
369 ( R7:0, P5:0 ) = [SP++];
372 ENTRY(_set_dram_srfs)
373 /* set the dram to self refresh mode */
374 #if defined(CONFIG_BF54x)
375 P0.H = hi(EBIU_RSTCTL);
376 P0.L = lo(EBIU_RSTCTL);
381 P0.H = hi(EBIU_SDGCTL);
382 P0.L = lo(EBIU_SDGCTL);
390 #if defined(CONFIG_BF54x)
394 if !CC JUMP .LSRR_MODE;
398 ENTRY(_unset_dram_srfs)
399 /* set the dram out of self refresh mode */
400 #if defined(CONFIG_BF54x)
401 P0.H = hi(EBIU_RSTCTL);
402 P0.L = lo(EBIU_RSTCTL);
407 P0.H = hi(EBIU_SDGCTL);
408 P0.L = lo(EBIU_SDGCTL);
420 #if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
431 ENTRY(_set_rtc_istat)
432 P0.H = hi(RTC_ISTAT);
433 P0.L = lo(RTC_ISTAT);
438 ENTRY(_test_pll_locked)