arm: remove prototype for get_timer_masked

The interruption support had be removed for ARM architecture and
the function get_timer_masked() is no more used except in some
the timer.c files.

This patch clean each timer.c which implement this function and
remove the associated prototype in u-boot-arm.h

For timer.c, I don't verify if the weak version of get_timer
(in lib/time.c) can be used

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
Patrick Delaunay 2018-10-05 11:33:52 +02:00 committed by Tom Rini
parent aa33fe8695
commit 6180ea7e66
17 changed files with 62 additions and 84 deletions

View File

@ -66,14 +66,9 @@ unsigned long long get_ticks(void)
return sys_ticks;
}
unsigned long get_timer_masked(void)
{
return get_ticks();
}
unsigned long get_timer(unsigned long base)
{
return get_timer_masked() - base;
return get_ticks() - base;
}
void __udelay(unsigned long usec)

View File

@ -36,16 +36,16 @@ int timer_init (void)
/*
* timer without interrupts
*/
static ulong get_timer_masked (void)
{
return TCN1;
}
ulong get_timer (ulong base)
{
return get_timer_masked() - base;
}
ulong get_timer_masked (void)
{
return TCN1;
}
void __udelay (unsigned long usec)
{
ulong endtime = get_timer_masked() + usec;

View File

@ -61,7 +61,7 @@ ulong read_timer(void)
return(readl(&armd1timers->cvwr));
}
ulong get_timer_masked(void)
static ulong get_timer_masked(void)
{
ulong now = read_timer();

View File

@ -126,7 +126,7 @@ unsigned long long get_ticks(void)
return timestamp;
}
ulong get_timer_masked(void)
static ulong get_timer_masked(void)
{
/*
* get_ticks() returns a long long (64 bit), it wraps in

View File

@ -110,14 +110,9 @@ unsigned long long get_ticks(void)
return timestamp;
}
ulong get_timer_masked(void)
{
return tick_to_time(get_ticks());
}
ulong get_timer(ulong base)
{
return get_timer_masked() - base;
return tick_to_time(get_ticks()) - base;
}
/* We use the HW_DIGCTL_MICROSECONDS register for sub-millisecond timer. */

View File

@ -21,6 +21,8 @@ static struct misc_regs *const misc_regs_p =
DECLARE_GLOBAL_DATA_PTR;
static ulong get_timer_masked(void);
#define timestamp gd->arch.tbl
#define lastdec gd->arch.lastinc
@ -82,7 +84,7 @@ void __udelay(unsigned long usec)
;
}
ulong get_timer_masked(void)
static ulong get_timer_masked(void)
{
ulong now = READ_TIMER();

View File

@ -90,14 +90,9 @@ unsigned long long get_ticks(void)
return now;
}
unsigned long get_timer_masked(void)
{
return tick_to_time(get_ticks());
}
unsigned long get_timer(ulong base)
{
return get_timer_masked() - base;
return tick_to_time(get_ticks()) - base;
}
/* delay x useconds and preserve advance timstamp value */

View File

@ -21,6 +21,8 @@ DECLARE_GLOBAL_DATA_PTR;
#define timestamp gd->arch.tbl
#define lastdec gd->arch.lastinc
static ulong get_timer_masked(void);
int timer_init(void)
{
/* Timer1 clock configuration */
@ -73,7 +75,7 @@ void __udelay(unsigned long usec)
;
}
ulong get_timer_masked(void)
static ulong get_timer_masked(void)
{
ulong now = READ_TIMER();

View File

@ -55,12 +55,7 @@ int timer_init(void)
}
/* timer without interrupts */
ulong get_timer(ulong base)
{
return get_timer_masked() - base;
}
ulong get_timer_masked(void)
static ulong get_timer_masked(void)
{
/* current tick value */
ulong now = TICKS_TO_HZ(read_timer());
@ -77,6 +72,11 @@ ulong get_timer_masked(void)
return gd->arch.tbl;
}
ulong get_timer(ulong base)
{
return get_timer_masked() - base;
}
/* delay x useconds */
void __udelay(unsigned long usec)
{

View File

@ -57,14 +57,9 @@ unsigned long long get_ticks(void)
return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl;
}
ulong get_timer_masked(void)
{
return tick_to_time(get_ticks());
}
ulong get_timer(ulong base)
{
return get_timer_masked() - base;
return tick_to_time(get_ticks()) - base;
}
/* delay x useconds AND preserve advance timstamp value */

View File

@ -12,16 +12,16 @@
#include <common.h>
#include <SA-1100.h>
static ulong get_timer_masked (void)
{
return OSCR;
}
ulong get_timer (ulong base)
{
return get_timer_masked ();
}
ulong get_timer_masked (void)
{
return OSCR;
}
void __udelay (unsigned long usec)
{
ulong tmo;

View File

@ -38,9 +38,6 @@ int arch_early_init_r(void);
/* board/.../... */
int board_init(void);
/* cpu/.../interrupt.c */
ulong get_timer_masked (void);
/* calls to c from vectors.S */
struct pt_regs;

View File

@ -53,11 +53,6 @@ int timer_init(void)
/*
* timer without interrupts
*/
ulong get_timer(ulong base)
{
return get_timer_masked() - base;
}
ulong get_timer_raw(void)
{
at91_tc_t *tc = (at91_tc_t *) ATMEL_BASE_TC;
@ -77,11 +72,16 @@ ulong get_timer_raw(void)
return gd->arch.tbl;
}
ulong get_timer_masked(void)
static ulong get_timer_masked(void)
{
return get_timer_raw()/TIMER_LOAD_VAL;
}
ulong get_timer(ulong base)
{
return get_timer_masked() - base;
}
void __udelay(unsigned long usec)
{
u32 tmo;

View File

@ -89,14 +89,9 @@ unsigned long long get_ticks(void)
return now;
}
ulong get_timer_masked(void)
{
return tick_to_time(get_ticks());
}
ulong get_timer(ulong base)
{
return get_timer_masked() - base;
return tick_to_time(get_ticks()) - base;
}
void __udelay(unsigned long usec)

View File

@ -23,6 +23,7 @@
DECLARE_GLOBAL_DATA_PTR;
static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
static ulong get_timer_masked(void);
/*
* Nothing really to do with interrupts, just starts up a counter.
@ -67,7 +68,7 @@ void __udelay(unsigned long usec)
}
}
ulong get_timer_masked(void)
static ulong get_timer_masked(void)
{
/* current tick value */
ulong now = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);

View File

@ -78,7 +78,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define timestamp gd->arch.tbl
#define lastdec gd->arch.lastinc
ulong get_timer_masked(void)
static ulong get_timer_masked(void)
{
ulong now = read_timer();

View File

@ -93,6 +93,30 @@ int timer_init (void)
/*
* timer without interrupts
*/
/* converts the timer reading to U-Boot ticks */
/* the timestamp is the number of ticks since reset */
static ulong get_timer_masked (void)
{
/* get current count */
unsigned long long now = READ_TIMER;
if(now > lastdec) {
/* Must have wrapped */
total_count += lastdec + TIMER_LOAD_VAL + 1 - now;
} else {
total_count += lastdec - now;
}
lastdec = now;
/* Reuse "now" */
now = total_count;
do_div(now, div_timer);
timestamp = now;
return timestamp;
}
ulong get_timer (ulong base_ticks)
{
return get_timer_masked () - base_ticks;
@ -115,29 +139,6 @@ void __udelay (unsigned long usec)
}
}
/* converts the timer reading to U-Boot ticks */
/* the timestamp is the number of ticks since reset */
ulong get_timer_masked (void)
{
/* get current count */
unsigned long long now = READ_TIMER;
if(now > lastdec) {
/* Must have wrapped */
total_count += lastdec + TIMER_LOAD_VAL + 1 - now;
} else {
total_count += lastdec - now;
}
lastdec = now;
/* Reuse "now" */
now = total_count;
do_div(now, div_timer);
timestamp = now;
return timestamp;
}
/*
* This function is derived from PowerPC code (read timebase as long long).
* On ARM it just returns the timer value.