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>
18 #if defined (CONFIG_IMX)
20 #include <asm/arch/imx-regs.h>
25 /* setup GP Timer 1 */
27 for ( i=0; i<100; i++) TCTL1 = 0; /* We have no udelay by now */
28 TPRER1 = get_PERCLK1() / 1000000; /* 1 MHz */
29 TCTL1 |= TCTL_FRR | (1<<1); /* Freerun Mode, PERCLK1 input */
33 TCTL1 |= TCTL_TEN; /* Enable timer */
39 * timer without interrupts
41 static ulong get_timer_masked (void)
46 ulong get_timer (ulong base)
48 return get_timer_masked() - base;
51 void __udelay (unsigned long usec)
53 ulong endtime = get_timer_masked() + usec;
57 ulong now = get_timer_masked ();
63 * This function is derived from PowerPC code (read timebase as long long).
64 * On ARM it just returns the timer value.
66 unsigned long long get_ticks(void)
72 * This function is derived from PowerPC code (timebase clock frequency).
73 * On ARM it returns the number of timer ticks per second.
81 * Reset the cpu by setting up the watchdog timer and let him time out
83 void reset_cpu(ulong ignored)
85 /* Disable watchdog and set Time-Out field to 0 */
88 /* Write Service Sequence */
99 #endif /* defined (CONFIG_IMX) */