* [U-Boot] [PATCH 3/5] arm: remove prototype for udelay_masked
2018-10-05 9:33 [U-Boot] [PATCH 0/5] arm: cleanup prototypes in u-boot-arm.h Patrick Delaunay
2018-10-05 9:33 ` [U-Boot] [PATCH 1/5] arm: remove prototype for arch_interrupt_init Patrick Delaunay
2018-10-05 9:33 ` [U-Boot] [PATCH 2/5] arm: remove prototype for reset_timer_masked Patrick Delaunay
@ 2018-10-05 9:33 ` Patrick Delaunay
2018-10-11 14:12 ` [U-Boot] [U-Boot,3/5] " Tom Rini
2018-10-05 9:33 ` [U-Boot] [PATCH 4/5] arm: remove prototype for get_timer_masked Patrick Delaunay
2018-10-05 9:33 ` [U-Boot] [PATCH 5/5] arm: remove duplicated prototypes in u-boot.arm.h Patrick Delaunay
4 siblings, 1 reply; 12+ messages in thread
From: Patrick Delaunay @ 2018-10-05 9:33 UTC (permalink / raw)
To: u-boot
The interruption support had be removed for ARM architecture and
the function udelay_masked() is no more used except in some timer.c
files and have the same content than udelay() or __udelay().
This patch update each timer.c implementing this function and
remove the associated prototype in u-boot-arm.h.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---
arch/arm/cpu/arm920t/imx/timer.c | 7 +------
arch/arm/cpu/arm926ejs/spear/timer.c | 5 -----
arch/arm/cpu/armv7/stv0991/timer.c | 5 -----
arch/arm/cpu/sa1100/timer.c | 7 +------
arch/arm/include/asm/u-boot-arm.h | 1 -
arch/arm/mach-at91/arm920t/timer.c | 7 +------
board/armltd/integrator/timer.c | 6 ------
7 files changed, 3 insertions(+), 35 deletions(-)
diff --git a/arch/arm/cpu/arm920t/imx/timer.c b/arch/arm/cpu/arm920t/imx/timer.c
index cd9b546..9289905 100644
--- a/arch/arm/cpu/arm920t/imx/timer.c
+++ b/arch/arm/cpu/arm920t/imx/timer.c
@@ -46,7 +46,7 @@ ulong get_timer_masked (void)
return TCN1;
}
-void udelay_masked (unsigned long usec)
+void __udelay (unsigned long usec)
{
ulong endtime = get_timer_masked() + usec;
signed long diff;
@@ -57,11 +57,6 @@ void udelay_masked (unsigned long usec)
} while (diff >= 0);
}
-void __udelay (unsigned long usec)
-{
- udelay_masked(usec);
-}
-
/*
* This function is derived from PowerPC code (read timebase as long long).
* On ARM it just returns the timer value.
diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c b/arch/arm/cpu/arm926ejs/spear/timer.c
index e9ba87a..a6637c0 100644
--- a/arch/arm/cpu/arm926ejs/spear/timer.c
+++ b/arch/arm/cpu/arm926ejs/spear/timer.c
@@ -98,11 +98,6 @@ ulong get_timer_masked(void)
return timestamp;
}
-void udelay_masked(unsigned long usec)
-{
- return udelay(usec);
-}
-
/*
* This function is derived from PowerPC code (read timebase as long long).
* On ARM it just returns the timer value.
diff --git a/arch/arm/cpu/armv7/stv0991/timer.c b/arch/arm/cpu/armv7/stv0991/timer.c
index 5784b06..2b1fd1b 100644
--- a/arch/arm/cpu/armv7/stv0991/timer.c
+++ b/arch/arm/cpu/armv7/stv0991/timer.c
@@ -89,11 +89,6 @@ ulong get_timer_masked(void)
return timestamp;
}
-void udelay_masked(unsigned long usec)
-{
- return udelay(usec);
-}
-
/*
* This function is derived from PowerPC code (read timebase as long long).
* On ARM it just returns the timer value.
diff --git a/arch/arm/cpu/sa1100/timer.c b/arch/arm/cpu/sa1100/timer.c
index 12514e4..c7829c9 100644
--- a/arch/arm/cpu/sa1100/timer.c
+++ b/arch/arm/cpu/sa1100/timer.c
@@ -17,17 +17,12 @@ ulong get_timer (ulong base)
return get_timer_masked ();
}
-void __udelay (unsigned long usec)
-{
- udelay_masked (usec);
-}
-
ulong get_timer_masked (void)
{
return OSCR;
}
-void udelay_masked (unsigned long usec)
+void __udelay (unsigned long usec)
{
ulong tmo;
ulong endtime;
diff --git a/arch/arm/include/asm/u-boot-arm.h b/arch/arm/include/asm/u-boot-arm.h
index f1da115..97983de 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -40,7 +40,6 @@ int board_init(void);
/* cpu/.../interrupt.c */
ulong get_timer_masked (void);
-void udelay_masked (unsigned long usec);
/* calls to c from vectors.S */
struct pt_regs;
diff --git a/arch/arm/mach-at91/arm920t/timer.c b/arch/arm/mach-at91/arm920t/timer.c
index bbe90ae..6a98d7c 100644
--- a/arch/arm/mach-at91/arm920t/timer.c
+++ b/arch/arm/mach-at91/arm920t/timer.c
@@ -58,11 +58,6 @@ ulong get_timer(ulong base)
return get_timer_masked() - base;
}
-void __udelay(unsigned long usec)
-{
- udelay_masked(usec);
-}
-
ulong get_timer_raw(void)
{
at91_tc_t *tc = (at91_tc_t *) ATMEL_BASE_TC;
@@ -87,7 +82,7 @@ ulong get_timer_masked(void)
return get_timer_raw()/TIMER_LOAD_VAL;
}
-void udelay_masked(unsigned long usec)
+void __udelay(unsigned long usec)
{
u32 tmo;
u32 endtime;
diff --git a/board/armltd/integrator/timer.c b/board/armltd/integrator/timer.c
index 3063884..53086c7 100644
--- a/board/armltd/integrator/timer.c
+++ b/board/armltd/integrator/timer.c
@@ -138,12 +138,6 @@ ulong get_timer_masked (void)
return timestamp;
}
-/* waits specified delay value and resets timestamp */
-void udelay_masked (unsigned long usec)
-{
- udelay(usec);
-}
-
/*
* This function is derived from PowerPC code (read timebase as long long).
* On ARM it just returns the timer value.
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 4/5] arm: remove prototype for get_timer_masked
2018-10-05 9:33 [U-Boot] [PATCH 0/5] arm: cleanup prototypes in u-boot-arm.h Patrick Delaunay
` (2 preceding siblings ...)
2018-10-05 9:33 ` [U-Boot] [PATCH 3/5] arm: remove prototype for udelay_masked Patrick Delaunay
@ 2018-10-05 9:33 ` Patrick Delaunay
2018-10-10 9:15 ` Linus Walleij
2018-10-11 14:12 ` [U-Boot] [U-Boot, " Tom Rini
2018-10-05 9:33 ` [U-Boot] [PATCH 5/5] arm: remove duplicated prototypes in u-boot.arm.h Patrick Delaunay
4 siblings, 2 replies; 12+ messages in thread
From: Patrick Delaunay @ 2018-10-05 9:33 UTC (permalink / raw)
To: u-boot
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>
---
arch/arm/cpu/arm920t/ep93xx/timer.c | 7 +----
arch/arm/cpu/arm920t/imx/timer.c | 8 +++---
arch/arm/cpu/arm926ejs/armada100/timer.c | 2 +-
arch/arm/cpu/arm926ejs/mx27/timer.c | 2 +-
arch/arm/cpu/arm926ejs/mxs/timer.c | 7 +----
arch/arm/cpu/arm926ejs/spear/timer.c | 4 ++-
arch/arm/cpu/armv7/ls102xa/timer.c | 7 +----
arch/arm/cpu/armv7/stv0991/timer.c | 4 ++-
arch/arm/cpu/armv7/sunxi/timer.c | 12 ++++-----
arch/arm/cpu/armv7/vf610/timer.c | 7 +----
arch/arm/cpu/sa1100/timer.c | 8 +++---
arch/arm/include/asm/u-boot-arm.h | 3 ---
arch/arm/mach-at91/arm920t/timer.c | 12 ++++-----
arch/arm/mach-imx/syscounter.c | 7 +----
arch/arm/mach-omap2/timer.c | 3 ++-
arch/arm/mach-orion5x/timer.c | 2 +-
board/armltd/integrator/timer.c | 45 ++++++++++++++++----------------
17 files changed, 59 insertions(+), 81 deletions(-)
diff --git a/arch/arm/cpu/arm920t/ep93xx/timer.c b/arch/arm/cpu/arm920t/ep93xx/timer.c
index 5f3609a..49bf49b 100644
--- a/arch/arm/cpu/arm920t/ep93xx/timer.c
+++ b/arch/arm/cpu/arm920t/ep93xx/timer.c
@@ -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)
diff --git a/arch/arm/cpu/arm920t/imx/timer.c b/arch/arm/cpu/arm920t/imx/timer.c
index 9289905..96fff3f 100644
--- a/arch/arm/cpu/arm920t/imx/timer.c
+++ b/arch/arm/cpu/arm920t/imx/timer.c
@@ -36,14 +36,14 @@ int timer_init (void)
/*
* timer without interrupts
*/
-ulong get_timer (ulong base)
+static ulong get_timer_masked (void)
{
- return get_timer_masked() - base;
+ return TCN1;
}
-ulong get_timer_masked (void)
+ulong get_timer (ulong base)
{
- return TCN1;
+ return get_timer_masked() - base;
}
void __udelay (unsigned long usec)
diff --git a/arch/arm/cpu/arm926ejs/armada100/timer.c b/arch/arm/cpu/arm926ejs/armada100/timer.c
index f10f678..d2ecbd0 100644
--- a/arch/arm/cpu/arm926ejs/armada100/timer.c
+++ b/arch/arm/cpu/arm926ejs/armada100/timer.c
@@ -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();
diff --git a/arch/arm/cpu/arm926ejs/mx27/timer.c b/arch/arm/cpu/arm926ejs/mx27/timer.c
index 9399320..94b5d45 100644
--- a/arch/arm/cpu/arm926ejs/mx27/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx27/timer.c
@@ -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
diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c b/arch/arm/cpu/arm926ejs/mxs/timer.c
index 517cadb..7492ba4 100644
--- a/arch/arm/cpu/arm926ejs/mxs/timer.c
+++ b/arch/arm/cpu/arm926ejs/mxs/timer.c
@@ -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. */
diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c b/arch/arm/cpu/arm926ejs/spear/timer.c
index a6637c0..e7b5bda 100644
--- a/arch/arm/cpu/arm926ejs/spear/timer.c
+++ b/arch/arm/cpu/arm926ejs/spear/timer.c
@@ -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();
diff --git a/arch/arm/cpu/armv7/ls102xa/timer.c b/arch/arm/cpu/armv7/ls102xa/timer.c
index 35a557b..e79360a 100644
--- a/arch/arm/cpu/armv7/ls102xa/timer.c
+++ b/arch/arm/cpu/armv7/ls102xa/timer.c
@@ -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 */
diff --git a/arch/arm/cpu/armv7/stv0991/timer.c b/arch/arm/cpu/armv7/stv0991/timer.c
index 2b1fd1b..d1b763d 100644
--- a/arch/arm/cpu/armv7/stv0991/timer.c
+++ b/arch/arm/cpu/armv7/stv0991/timer.c
@@ -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();
diff --git a/arch/arm/cpu/armv7/sunxi/timer.c b/arch/arm/cpu/armv7/sunxi/timer.c
index 0f8ab0e..304c1ac 100644
--- a/arch/arm/cpu/armv7/sunxi/timer.c
+++ b/arch/arm/cpu/armv7/sunxi/timer.c
@@ -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)
{
diff --git a/arch/arm/cpu/armv7/vf610/timer.c b/arch/arm/cpu/armv7/vf610/timer.c
index 6e1308e..821a279 100644
--- a/arch/arm/cpu/armv7/vf610/timer.c
+++ b/arch/arm/cpu/armv7/vf610/timer.c
@@ -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 */
diff --git a/arch/arm/cpu/sa1100/timer.c b/arch/arm/cpu/sa1100/timer.c
index c7829c9..0fac5c1 100644
--- a/arch/arm/cpu/sa1100/timer.c
+++ b/arch/arm/cpu/sa1100/timer.c
@@ -12,14 +12,14 @@
#include <common.h>
#include <SA-1100.h>
-ulong get_timer (ulong base)
+static ulong get_timer_masked (void)
{
- return get_timer_masked ();
+ return OSCR;
}
-ulong get_timer_masked (void)
+ulong get_timer (ulong base)
{
- return OSCR;
+ return get_timer_masked ();
}
void __udelay (unsigned long usec)
diff --git a/arch/arm/include/asm/u-boot-arm.h b/arch/arm/include/asm/u-boot-arm.h
index 97983de..2eaefb4 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -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;
diff --git a/arch/arm/mach-at91/arm920t/timer.c b/arch/arm/mach-at91/arm920t/timer.c
index 6a98d7c..6db541a 100644
--- a/arch/arm/mach-at91/arm920t/timer.c
+++ b/arch/arm/mach-at91/arm920t/timer.c
@@ -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;
diff --git a/arch/arm/mach-imx/syscounter.c b/arch/arm/mach-imx/syscounter.c
index 676bb3c..34bdb95 100644
--- a/arch/arm/mach-imx/syscounter.c
+++ b/arch/arm/mach-imx/syscounter.c
@@ -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)
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 847f33d..87b674e 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -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);
diff --git a/arch/arm/mach-orion5x/timer.c b/arch/arm/mach-orion5x/timer.c
index 92725d3..6aaf94a 100644
--- a/arch/arm/mach-orion5x/timer.c
+++ b/arch/arm/mach-orion5x/timer.c
@@ -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();
diff --git a/board/armltd/integrator/timer.c b/board/armltd/integrator/timer.c
index 53086c7..7ecfa49 100644
--- a/board/armltd/integrator/timer.c
+++ b/board/armltd/integrator/timer.c
@@ -93,31 +93,10 @@ int timer_init (void)
/*
* timer without interrupts
*/
-ulong get_timer (ulong base_ticks)
-{
- return get_timer_masked () - base_ticks;
-}
-
-/* delay usec useconds */
-void __udelay (unsigned long usec)
-{
- ulong tmo, tmp;
-
- /* Convert to U-Boot ticks */
- tmo = usec * CONFIG_SYS_HZ;
- tmo /= (1000000L);
-
- tmp = get_timer_masked(); /* get current timestamp */
- tmo += tmp; /* form target timestamp */
-
- while (get_timer_masked () < tmo) {/* loop till event */
- /*NOP*/;
- }
-}
/* converts the timer reading to U-Boot ticks */
/* the timestamp is the number of ticks since reset */
-ulong get_timer_masked (void)
+static ulong get_timer_masked (void)
{
/* get current count */
unsigned long long now = READ_TIMER;
@@ -138,6 +117,28 @@ ulong get_timer_masked (void)
return timestamp;
}
+ulong get_timer (ulong base_ticks)
+{
+ return get_timer_masked () - base_ticks;
+}
+
+/* delay usec useconds */
+void __udelay (unsigned long usec)
+{
+ ulong tmo, tmp;
+
+ /* Convert to U-Boot ticks */
+ tmo = usec * CONFIG_SYS_HZ;
+ tmo /= (1000000L);
+
+ tmp = get_timer_masked(); /* get current timestamp */
+ tmo += tmp; /* form target timestamp */
+
+ while (get_timer_masked () < tmo) {/* loop till event */
+ /*NOP*/;
+ }
+}
+
/*
* This function is derived from PowerPC code (read timebase as long long).
* On ARM it just returns the timer value.
--
2.7.4
^ permalink raw reply related [flat|nested] 12+ messages in thread