mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-01 03:51:31 +00:00
arm: Move tbl to arch_global_data
Move this field into arch_global_data and tidy up. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
8ff43b03e9
commit
66ee692347
29 changed files with 95 additions and 89 deletions
|
@ -117,11 +117,11 @@ unsigned long long get_ticks(void)
|
||||||
|
|
||||||
if (now >= gd->lastinc) /* normal mode (non roll) */
|
if (now >= gd->lastinc) /* normal mode (non roll) */
|
||||||
/* move stamp forward with absolut diff ticks */
|
/* move stamp forward with absolut diff ticks */
|
||||||
gd->tbl += (now - gd->lastinc);
|
gd->arch.tbl += (now - gd->lastinc);
|
||||||
else /* we have rollover of incrementer */
|
else /* we have rollover of incrementer */
|
||||||
gd->tbl += (0xFFFFFFFF - gd->lastinc) + now;
|
gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now;
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong get_timer_masked(void)
|
ulong get_timer_masked(void)
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp (gd->tbl)
|
#define timestamp (gd->arch.tbl)
|
||||||
#define lastinc (gd->lastinc)
|
#define lastinc (gd->lastinc)
|
||||||
|
|
||||||
/* General purpose timers bitfields */
|
/* General purpose timers bitfields */
|
||||||
|
|
|
@ -52,7 +52,7 @@ int timer_init (void)
|
||||||
|
|
||||||
/* reset time */
|
/* reset time */
|
||||||
gd->lastinc = READ_TIMER; /* capture current incrementer value */
|
gd->lastinc = READ_TIMER; /* capture current incrementer value */
|
||||||
gd->tbl = 0; /* start "advancing" time stamp */
|
gd->arch.tbl = 0; /* start "advancing" time stamp */
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ void __udelay (unsigned long usec)
|
||||||
if ((tmo + tmp + 1) < tmp) { /* if setting this forward will roll */
|
if ((tmo + tmp + 1) < tmp) { /* if setting this forward will roll */
|
||||||
/* time stamp, then reset time */
|
/* time stamp, then reset time */
|
||||||
gd->lastinc = READ_TIMER; /* capture incrementer value */
|
gd->lastinc = READ_TIMER; /* capture incrementer value */
|
||||||
gd->tbl = 0; /* start time stamp */
|
gd->arch.tbl = 0; /* start time stamp */
|
||||||
} else {
|
} else {
|
||||||
tmo += tmp; /* else, set advancing stamp wake up time */
|
tmo += tmp; /* else, set advancing stamp wake up time */
|
||||||
}
|
}
|
||||||
|
@ -94,12 +94,15 @@ ulong get_timer_masked (void)
|
||||||
{
|
{
|
||||||
ulong now = READ_TIMER; /* current tick value */
|
ulong now = READ_TIMER; /* current tick value */
|
||||||
|
|
||||||
if (now >= gd->lastinc) /* normal mode (non roll) */
|
if (now >= gd->lastinc) { /* normal mode (non roll) */
|
||||||
gd->tbl += (now - gd->lastinc); /* move stamp fordward with absoulte diff ticks */
|
/* move stamp fordward with absoulte diff ticks */
|
||||||
else /* we have rollover of incrementer */
|
gd->arch.tbl += (now - gd->lastinc);
|
||||||
gd->tbl += (0xFFFFFFFF - gd->lastinc) + now;
|
} else {
|
||||||
|
/* we have rollover of incrementer */
|
||||||
|
gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now;
|
||||||
|
}
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* waits specified delay value and resets timestamp */
|
/* waits specified delay value and resets timestamp */
|
||||||
|
|
|
@ -75,7 +75,7 @@ int timer_init(void)
|
||||||
writel(cr, &tmr->cr);
|
writel(cr, &tmr->cr);
|
||||||
|
|
||||||
gd->arch.timer_rate_hz = TIMER_CLOCK;
|
gd->arch.timer_rate_hz = TIMER_CLOCK;
|
||||||
gd->arch.tbu = gd->tbl = 0;
|
gd->arch.tbu = gd->arch.tbl = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -89,10 +89,10 @@ unsigned long long get_ticks(void)
|
||||||
ulong now = TIMER_LOAD_VAL - readl(&tmr->timer3_counter);
|
ulong now = TIMER_LOAD_VAL - readl(&tmr->timer3_counter);
|
||||||
|
|
||||||
/* increment tbu if tbl has rolled over */
|
/* increment tbu if tbl has rolled over */
|
||||||
if (now < gd->tbl)
|
if (now < gd->arch.tbl)
|
||||||
gd->arch.tbu++;
|
gd->arch.tbu++;
|
||||||
gd->tbl = now;
|
gd->arch.tbl = now;
|
||||||
return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
|
return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __udelay(unsigned long usec)
|
void __udelay(unsigned long usec)
|
||||||
|
|
|
@ -64,7 +64,7 @@ int timer_init(void)
|
||||||
|
|
||||||
writel(AT91_TC_CCR_SWTRG | AT91_TC_CCR_CLKEN, &tc->tc[0].ccr);
|
writel(AT91_TC_CCR_SWTRG | AT91_TC_CCR_CLKEN, &tc->tc[0].ccr);
|
||||||
gd->lastinc = 0;
|
gd->lastinc = 0;
|
||||||
gd->tbl = 0;
|
gd->arch.tbl = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -91,14 +91,14 @@ ulong get_timer_raw(void)
|
||||||
|
|
||||||
if (now >= gd->lastinc) {
|
if (now >= gd->lastinc) {
|
||||||
/* normal mode */
|
/* normal mode */
|
||||||
gd->tbl += now - gd->lastinc;
|
gd->arch.tbl += now - gd->lastinc;
|
||||||
} else {
|
} else {
|
||||||
/* we have an overflow ... */
|
/* we have an overflow ... */
|
||||||
gd->tbl += now + TIMER_LOAD_VAL - gd->lastinc;
|
gd->arch.tbl += now + TIMER_LOAD_VAL - gd->lastinc;
|
||||||
}
|
}
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
|
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong get_timer_masked(void)
|
ulong get_timer_masked(void)
|
||||||
|
|
|
@ -63,7 +63,7 @@ int timer_init(void)
|
||||||
tmr = (tmr & ~0x0700000) | 0x0500000;
|
tmr = (tmr & ~0x0700000) | 0x0500000;
|
||||||
writel(tmr, &timers->tcon);
|
writel(tmr, &timers->tcon);
|
||||||
gd->lastinc = 0;
|
gd->lastinc = 0;
|
||||||
gd->tbl = 0;
|
gd->arch.tbl = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -130,14 +130,14 @@ unsigned long long get_ticks(void)
|
||||||
|
|
||||||
if (gd->lastinc >= now) {
|
if (gd->lastinc >= now) {
|
||||||
/* normal mode */
|
/* normal mode */
|
||||||
gd->tbl += gd->lastinc - now;
|
gd->arch.tbl += gd->lastinc - now;
|
||||||
} else {
|
} else {
|
||||||
/* we have an overflow ... */
|
/* we have an overflow ... */
|
||||||
gd->tbl += gd->lastinc + gd->arch.tbu - now;
|
gd->arch.tbl += gd->lastinc + gd->arch.tbu - now;
|
||||||
}
|
}
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
|
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct armd1tmr_registers {
|
||||||
#define COUNT_RD_REQ 0x1
|
#define COUNT_RD_REQ 0x1
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
/* Using gd->arch.tbu from timestamp and gd->tbl for lastdec */
|
/* Using gd->arch.tbu from timestamp and gd->arch.tbl for lastdec */
|
||||||
|
|
||||||
/* For preventing risk of instability in reading counter value,
|
/* For preventing risk of instability in reading counter value,
|
||||||
* first set read request to register cvwr and then read same
|
* first set read request to register cvwr and then read same
|
||||||
|
@ -82,14 +82,14 @@ ulong get_timer_masked(void)
|
||||||
{
|
{
|
||||||
ulong now = read_timer();
|
ulong now = read_timer();
|
||||||
|
|
||||||
if (now >= gd->tbl) {
|
if (now >= gd->arch.tbl) {
|
||||||
/* normal mode */
|
/* normal mode */
|
||||||
gd->arch.tbu += now - gd->tbl;
|
gd->arch.tbu += now - gd->arch.tbl;
|
||||||
} else {
|
} else {
|
||||||
/* we have an overflow ... */
|
/* we have an overflow ... */
|
||||||
gd->arch.tbu += now + TIMER_LOAD_VAL - gd->tbl;
|
gd->arch.tbu += now + TIMER_LOAD_VAL - gd->arch.tbl;
|
||||||
}
|
}
|
||||||
gd->tbl = now;
|
gd->arch.tbl = now;
|
||||||
|
|
||||||
return gd->arch.tbu;
|
return gd->arch.tbu;
|
||||||
}
|
}
|
||||||
|
@ -135,8 +135,8 @@ int timer_init(void)
|
||||||
|
|
||||||
/* Enable timer 0 */
|
/* Enable timer 0 */
|
||||||
writel(0x1, &armd1timers->cer);
|
writel(0x1, &armd1timers->cer);
|
||||||
/* init the gd->arch.tbu and gd->tbl value */
|
/* init the gd->arch.tbu and gd->arch.tbl value */
|
||||||
gd->tbl = read_timer();
|
gd->arch.tbl = read_timer();
|
||||||
gd->arch.tbu = 0;
|
gd->arch.tbu = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -80,7 +80,7 @@ int timer_init(void)
|
||||||
writel(TIMER_LOAD_VAL | AT91_PIT_MR_EN , &pit->mr);
|
writel(TIMER_LOAD_VAL | AT91_PIT_MR_EN , &pit->mr);
|
||||||
|
|
||||||
gd->arch.timer_rate_hz = gd->arch.mck_rate_hz / 16;
|
gd->arch.timer_rate_hz = gd->arch.mck_rate_hz / 16;
|
||||||
gd->arch.tbu = gd->tbl = 0;
|
gd->arch.tbu = gd->arch.tbl = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -95,10 +95,10 @@ unsigned long long get_ticks(void)
|
||||||
ulong now = readl(&pit->piir);
|
ulong now = readl(&pit->piir);
|
||||||
|
|
||||||
/* increment tbu if tbl has rolled over */
|
/* increment tbu if tbl has rolled over */
|
||||||
if (now < gd->tbl)
|
if (now < gd->arch.tbl)
|
||||||
gd->arch.tbu++;
|
gd->arch.tbu++;
|
||||||
gd->tbl = now;
|
gd->arch.tbl = now;
|
||||||
return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
|
return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __udelay(unsigned long usec)
|
void __udelay(unsigned long usec)
|
||||||
|
|
|
@ -74,11 +74,11 @@ unsigned long long get_ticks(void)
|
||||||
unsigned long now = readl(&timer->tim34);
|
unsigned long now = readl(&timer->tim34);
|
||||||
|
|
||||||
/* increment tbu if tbl has rolled over */
|
/* increment tbu if tbl has rolled over */
|
||||||
if (now < gd->tbl)
|
if (now < gd->arch.tbl)
|
||||||
gd->arch.tbu++;
|
gd->arch.tbu++;
|
||||||
gd->tbl = now;
|
gd->arch.tbl = now;
|
||||||
|
|
||||||
return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl;
|
return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong get_timer(ulong base)
|
ulong get_timer(ulong base)
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers *)KW_TIMER_BASE;
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp gd->tbl
|
#define timestamp gd->arch.tbl
|
||||||
#define lastdec gd->lastinc
|
#define lastdec gd->lastinc
|
||||||
|
|
||||||
ulong get_timer_masked(void)
|
ulong get_timer_masked(void)
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp gd->tbl
|
#define timestamp gd->arch.tbl
|
||||||
#define lastdec gd->lastinc
|
#define lastdec gd->lastinc
|
||||||
|
|
||||||
static inline unsigned long long tick_to_time(unsigned long long tick)
|
static inline unsigned long long tick_to_time(unsigned long long tick)
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp (gd->tbl)
|
#define timestamp (gd->arch.tbl)
|
||||||
#define lastinc (gd->lastinc)
|
#define lastinc (gd->lastinc)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp (gd->tbl)
|
#define timestamp (gd->arch.tbl)
|
||||||
#define lastinc (gd->lastinc)
|
#define lastinc (gd->lastinc)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp (gd->tbl)
|
#define timestamp (gd->arch.tbl)
|
||||||
#define lastdec (gd->lastinc)
|
#define lastdec (gd->lastinc)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp gd->tbl
|
#define timestamp gd->arch.tbl
|
||||||
#define lastdec gd->lastinc
|
#define lastdec gd->lastinc
|
||||||
|
|
||||||
int timer_init (void)
|
int timer_init (void)
|
||||||
|
|
|
@ -92,7 +92,7 @@ static inline ulong read_timer(void)
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp gd->tbl
|
#define timestamp gd->arch.tbl
|
||||||
#define lastdec gd->lastinc
|
#define lastdec gd->lastinc
|
||||||
|
|
||||||
ulong get_timer_masked(void)
|
ulong get_timer_masked(void)
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct panthtmr_registers {
|
||||||
#define COUNT_RD_REQ 0x1
|
#define COUNT_RD_REQ 0x1
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
/* Using gd->arch.tbu from timestamp and gd->tbl for lastdec */
|
/* Using gd->arch.tbu from timestamp and gd->arch.tbl for lastdec */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For preventing risk of instability in reading counter value,
|
* For preventing risk of instability in reading counter value,
|
||||||
|
@ -90,14 +90,14 @@ ulong get_timer_masked(void)
|
||||||
{
|
{
|
||||||
ulong now = read_timer();
|
ulong now = read_timer();
|
||||||
|
|
||||||
if (now >= gd->tbl) {
|
if (now >= gd->arch.tbl) {
|
||||||
/* normal mode */
|
/* normal mode */
|
||||||
gd->arch.tbu += now - gd->tbl;
|
gd->arch.tbu += now - gd->arch.tbl;
|
||||||
} else {
|
} else {
|
||||||
/* we have an overflow ... */
|
/* we have an overflow ... */
|
||||||
gd->arch.tbu += now + TIMER_LOAD_VAL - gd->tbl;
|
gd->arch.tbu += now + TIMER_LOAD_VAL - gd->arch.tbl;
|
||||||
}
|
}
|
||||||
gd->tbl = now;
|
gd->arch.tbl = now;
|
||||||
|
|
||||||
return gd->arch.tbu;
|
return gd->arch.tbu;
|
||||||
}
|
}
|
||||||
|
@ -144,8 +144,8 @@ int timer_init(void)
|
||||||
|
|
||||||
/* Enable timer 0 */
|
/* Enable timer 0 */
|
||||||
writel(0x1, &panthtimers->cer);
|
writel(0x1, &panthtimers->cer);
|
||||||
/* init the gd->arch.tbu and gd->tbl value */
|
/* init the gd->arch.tbu and gd->arch.tbl value */
|
||||||
gd->tbl = read_timer();
|
gd->arch.tbl = read_timer();
|
||||||
gd->arch.tbu = 0;
|
gd->arch.tbu = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -38,7 +38,7 @@ static struct misc_regs *const misc_regs_p =
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp gd->tbl
|
#define timestamp gd->arch.tbl
|
||||||
#define lastdec gd->lastinc
|
#define lastdec gd->lastinc
|
||||||
|
|
||||||
int timer_init(void)
|
int timer_init(void)
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp gd->tbl
|
#define timestamp gd->arch.tbl
|
||||||
#define lastdec gd->lastinc
|
#define lastdec gd->lastinc
|
||||||
|
|
||||||
#define TIMER_ENABLE (1 << 7)
|
#define TIMER_ENABLE (1 << 7)
|
||||||
|
|
|
@ -57,7 +57,7 @@ int timer_init(void)
|
||||||
|
|
||||||
/* reset time, capture current incrementer value time */
|
/* reset time, capture current incrementer value time */
|
||||||
gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
|
gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
|
||||||
gd->tbl = 0; /* start "advancing" time stamp from 0 */
|
gd->arch.tbl = 0; /* start "advancing" time stamp from 0 */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -91,14 +91,15 @@ ulong get_timer_masked(void)
|
||||||
/* current tick value */
|
/* current tick value */
|
||||||
ulong now = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
|
ulong now = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
|
||||||
|
|
||||||
if (now >= gd->lastinc) /* normal mode (non roll) */
|
if (now >= gd->lastinc) { /* normal mode (non roll) */
|
||||||
/* move stamp fordward with absoulte diff ticks */
|
/* move stamp fordward with absoulte diff ticks */
|
||||||
gd->tbl += (now - gd->lastinc);
|
gd->arch.tbl += (now - gd->lastinc);
|
||||||
else /* we have rollover of incrementer */
|
} else { /* we have rollover of incrementer */
|
||||||
gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK / CONFIG_SYS_HZ))
|
gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK /
|
||||||
- gd->lastinc) + now;
|
CONFIG_SYS_HZ)) - gd->lastinc) + now;
|
||||||
|
}
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -106,7 +106,7 @@ void reset_timer_masked(void)
|
||||||
|
|
||||||
/* reset time */
|
/* reset time */
|
||||||
gd->lastinc = readl(&timer->tcnto4);
|
gd->lastinc = readl(&timer->tcnto4);
|
||||||
gd->tbl = 0;
|
gd->arch.tbl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long get_timer_masked(void)
|
unsigned long get_timer_masked(void)
|
||||||
|
@ -124,13 +124,13 @@ unsigned long get_current_tick(void)
|
||||||
unsigned long count_value = readl(&timer->tcntb4);
|
unsigned long count_value = readl(&timer->tcntb4);
|
||||||
|
|
||||||
if (gd->lastinc >= now)
|
if (gd->lastinc >= now)
|
||||||
gd->tbl += gd->lastinc - now;
|
gd->arch.tbl += gd->lastinc - now;
|
||||||
else
|
else
|
||||||
gd->tbl += gd->lastinc + count_value - now;
|
gd->arch.tbl += gd->lastinc + count_value - now;
|
||||||
|
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
|
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -83,13 +83,13 @@ ulong get_timer_masked(void)
|
||||||
if (gd->lastinc >= now) {
|
if (gd->lastinc >= now) {
|
||||||
/* normal mode (non roll) */
|
/* normal mode (non roll) */
|
||||||
/* move stamp forward with absolute diff ticks */
|
/* move stamp forward with absolute diff ticks */
|
||||||
gd->tbl += gd->lastinc - now;
|
gd->arch.tbl += gd->lastinc - now;
|
||||||
} else {
|
} else {
|
||||||
/* we have overflow of the count down timer */
|
/* 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;
|
gd->lastinc = now;
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -100,5 +100,5 @@ void reset_timer(void)
|
||||||
/* capture current decrementer value time */
|
/* capture current decrementer value time */
|
||||||
gd->lastinc = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ);
|
gd->lastinc = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ);
|
||||||
/* start "advancing" time stamp from 0 */
|
/* 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 */
|
/* current tick value */
|
||||||
ulong now = TICKS_TO_HZ(READ_TIMER());
|
ulong now = TICKS_TO_HZ(READ_TIMER());
|
||||||
|
|
||||||
if (now >= gd->lastinc) /* normal (non rollover) */
|
if (now >= gd->lastinc) { /* normal (non rollover) */
|
||||||
gd->tbl += (now - gd->lastinc);
|
gd->arch.tbl += (now - gd->lastinc);
|
||||||
else /* rollover */
|
} else { /* rollover */
|
||||||
gd->tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc) + now;
|
gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc)
|
||||||
|
+ now;
|
||||||
|
}
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Delay x useconds */
|
/* Delay x useconds */
|
||||||
|
|
|
@ -85,7 +85,7 @@ int timer_init(void)
|
||||||
/* Reset time */
|
/* Reset time */
|
||||||
gd->lastinc = readl(&timer_base->counter) /
|
gd->lastinc = readl(&timer_base->counter) /
|
||||||
(TIMER_TICK_HZ / CONFIG_SYS_HZ);
|
(TIMER_TICK_HZ / CONFIG_SYS_HZ);
|
||||||
gd->tbl = 0;
|
gd->arch.tbl = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -102,14 +102,14 @@ ulong get_timer_masked(void)
|
||||||
|
|
||||||
if (gd->lastinc >= now) {
|
if (gd->lastinc >= now) {
|
||||||
/* Normal mode */
|
/* Normal mode */
|
||||||
gd->tbl += gd->lastinc - now;
|
gd->arch.tbl += gd->lastinc - now;
|
||||||
} else {
|
} else {
|
||||||
/* We have an overflow ... */
|
/* We have an overflow ... */
|
||||||
gd->tbl += gd->lastinc + TIMER_LOAD_VAL - now;
|
gd->arch.tbl += gd->lastinc + TIMER_LOAD_VAL - now;
|
||||||
}
|
}
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
|
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __udelay(unsigned long usec)
|
void __udelay(unsigned long usec)
|
||||||
|
|
|
@ -31,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define TIMER_LOAD_VAL 0xffffffff
|
#define TIMER_LOAD_VAL 0xffffffff
|
||||||
|
|
||||||
#define timestamp (gd->tbl)
|
#define timestamp (gd->arch.tbl)
|
||||||
#define lastinc (gd->lastinc)
|
#define lastinc (gd->lastinc)
|
||||||
|
|
||||||
#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
|
#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) */
|
if (now >= gd->lastinc) /* normal mode (non roll) */
|
||||||
/* move stamp forward with absolute diff ticks */
|
/* move stamp forward with absolute diff ticks */
|
||||||
gd->tbl += (now - gd->lastinc);
|
gd->arch.tbl += (now - gd->lastinc);
|
||||||
else /* we have rollover of incrementer */
|
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;
|
||||||
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;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
#define timestamp (gd->tbl)
|
#define timestamp (gd->arch.tbl)
|
||||||
#define lastinc (gd->lastinc)
|
#define lastinc (gd->lastinc)
|
||||||
|
|
||||||
static inline unsigned long long tick_to_time(unsigned long long tick)
|
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 */
|
/* "static data" needed by most of timer.c on ARM platforms */
|
||||||
unsigned long timer_rate_hz;
|
unsigned long timer_rate_hz;
|
||||||
unsigned long tbu;
|
unsigned long tbu;
|
||||||
|
unsigned long tbl;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -64,7 +65,6 @@ typedef struct global_data {
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_ARM
|
#ifdef CONFIG_ARM
|
||||||
/* "static data" needed by most of timer.c on ARM platforms */
|
/* "static data" needed by most of timer.c on ARM platforms */
|
||||||
unsigned long tbl;
|
|
||||||
unsigned long long timer_reset_value;
|
unsigned long long timer_reset_value;
|
||||||
unsigned long lastinc;
|
unsigned long lastinc;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,7 +35,7 @@ void reset_timer_masked(void)
|
||||||
{
|
{
|
||||||
/* reset time */
|
/* reset time */
|
||||||
gd->lastinc = readl(&tcu->tcnt0);
|
gd->lastinc = readl(&tcu->tcnt0);
|
||||||
gd->tbl = 0;
|
gd->arch.tbl = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong get_timer_masked(void)
|
ulong get_timer_masked(void)
|
||||||
|
@ -43,15 +43,15 @@ ulong get_timer_masked(void)
|
||||||
ulong now = readl(&tcu->tcnt0);
|
ulong now = readl(&tcu->tcnt0);
|
||||||
|
|
||||||
if (gd->lastinc <= now)
|
if (gd->lastinc <= now)
|
||||||
gd->tbl += now - gd->lastinc; /* normal mode */
|
gd->arch.tbl += now - gd->lastinc; /* normal mode */
|
||||||
else {
|
else {
|
||||||
/* we have an overflow ... */
|
/* we have an overflow ... */
|
||||||
gd->tbl += TIMER_FDATA + now - gd->lastinc;
|
gd->arch.tbl += TIMER_FDATA + now - gd->lastinc;
|
||||||
}
|
}
|
||||||
|
|
||||||
gd->lastinc = now;
|
gd->lastinc = now;
|
||||||
|
|
||||||
return gd->tbl;
|
return gd->arch.tbl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void udelay_masked(unsigned long usec)
|
void udelay_masked(unsigned long usec)
|
||||||
|
@ -95,7 +95,7 @@ int timer_init(void)
|
||||||
writeb(1 << TIMER_CHAN, &tcu->tesr); /* start counting up */
|
writeb(1 << TIMER_CHAN, &tcu->tesr); /* start counting up */
|
||||||
|
|
||||||
gd->lastinc = 0;
|
gd->lastinc = 0;
|
||||||
gd->tbl = 0;
|
gd->arch.tbl = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ ulong get_timer(ulong base)
|
||||||
|
|
||||||
void set_timer(ulong t)
|
void set_timer(ulong t)
|
||||||
{
|
{
|
||||||
gd->tbl = t;
|
gd->arch.tbl = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __udelay(unsigned long usec)
|
void __udelay(unsigned long usec)
|
||||||
|
|
Loading…
Add table
Reference in a new issue