summaryrefslogtreecommitdiff
path: root/arch/arm/mach-zynq/timer.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-05-26 10:37:29 -0400
committerTom Rini <trini@konsulko.com>2015-05-26 10:37:29 -0400
commitd43e15421014c17b90c3e288e3eff18ad8aaf346 (patch)
tree2229d85ccf4fb2cbff7a9c9143017d13755416a6 /arch/arm/mach-zynq/timer.c
parent980267a1445b7b4d8e8d05ef57799d92ba4a2ee3 (diff)
parent95b237ecbced8ca120c37cc284c4b2feeec8ed57 (diff)
Merge branch 'zynq' of git://www.denx.de/git/u-boot-microblaze
Diffstat (limited to 'arch/arm/mach-zynq/timer.c')
-rw-r--r--arch/arm/mach-zynq/timer.c83
1 files changed, 1 insertions, 82 deletions
diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c
index 5ed9642df9..8ff82dc930 100644
--- a/arch/arm/mach-zynq/timer.c
+++ b/arch/arm/mach-zynq/timer.c
@@ -78,91 +78,10 @@ int timer_init(void)
}
/*
- * This function is derived from PowerPC code (read timebase as long long).
- * On ARM it just returns the timer value.
- */
-ulong get_timer_masked(void)
-{
- ulong now;
-
- now = readl(&timer_base->counter) /
- (gd->arch.timer_rate_hz / CONFIG_SYS_HZ);
-
- if (gd->arch.lastinc >= now) {
- /* Normal mode */
- gd->arch.tbl += gd->arch.lastinc - now;
- } else {
- /* We have an overflow ... */
- gd->arch.tbl += gd->arch.lastinc + (TIMER_LOAD_VAL /
- (gd->arch.timer_rate_hz / CONFIG_SYS_HZ)) -
- now + 1;
- }
- gd->arch.lastinc = now;
-
- return gd->arch.tbl;
-}
-
-void __udelay(unsigned long usec)
-{
- u32 countticks;
- u32 timeend;
- u32 timediff;
- u32 timenow;
-
- if (usec == 0)
- return;
-
- countticks = lldiv(((unsigned long long)gd->arch.timer_rate_hz * usec),
- 1000000);
-
- /* decrementing timer */
- timeend = readl(&timer_base->counter) - countticks;
-
-#if TIMER_LOAD_VAL != 0xFFFFFFFF
- /* do not manage multiple overflow */
- if (countticks >= TIMER_LOAD_VAL)
- countticks = TIMER_LOAD_VAL - 1;
-#endif
-
- do {
- timenow = readl(&timer_base->counter);
-
- if (timenow >= timeend) {
- /* normal case */
- timediff = timenow - timeend;
- } else {
- if ((TIMER_LOAD_VAL - timeend + timenow) <=
- countticks) {
- /* overflow */
- timediff = TIMER_LOAD_VAL - timeend + timenow;
- } else {
- /* missed the exact match */
- break;
- }
- }
- } while (timediff > 0);
-}
-
-/* Timer without interrupts */
-ulong get_timer(ulong base)
-{
- return get_timer_masked() - base;
-}
-
-/*
- * This function is derived from PowerPC code (read timebase as long long).
- * On ARM it just returns the timer value.
- */
-unsigned long long get_ticks(void)
-{
- return get_timer(0);
-}
-
-/*
* This function is derived from PowerPC code (timebase clock frequency).
* On ARM it returns the number of timer ticks per second.
*/
ulong get_tbclk(void)
{
- return CONFIG_SYS_HZ;
+ return gd->arch.timer_rate_hz;
}