]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/arm/cpu/arm920t/imx/timer.c
cdb214825ee7953b12dd0e46851b71388c04e8c6
3 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
4 * Marius Groeger <mgroeger@sysgo.de>
7 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
8 * Alex Zuepke <azu@sysgo.de>
11 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
13 * See file CREDITS for list of people who contributed to this
16 * This program is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU General Public License as
18 * published by the Free Software Foundation; either version 2 of
19 * the License, or (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
33 #if defined (CONFIG_IMX)
35 #include <asm/arch/imx-regs.h>
40 /* setup GP Timer 1 */
42 for ( i
=0; i
<100; i
++) TCTL1
= 0; /* We have no udelay by now */
43 TPRER1
= get_PERCLK1() / 1000000; /* 1 MHz */
44 TCTL1
|= TCTL_FRR
| (1<<1); /* Freerun Mode, PERCLK1 input */
52 * timer without interrupts
54 ulong
get_timer (ulong base
)
56 return get_timer_masked() - base
;
59 void reset_timer_masked (void)
62 TCTL1
|= TCTL_TEN
; /* Enable timer */
65 ulong
get_timer_masked (void)
70 void udelay_masked (unsigned long usec
)
72 ulong endtime
= get_timer_masked() + usec
;
76 ulong now
= get_timer_masked ();
81 void __udelay (unsigned long usec
)
87 * This function is derived from PowerPC code (read timebase as long long).
88 * On ARM it just returns the timer value.
90 unsigned long long get_ticks(void)
96 * This function is derived from PowerPC code (timebase clock frequency).
97 * On ARM it returns the number of timer ticks per second.
99 ulong
get_tbclk (void)
103 tbclk
= CONFIG_SYS_HZ
;
109 * Reset the cpu by setting up the watchdog timer and let him time out
111 void reset_cpu (ulong ignored
)
113 /* Disable watchdog and set Time-Out field to 0 */
116 /* Write Service Sequence */
120 /* Enable watchdog */
127 #endif /* defined (CONFIG_IMX) */