1 // SPDX-License-Identifier: GPL-2.0+
4 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
5 * Marius Groeger <mgroeger@sysgo.de>
8 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
9 * Alex Zuepke <azu@sysgo.de>
12 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
17 #if defined (CONFIG_IMX)
19 #include <asm/arch/imx-regs.h>
24 /* setup GP Timer 1 */
26 for ( i=0; i<100; i++) TCTL1 = 0; /* We have no udelay by now */
27 TPRER1 = get_PERCLK1() / 1000000; /* 1 MHz */
28 TCTL1 |= TCTL_FRR | (1<<1); /* Freerun Mode, PERCLK1 input */
32 TCTL1 |= TCTL_TEN; /* Enable timer */
38 * timer without interrupts
40 static ulong get_timer_masked (void)
45 ulong get_timer (ulong base)
47 return get_timer_masked() - base;
50 void __udelay (unsigned long usec)
52 ulong endtime = get_timer_masked() + usec;
56 ulong now = get_timer_masked ();
62 * This function is derived from PowerPC code (read timebase as long long).
63 * On ARM it just returns the timer value.
65 unsigned long long get_ticks(void)
71 * This function is derived from PowerPC code (timebase clock frequency).
72 * On ARM it returns the number of timer ticks per second.
80 * Reset the cpu by setting up the watchdog timer and let him time out
82 void reset_cpu (ulong ignored)
84 /* Disable watchdog and set Time-Out field to 0 */
87 /* Write Service Sequence */
98 #endif /* defined (CONFIG_IMX) */