From: Darwin Rambo Date: Thu, 19 Dec 2013 23:06:12 +0000 (-0800) Subject: lib: time: add weak timer_init() function X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=de351d6be6868270db21ed8a0f89d3ef703bc18e;p=u-boot.git 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 Reviewed-by: Tim Kryger --- diff --git a/arch/arm/cpu/arm1176/bcm2835/timer.c b/arch/arm/cpu/arm1176/bcm2835/timer.c index 2edd6711da..017907cfb8 100644 --- a/arch/arm/cpu/arm1176/bcm2835/timer.c +++ b/arch/arm/cpu/arm1176/bcm2835/timer.c @@ -18,11 +18,6 @@ #include #include -int timer_init(void) -{ - return 0; -} - ulong get_timer_us(ulong base) { struct bcm2835_timer_regs *regs = diff --git a/arch/arm/cpu/sa1100/timer.c b/arch/arm/cpu/sa1100/timer.c index 4b981e46e7..0a0006b426 100644 --- a/arch/arm/cpu/sa1100/timer.c +++ b/arch/arm/cpu/sa1100/timer.c @@ -13,11 +13,6 @@ #include #include -int timer_init (void) -{ - return 0; -} - ulong get_timer (ulong base) { return get_timer_masked (); diff --git a/board/armltd/vexpress/vexpress_common.c b/board/armltd/vexpress/vexpress_common.c index da5cb0152b..cb2de2f4dd 100644 --- a/board/armltd/vexpress/vexpress_common.c +++ b/board/armltd/vexpress/vexpress_common.c @@ -119,11 +119,6 @@ void dram_init_banksize(void) get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE); } -int timer_init(void) -{ - return 0; -} - /* * Start timer: * Setup a 32 bit timer, running at 1KHz diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c index 1972527e7d..e650feda48 100644 --- a/board/nvidia/common/board.c +++ b/board/nvidia/common/board.c @@ -48,17 +48,6 @@ const struct tegra_sysinfo sysinfo = { 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) { } diff --git a/board/sandbox/sandbox/sandbox.c b/board/sandbox/sandbox/sandbox.c index 65dcce804b..95efaffcb1 100644 --- a/board/sandbox/sandbox/sandbox.c +++ b/board/sandbox/sandbox/sandbox.c @@ -23,11 +23,6 @@ unsigned long timer_read_counter(void) return os_get_nsec() / 1000; } -int timer_init(void) -{ - return 0; -} - int dram_init(void) { gd->ram_size = CONFIG_SYS_SDRAM_SIZE; diff --git a/lib/time.c b/lib/time.c index 8085aa40d1..73c3b6ad7f 100644 --- a/lib/time.c +++ b/lib/time.c @@ -60,6 +60,11 @@ static unsigned long long notrace tick_to_time(uint64_t tick) return tick; } +int __weak timer_init(void) +{ + return 0; +} + ulong __weak get_timer(ulong base) { return tick_to_time(get_ticks()) - base;