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>
34 <<<<<<< HEAD:arch/blackfin/mach-common/dpmc.S
37 ENTRY(_unmask_wdog_wakeup_evt)
38 [--SP] = ( R7:0, P5:0 );
39 #if defined(CONFIG_BF561)
42 #elif defined(CONFIG_BF54x) || defined(CONFIG_BF52x)
50 #if defined(CONFIG_BF561)
53 BITSET(R7,(IRQ_WATCH - IVG7));
58 ( R7:0, P5:0 ) = [SP++];
62 /* When watch dog timer is enabled, a write to STAT will load the
63 * contents of CNT to STAT
66 #if defined(CONFIG_BF561)
67 P0.h = HI(WDOGA_STAT);
68 P0.l = LO(WDOGA_STAT);
75 JUMP .LSKIP_WRITE_TO_STAT;
77 ENTRY(_program_wdog_timer)
78 [--SP] = ( R7:0, P5:0 );
79 #if defined(CONFIG_BF561)
89 #if defined(CONFIG_BF561)
98 if !CC JUMP .LWRITE_TO_STAT;
100 if !CC JUMP .LWRITE_TO_STAT;
102 .LSKIP_WRITE_TO_STAT:
103 #if defined(CONFIG_BF561)
104 P0.h = HI(WDOGA_CTL);
105 P0.l = LO(WDOGA_CTL);
111 BITCLR(R7,1); /* Enable GP event */
118 BITCLR(R7,4); /* Enable the wdog counter */
122 ( R7:0, P5:0 ) = [SP++];
125 ENTRY(_clear_wdog_wakeup_evt)
126 [--SP] = ( R7:0, P5:0 );
128 #if defined(CONFIG_BF561)
129 P0.h = HI(WDOGA_CTL);
130 P0.l = LO(WDOGA_CTL);
150 ( R7:0, P5:0 ) = [SP++];
153 ENTRY(_disable_wdog_timer)
154 [--SP] = ( R7:0, P5:0 );
155 #if defined(CONFIG_BF561)
156 P0.h = HI(WDOGA_CTL);
157 P0.l = LO(WDOGA_CTL);
165 ( R7:0, P5:0 ) = [SP++];
168 #if !defined(CONFIG_BF561)
170 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-common/dpmc.S
175 [--SP] = ( R7:0, P5:0 );
194 call _test_pll_locked;
197 R1 = IWR_DISABLE_ALL;
198 R2 = IWR_DISABLE_ALL;
209 call _test_pll_locked;
212 ( R7:0, P5:0 ) = [SP++];
215 ENTRY(_hibernate_mode)
216 [--SP] = ( R7:0, P5:0 );
236 /* Actually, adding anything may not be necessary...SDRAM contents
241 [--SP] = ( R7:0, P5:0 );
247 R1 = IWR_DISABLE_ALL;
248 R2 = IWR_DISABLE_ALL;
254 /* Clear all the interrupts,bits sticky */
264 call _test_pll_locked;
269 call _unset_dram_srfs;
271 call _test_pll_locked;
274 R1 = IWR_DISABLE_ALL;
275 R2 = IWR_DISABLE_ALL;
287 call _test_pll_locked;
292 ( R7:0, P5:0 ) = [SP++];
296 [--SP] = ( R7:0, P5:0 );
306 R1 = IWR_DISABLE_ALL;
307 R2 = IWR_DISABLE_ALL;
310 call _set_dram_srfs; /* Set SDRAM Self Refresh */
312 /* Clear all the interrupts,bits sticky */
319 W[P0] = R0.l; /* Set Max VCO to SCLK divider */
324 R0.L = (CONFIG_MIN_VCO_HZ/CONFIG_CLKIN_HZ) << 9;
325 W[P0] = R0.l; /* Set Min CLKIN to VCO multiplier */
330 call _test_pll_locked;
340 R2 = DEPOSIT(R7, R1);
341 W[P0] = R2; /* Set Min Core Voltage */
346 call _test_pll_locked;
351 call _set_sic_iwr; /* Set Awake from IDLE */
357 W[P0] = R0.L; /* Turn CCLK OFF */
361 call _test_pll_locked;
364 R1 = IWR_DISABLE_ALL;
365 R2 = IWR_DISABLE_ALL;
367 call _set_sic_iwr; /* Set Awake from IDLE PLL */
376 call _test_pll_locked;
380 W[P0]= R6; /* Restore CCLK and SCLK divider */
384 w[p0] = R5; /* Restore VCO multiplier */
386 call _test_pll_locked;
388 call _unset_dram_srfs; /* SDRAM Self Refresh Off */
393 ( R7:0, P5:0 ) = [SP++];
396 ENTRY(_set_dram_srfs)
397 /* set the dram to self refresh mode */
398 #if defined(CONFIG_BF54x)
399 P0.H = hi(EBIU_RSTCTL);
400 P0.L = lo(EBIU_RSTCTL);
405 P0.H = hi(EBIU_SDGCTL);
406 P0.L = lo(EBIU_SDGCTL);
414 #if defined(CONFIG_BF54x)
418 if !CC JUMP .LSRR_MODE;
422 ENTRY(_unset_dram_srfs)
423 /* set the dram out of self refresh mode */
424 #if defined(CONFIG_BF54x)
425 P0.H = hi(EBIU_RSTCTL);
426 P0.L = lo(EBIU_RSTCTL);
431 P0.H = hi(EBIU_SDGCTL);
432 P0.L = lo(EBIU_SDGCTL);
444 #if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
450 #if defined(CONFIG_BF54x)
464 ENTRY(_set_rtc_istat)
465 <<<<<<< HEAD:arch/blackfin/mach-common/dpmc.S
468 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-common/dpmc.S
469 P0.H = hi(RTC_ISTAT);
470 P0.L = lo(RTC_ISTAT);
473 <<<<<<< HEAD:arch/blackfin/mach-common/dpmc.S
476 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-common/dpmc.S
479 ENTRY(_test_pll_locked)
487 <<<<<<< HEAD:arch/blackfin/mach-common/dpmc.S
490 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/blackfin/mach-common/dpmc.S