lib: time: add weak timer_init() function

If timer_init() is made a weak stub function, then it allows us to
remove several empty timer_init functions for those boards that
already have a timer initialized when u-boot starts. Architectures
that use the timer framework may also remove the need for timer.c.

Signed-off-by: Darwin Rambo <drambo@broadcom.com>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
This commit is contained in:
Darwin Rambo 2013-12-19 15:06:12 -08:00 committed by Tom Rini
parent f28bea0003
commit de351d6be6
6 changed files with 5 additions and 31 deletions

View File

@ -18,11 +18,6 @@
#include <asm/io.h> #include <asm/io.h>
#include <asm/arch/timer.h> #include <asm/arch/timer.h>
int timer_init(void)
{
return 0;
}
ulong get_timer_us(ulong base) ulong get_timer_us(ulong base)
{ {
struct bcm2835_timer_regs *regs = struct bcm2835_timer_regs *regs =

View File

@ -13,11 +13,6 @@
#include <common.h> #include <common.h>
#include <SA-1100.h> #include <SA-1100.h>
int timer_init (void)
{
return 0;
}
ulong get_timer (ulong base) ulong get_timer (ulong base)
{ {
return get_timer_masked (); return get_timer_masked ();

View File

@ -119,11 +119,6 @@ void dram_init_banksize(void)
get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE); get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE);
} }
int timer_init(void)
{
return 0;
}
/* /*
* Start timer: * Start timer:
* Setup a 32 bit timer, running at 1KHz * Setup a 32 bit timer, running at 1KHz

View File

@ -48,17 +48,6 @@ const struct tegra_sysinfo sysinfo = {
CONFIG_TEGRA_BOARD_STRING CONFIG_TEGRA_BOARD_STRING
}; };
#ifndef CONFIG_SPL_BUILD
/*
* Routine: timer_init
* Description: init the timestamp and lastinc value
*/
int timer_init(void)
{
return 0;
}
#endif
void __pin_mux_usb(void) void __pin_mux_usb(void)
{ {
} }

View File

@ -23,11 +23,6 @@ unsigned long timer_read_counter(void)
return os_get_nsec() / 1000; return os_get_nsec() / 1000;
} }
int timer_init(void)
{
return 0;
}
int dram_init(void) int dram_init(void)
{ {
gd->ram_size = CONFIG_SYS_SDRAM_SIZE; gd->ram_size = CONFIG_SYS_SDRAM_SIZE;

View File

@ -60,6 +60,11 @@ static unsigned long long notrace tick_to_time(uint64_t tick)
return tick; return tick;
} }
int __weak timer_init(void)
{
return 0;
}
ulong __weak get_timer(ulong base) ulong __weak get_timer(ulong base)
{ {
return tick_to_time(get_ticks()) - base; return tick_to_time(get_ticks()) - base;