Timer: Remove set_timer completely

This commit is contained in:
Graeme Russ 2011-07-15 02:18:12 +00:00 committed by Wolfgang Denk
parent dcac25a05e
commit 5c8404aff1
49 changed files with 5 additions and 254 deletions

View file

@ -147,11 +147,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
gd->tbl = time_to_tick(t);
}
/* delay x useconds AND preserve advance timestamp value */ /* delay x useconds AND preserve advance timestamp value */
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {

View file

@ -92,10 +92,6 @@ ulong get_timer(ulong base)
return (tmp / 1000) - base; return (tmp / 1000) - base;
} }
void set_timer(ulong t)
{
}
/* /*
* delay x useconds AND preserve advance timstamp value * delay x useconds AND preserve advance timstamp value
* GPTCNT is now supposed to tick 1 by 1 us. * GPTCNT is now supposed to tick 1 by 1 us.

View file

@ -67,11 +67,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
gd->tbl = t;
}
/* delay x useconds AND preserve advance timestamp value */ /* delay x useconds AND preserve advance timestamp value */
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {

View file

@ -159,11 +159,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
timestamp = t * (timer_load_val / (100 * CONFIG_SYS_HZ));
}
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {
unsigned long long tmp; unsigned long long tmp;

View file

@ -88,11 +88,6 @@ ulong get_timer(ulong base)
return (get_timer_raw() / (TIMER_LOAD_VAL / TIM_CLK_DIV)) - base; return (get_timer_raw() / (TIMER_LOAD_VAL / TIM_CLK_DIV)) - base;
} }
void set_timer(ulong t)
{
timestamp = t;
}
unsigned long long get_ticks(void) unsigned long long get_ticks(void)
{ {
return get_timer(0); return get_timer(0);

View file

@ -219,11 +219,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
timestamp = t;
}
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {
ulong tmo; ulong tmo;

View file

@ -132,12 +132,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
debug("%s(%lx)\n", __func__, t);
timestamp = t;
}
/* delay x useconds AND preserve advance timestamp value */ /* delay x useconds AND preserve advance timestamp value */
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {

View file

@ -83,11 +83,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
gd->tbl = t;
}
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {
udelay_masked(usec); udelay_masked(usec);

View file

@ -82,11 +82,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
timestamp = t;
}
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {
udelay_masked(usec); udelay_masked(usec);

View file

@ -62,11 +62,6 @@ ulong get_timer (ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer (ulong t)
{
/* nop */
}
void reset_timer_masked (void) void reset_timer_masked (void)
{ {
TCTL1 &= ~TCTL_TEN; TCTL1 &= ~TCTL_TEN;

View file

@ -76,11 +76,6 @@ ulong get_timer(ulong base)
return (get_timer_masked() - base); return (get_timer_masked() - base);
} }
void set_timer(ulong t)
{
timer_ticks = t;
}
void __udelay(ulong usec) void __udelay(ulong usec)
{ {
ulong start = get_timer_masked(); ulong start = get_timer_masked();

View file

@ -94,11 +94,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
timestamp = t;
}
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {
ulong tmo; ulong tmo;

View file

@ -75,11 +75,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
timestamp = t;
}
/* delay x useconds AND preserve advance timestamp value */ /* delay x useconds AND preserve advance timestamp value */
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {

View file

@ -111,11 +111,6 @@ ulong get_timer(ulong base)
base); base);
} }
void set_timer(ulong t)
{
gd->tbu = t;
}
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {
ulong delayticks; ulong delayticks;

View file

@ -122,11 +122,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
timestamp = t;
}
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {
uint current; uint current;

View file

@ -170,11 +170,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
timestamp = time_to_tick(t);
}
/* delay x useconds AND preserve advance timstamp value */ /* delay x useconds AND preserve advance timstamp value */
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {

View file

@ -173,11 +173,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
timestamp = time_to_tick(t);
}
/* delay x useconds AND preserve advance timstamp value */ /* delay x useconds AND preserve advance timstamp value */
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {

View file

@ -76,11 +76,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
timestamp = t;
}
/* delay x useconds AND preserve advance timestamp value */ /* delay x useconds AND preserve advance timestamp value */
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {

View file

@ -129,11 +129,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
timestamp = t;
}
static inline ulong uboot_cntr_val(void) static inline ulong uboot_cntr_val(void)
{ {
return readl(CNTMR_VAL_REG(UBOOT_CNTR)); return readl(CNTMR_VAL_REG(UBOOT_CNTR));

View file

@ -119,11 +119,6 @@ ulong get_timer(ulong base)
base); base);
} }
void set_timer(ulong t)
{
gd->tbu = t;
}
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {
ulong delayticks; ulong delayticks;

View file

@ -87,11 +87,6 @@ ulong get_timer(ulong base)
return (get_timer_masked() / GPT_RESOLUTION) - base; return (get_timer_masked() / GPT_RESOLUTION) - base;
} }
void set_timer(ulong t)
{
timestamp = t;
}
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {
ulong tmo; ulong tmo;

View file

@ -105,11 +105,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
timestamp = t;
}
/* delay x useconds AND preserve advance timestamp value */ /* delay x useconds AND preserve advance timestamp value */
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {

View file

@ -99,11 +99,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
timestamp = t;
}
/* delay x useconds AND preserve advance timestamp value */ /* delay x useconds AND preserve advance timestamp value */
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {

View file

@ -73,11 +73,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
gd->tbl = t;
}
/* delay x useconds */ /* delay x useconds */
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {

View file

@ -60,11 +60,6 @@ unsigned long get_timer(unsigned long base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(unsigned long t)
{
gd->tbl = t;
}
/* delay x useconds */ /* delay x useconds */
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {

View file

@ -58,11 +58,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
gd->tbl = t;
}
/* delay x useconds */ /* delay x useconds */
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {

View file

@ -129,11 +129,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
gd->tbl = t;
}
/* /*
* Emulation of Power architecture long long timebase. * Emulation of Power architecture long long timebase.
* *

View file

@ -104,11 +104,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base; return get_timer_masked() - base;
} }
void set_timer(ulong t)
{
gd->timestamp = time_to_tick(t);
}
/* delay x useconds AND preserve advance timestamp value */ /* delay x useconds AND preserve advance timestamp value */
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {

View file

@ -85,11 +85,6 @@ ulong get_timer (ulong base)
return (get_timer_masked() - base); return (get_timer_masked() - base);
} }
void set_timer (ulong t)
{
timestamp = t;
}
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {
ulong tmo,tmp; ulong tmo,tmp;

View file

@ -74,11 +74,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
/* nop */
}
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {
udelay_masked (usec); udelay_masked (usec);

View file

@ -70,11 +70,6 @@ ulong get_timer (ulong base)
return get_timer_masked () - base; return get_timer_masked () - base;
} }
void set_timer (ulong t)
{
timestamp = t;
}
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {
ulong tmo; ulong tmo;

View file

@ -44,11 +44,6 @@ ulong get_timer (ulong base)
return get_timer_masked (); return get_timer_masked ();
} }
void set_timer (ulong t)
{
/* nop */
}
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {
udelay_masked (usec); udelay_masked (usec);

View file

@ -77,22 +77,6 @@ unsigned long get_timer(unsigned long base)
return (unsigned long)(now >> 32) - base; return (unsigned long)(now >> 32) - base;
} }
void set_timer(unsigned long t)
{
unsigned long long ticks = t;
unsigned long lo, hi, hi_new;
ticks = (ticks * get_tbclk()) / CONFIG_SYS_HZ;
hi = ticks >> 32;
lo = ticks & 0xffffffffUL;
do {
timer_overflow = hi;
sysreg_write(COUNT, lo);
hi_new = timer_overflow;
} while (hi_new != hi);
}
/* /*
* For short delays only. It will overflow after a few seconds. * For short delays only. It will overflow after a few seconds.
*/ */

View file

@ -105,8 +105,4 @@ ulong get_timer(ulong base)
return (timestamp - base); return (timestamp - base);
} }
void set_timer(ulong t)
{
timestamp = t;
}
#endif /* CONFIG_SLTTMR */ #endif /* CONFIG_SLTTMR */

View file

@ -574,8 +574,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
udelay (20); udelay (20);
set_timer (0);
/* Insert function pointers now that we have relocated the code */ /* Insert function pointers now that we have relocated the code */
/* Initialize from environment */ /* Initialize from environment */

View file

@ -126,10 +126,6 @@ ulong get_timer(ulong base)
return (timestamp - base); return (timestamp - base);
} }
void set_timer(ulong t)
{
timestamp = t;
}
#endif /* CONFIG_MCFTMR */ #endif /* CONFIG_MCFTMR */
#if defined(CONFIG_MCFPIT) #if defined(CONFIG_MCFPIT)
@ -173,14 +169,6 @@ void timer_init(void)
timerp->pcsr |= PIT_PCSR_PRE(CONFIG_SYS_PIT_PRESCALE) | PIT_PCSR_EN; timerp->pcsr |= PIT_PCSR_PRE(CONFIG_SYS_PIT_PRESCALE) | PIT_PCSR_EN;
} }
void set_timer(ulong t)
{
volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_PIT_BASE);
timestamp = 0;
timerp->pmr = lastinc = 0;
}
ulong get_timer(ulong base) ulong get_timer(ulong base)
{ {
unsigned short now, diff; unsigned short now, diff;
@ -196,8 +184,8 @@ ulong get_timer(ulong base)
void wait_ticks(unsigned long ticks) void wait_ticks(unsigned long ticks)
{ {
set_timer(0); u32 start = get_timer(0);
while (get_timer(0) < ticks) ; while (get_timer(start) < ticks) ;
} }
#endif /* CONFIG_MCFPIT */ #endif /* CONFIG_MCFPIT */

View file

@ -45,11 +45,6 @@ ulong get_timer (ulong base)
} }
#endif #endif
void set_timer (ulong t)
{
timestamp = t;
}
#ifdef CONFIG_SYS_INTC_0 #ifdef CONFIG_SYS_INTC_0
#ifdef CONFIG_SYS_TIMER_0 #ifdef CONFIG_SYS_TIMER_0
microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR); microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);

View file

@ -64,12 +64,6 @@ ulong get_timer(ulong base)
return (timestamp - base); return (timestamp - base);
} }
void set_timer(ulong t)
{
timestamp = t;
write_c0_compare(read_c0_count() + CYCLES_PER_JIFFY);
}
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {
unsigned int tmo; unsigned int tmo;

View file

@ -98,12 +98,6 @@ ulong get_timer (ulong base)
return (timestamp - base); return (timestamp - base);
} }
void set_timer (ulong t)
{
timestamp = t;
}
/* The board must handle this interrupt if a timer is not /* The board must handle this interrupt if a timer is not
* provided. * provided.
*/ */

View file

@ -932,8 +932,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
udelay (20); udelay (20);
set_timer (0);
/* Initialize from environment */ /* Initialize from environment */
if ((s = getenv ("loadaddr")) != NULL) { if ((s = getenv ("loadaddr")) != NULL) {
load_addr = simple_strtoul (s, NULL, 16); load_addr = simple_strtoul (s, NULL, 16);

View file

@ -146,8 +146,3 @@ ulong get_timer (ulong base)
{ {
return (timestamp - base); return (timestamp - base);
} }
void set_timer (ulong t)
{
timestamp = t;
}

View file

@ -139,15 +139,10 @@ unsigned long get_timer (unsigned long base)
return tick_to_time(get_ticks()) - base; return tick_to_time(get_ticks()) - base;
} }
void set_timer (unsigned long t)
{
writel((0 - t), TCNT0);
}
void reset_timer (void) void reset_timer (void)
{ {
tmu_timer_stop(0); tmu_timer_stop(0);
set_timer (0); writel(0, TCNT0);
tmu_timer_start(0); tmu_timer_start(0);
} }

View file

@ -54,7 +54,7 @@ int timer_init(void)
/* User Device 0 only */ /* User Device 0 only */
cmt_timer_stop(0); cmt_timer_stop(0);
set_timer(CMT_TIMER_RESET); writew(CMT_TIMER_RESET, CMCOR_0);
cmt_timer_start(0); cmt_timer_start(0);
return 0; return 0;
@ -90,15 +90,10 @@ ulong get_timer(ulong base)
return (get_usec() / 1000) - base; return (get_usec() / 1000) - base;
} }
void set_timer(ulong t)
{
writew((u16) t, CMCOR_0);
}
void reset_timer(void) void reset_timer(void)
{ {
cmt_timer_stop(0); cmt_timer_stop(0);
set_timer(CMT_TIMER_RESET); writew(CMT_TIMER_RESET, CMCOR_0);
cmt0_timer = 0; cmt0_timer = 0;
cmt_timer_start(0); cmt_timer_start(0);
} }

View file

@ -365,8 +365,6 @@ void board_init_f(ulong bootflag)
udelay(20); udelay(20);
set_timer(0);
/* Initialize from environment */ /* Initialize from environment */
if ((s = getenv("loadaddr")) != NULL) { if ((s = getenv("loadaddr")) != NULL) {
load_addr = simple_strtoul(s, NULL, 16); load_addr = simple_strtoul(s, NULL, 16);

View file

@ -100,11 +100,6 @@ ulong get_timer(ulong base)
return (timestamp - base); return (timestamp - base);
} }
void set_timer(ulong t)
{
timestamp = t;
}
void timer_interrupt_init(void) void timer_interrupt_init(void)
{ {
int irq; int irq;

View file

@ -363,8 +363,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
udelay(20); udelay(20);
set_timer (0);
/* Initialize from environment */ /* Initialize from environment */
if ((s = getenv ("loadaddr")) != NULL) { if ((s = getenv ("loadaddr")) != NULL) {
load_addr = simple_strtoul (s, NULL, 16); load_addr = simple_strtoul (s, NULL, 16);

View file

@ -103,8 +103,3 @@ ulong get_timer (ulong base)
{ {
return (system_ticks - base); return (system_ticks - base);
} }
void set_timer (ulong t)
{
system_ticks = t;
}

View file

@ -117,12 +117,6 @@ ulong get_timer (ulong base_ticks)
return get_timer_masked () - base_ticks; return get_timer_masked () - base_ticks;
} }
void set_timer (ulong ticks)
{
timestamp = ticks;
total_count = ticks * div_timer;
}
/* delay usec useconds */ /* delay usec useconds */
void __udelay (unsigned long usec) void __udelay (unsigned long usec)
{ {

View file

@ -587,7 +587,6 @@ void irq_install_handler(int, interrupt_handler_t *, void *);
void irq_free_handler (int); void irq_free_handler (int);
void reset_timer (void); void reset_timer (void);
ulong get_timer (ulong base); ulong get_timer (ulong base);
void set_timer (ulong t);
void enable_interrupts (void); void enable_interrupts (void);
int disable_interrupts (void); int disable_interrupts (void);