1 // SPDX-License-Identifier: GPL-2.0+
4 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
8 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
16 #if defined (CONFIG_IMX)
18 #include <asm/arch/imx-regs.h>
23 /* setup GP Timer 1 */
25 for ( i=0; i<100; i++) TCTL1 = 0; /* We have no udelay by now */
26 TPRER1 = get_PERCLK1() / 1000000; /* 1 MHz */
27 TCTL1 |= TCTL_FRR | (1<<1); /* Freerun Mode, PERCLK1 input */
31 TCTL1 |= TCTL_TEN; /* Enable timer */
37 * timer without interrupts
39 ulong get_timer (ulong base)
41 return get_timer_masked() - base;
44 ulong get_timer_masked (void)
49 void udelay_masked (unsigned long usec)
51 ulong endtime = get_timer_masked() + usec;
55 ulong now = get_timer_masked ();
60 void __udelay (unsigned long usec)
66 * This function is derived from PowerPC code (read timebase as long long).
67 * On ARM it just returns the timer value.
69 unsigned long long get_ticks(void)
75 * This function is derived from PowerPC code (timebase clock frequency).
76 * On ARM it returns the number of timer ticks per second.
78 ulong get_tbclk (void)
84 * Reset the cpu by setting up the watchdog timer and let him time out
86 void reset_cpu (ulong ignored)
88 /* Disable watchdog and set Time-Out field to 0 */
91 /* Write Service Sequence */
102 #endif /* defined (CONFIG_IMX) */