Skip to content
Snippets Groups Projects
Commit 66ee6923 authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

arm: Move tbl to arch_global_data


Move this field into arch_global_data and tidy up.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
parent 8ff43b03
No related branches found
No related tags found
No related merge requests found
......@@ -106,7 +106,7 @@ void reset_timer_masked(void)
/* reset time */
gd->lastinc = readl(&timer->tcnto4);
gd->tbl = 0;
gd->arch.tbl = 0;
}
unsigned long get_timer_masked(void)
......@@ -124,13 +124,13 @@ unsigned long get_current_tick(void)
unsigned long count_value = readl(&timer->tcntb4);
if (gd->lastinc >= now)
gd->tbl += gd->lastinc - now;
gd->arch.tbl += gd->lastinc - now;
else
gd->tbl += gd->lastinc + count_value - now;
gd->arch.tbl += gd->lastinc + count_value - now;
gd->lastinc = now;
return gd->tbl;
return gd->arch.tbl;
}
/*
......
......@@ -83,13 +83,13 @@ ulong get_timer_masked(void)
if (gd->lastinc >= now) {
/* normal mode (non roll) */
/* move stamp forward with absolute diff ticks */
gd->tbl += gd->lastinc - now;
gd->arch.tbl += gd->lastinc - now;
} else {
/* we have overflow of the count down timer */
gd->tbl += TIMER_LOAD_VAL - gd->lastinc + now;
gd->arch.tbl += TIMER_LOAD_VAL - gd->lastinc + now;
}
gd->lastinc = now;
return gd->tbl;
return gd->arch.tbl;
}
/*
......@@ -100,5 +100,5 @@ void reset_timer(void)
/* capture current decrementer value time */
gd->lastinc = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ);
/* start "advancing" time stamp from 0 */
gd->tbl = 0;
gd->arch.tbl = 0;
}
......@@ -100,12 +100,14 @@ ulong get_timer_masked(void)
/* current tick value */
ulong now = TICKS_TO_HZ(READ_TIMER());
if (now >= gd->lastinc) /* normal (non rollover) */
gd->tbl += (now - gd->lastinc);
else /* rollover */
gd->tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc) + now;
if (now >= gd->lastinc) { /* normal (non rollover) */
gd->arch.tbl += (now - gd->lastinc);
} else { /* rollover */
gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc)
+ now;
}
gd->lastinc = now;
return gd->tbl;
return gd->arch.tbl;
}
/* Delay x useconds */
......
......@@ -85,7 +85,7 @@ int timer_init(void)
/* Reset time */
gd->lastinc = readl(&timer_base->counter) /
(TIMER_TICK_HZ / CONFIG_SYS_HZ);
gd->tbl = 0;
gd->arch.tbl = 0;
return 0;
}
......@@ -102,14 +102,14 @@ ulong get_timer_masked(void)
if (gd->lastinc >= now) {
/* Normal mode */
gd->tbl += gd->lastinc - now;
gd->arch.tbl += gd->lastinc - now;
} else {
/* We have an overflow ... */
gd->tbl += gd->lastinc + TIMER_LOAD_VAL - now;
gd->arch.tbl += gd->lastinc + TIMER_LOAD_VAL - now;
}
gd->lastinc = now;
return gd->tbl;
return gd->arch.tbl;
}
void __udelay(unsigned long usec)
......
......@@ -31,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define TIMER_LOAD_VAL 0xffffffff
#define timestamp (gd->tbl)
#define timestamp (gd->arch.tbl)
#define lastinc (gd->lastinc)
#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
......
......@@ -77,12 +77,12 @@ ulong get_timer_masked(void)
if (now >= gd->lastinc) /* normal mode (non roll) */
/* move stamp forward with absolute diff ticks */
gd->tbl += (now - gd->lastinc);
gd->arch.tbl += (now - gd->lastinc);
else /* we have rollover of incrementer */
gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ))
gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ))
- gd->lastinc) + now;
gd->lastinc = now;
return gd->tbl;
return gd->arch.tbl;
}
/*
......
......@@ -48,7 +48,7 @@ static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR;
DECLARE_GLOBAL_DATA_PTR;
#define timestamp (gd->tbl)
#define timestamp (gd->arch.tbl)
#define lastinc (gd->lastinc)
static inline unsigned long long tick_to_time(unsigned long long tick)
......
......@@ -38,6 +38,7 @@ struct arch_global_data {
/* "static data" needed by most of timer.c on ARM platforms */
unsigned long timer_rate_hz;
unsigned long tbu;
unsigned long tbl;
};
/*
......@@ -64,7 +65,6 @@ typedef struct global_data {
#endif
#ifdef CONFIG_ARM
/* "static data" needed by most of timer.c on ARM platforms */
unsigned long tbl;
unsigned long long timer_reset_value;
unsigned long lastinc;
#endif
......
......@@ -35,7 +35,7 @@ void reset_timer_masked(void)
{
/* reset time */
gd->lastinc = readl(&tcu->tcnt0);
gd->tbl = 0;
gd->arch.tbl = 0;
}
ulong get_timer_masked(void)
......@@ -43,15 +43,15 @@ ulong get_timer_masked(void)
ulong now = readl(&tcu->tcnt0);
if (gd->lastinc <= now)
gd->tbl += now - gd->lastinc; /* normal mode */
gd->arch.tbl += now - gd->lastinc; /* normal mode */
else {
/* we have an overflow ... */
gd->tbl += TIMER_FDATA + now - gd->lastinc;
gd->arch.tbl += TIMER_FDATA + now - gd->lastinc;
}
gd->lastinc = now;
return gd->tbl;
return gd->arch.tbl;
}
void udelay_masked(unsigned long usec)
......@@ -95,7 +95,7 @@ int timer_init(void)
writeb(1 << TIMER_CHAN, &tcu->tesr); /* start counting up */
gd->lastinc = 0;
gd->tbl = 0;
gd->arch.tbl = 0;
return 0;
}
......@@ -112,7 +112,7 @@ ulong get_timer(ulong base)
void set_timer(ulong t)
{
gd->tbl = t;
gd->arch.tbl = t;
}
void __udelay(unsigned long usec)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment