[PATCH] [v2] ARM: omap2: fix omap5_realtime_timer_init definition

From: Arnd Bergmann
Date: Fri May 29 2020 - 18:00:51 EST


There is one more regression introduced by the last build fix:

arch/arm/mach-omap2/timer.c:170:6: error: attribute declaration must precede definition [-Werror,-Wignored-attributes]
void __init omap5_realtime_timer_init(void)
^
arch/arm/mach-omap2/common.h:118:20: note: previous definition is here
static inline void omap5_realtime_timer_init(void)
^
arch/arm/mach-omap2/timer.c:170:13: error: redefinition of 'omap5_realtime_timer_init'
void __init omap5_realtime_timer_init(void)
^
arch/arm/mach-omap2/common.h:118:20: note: previous definition is here
static inline void omap5_realtime_timer_init(void)

As it turns out, the CONFIG_SOC_HAS_REALTIME_COUNTER option
should never be disabled for OMAP5 as we realy on this to initialize
the clocks and the timer. Just remove it here and make it the default.

Removing the guard around the set_cntfreq() definition, I noticed that
this is not properly namespaced, so fix that as well.

Fixes: d86ad463d670 ("ARM: OMAP2+: Fix regression for using local timer on non-SMP SoCs")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
I'll let this run randconfig builds overnight to be sure it doesn't
cause another regression.
---
arch/arm/mach-omap2/Kconfig | 5 -----
arch/arm/mach-omap2/common.h | 6 ------
arch/arm/mach-omap2/omap-secure.h | 9 +--------
arch/arm/mach-omap2/omap-smp.c | 2 +-
arch/arm/mach-omap2/timer.c | 14 ++------------
5 files changed, 4 insertions(+), 32 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index ca74473f01df..87fb4df4cf72 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -145,11 +145,6 @@ config ARCH_OMAP2PLUS_TYPICAL
config SOC_HAS_OMAP2_SDRC
bool "OMAP2 SDRAM Controller support"

-config SOC_HAS_REALTIME_COUNTER
- bool "Real time free running counter"
- depends on SOC_OMAP5 || SOC_DRA7XX
- default y
-
config POWER_AVS_OMAP
bool "AVS(Adaptive Voltage Scaling) support for OMAP IP versions 1&2"
depends on POWER_AVS && (ARCH_OMAP3 || ARCH_OMAP4) && PM
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 49926eced5f1..70e3d6df4cb6 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -112,13 +112,7 @@ static inline int omap_l2_cache_init(void)
#define omap4_l2c310_write_sec NULL
#endif

-#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
extern void omap5_realtime_timer_init(void);
-#else
-static inline void omap5_realtime_timer_init(void)
-{
-}
-#endif

void omap2420_init_early(void);
void omap2430_init_early(void);
diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h
index 4aaa95706d39..fbc02bb639c4 100644
--- a/arch/arm/mach-omap2/omap-secure.h
+++ b/arch/arm/mach-omap2/omap-secure.h
@@ -81,14 +81,7 @@ extern u32 rx51_secure_rng_call(u32 ptr, u32 count, u32 flag);

extern bool optee_available;
void omap_secure_init(void);
-
-#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
-void set_cntfreq(void);
-#else
-static inline void set_cntfreq(void)
-{
-}
-#endif
+void omap5_set_cntfreq(void);

#endif /* __ASSEMBLER__ */
#endif /* OMAP_ARCH_OMAP_SECURE_H */
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 570a987e6d1a..f35d5642122a 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -162,7 +162,7 @@ static void omap4_secondary_init(unsigned int cpu)
* Configure the CNTFRQ register for the secondary cpu's which
* indicates the frequency of the cpu local timers.
*/
- set_cntfreq();
+ omap5_set_cntfreq();
/* Configure ACR to disable streaming WA for 801819 */
omap5_erratum_workaround_801819();
/* Enable ACR to allow for ICUALLU workaround */
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index c1737e737a94..9b7b1240de81 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -39,11 +39,9 @@
#define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14
#define NUMERATOR_DENUMERATOR_MASK 0xfffff000

-#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
-
static unsigned long arch_timer_freq;

-void set_cntfreq(void)
+void omap5_set_cntfreq(void)
{
omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq);
}
@@ -154,19 +152,11 @@ static void __init realtime_counter_init(void)
writel_relaxed(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);

arch_timer_freq = DIV_ROUND_UP_ULL(rate * num, den);
- set_cntfreq();
+ omap5_set_cntfreq();

iounmap(base);
}

-#else
-
-static inline void realtime_counter_init(void)
-{
-}
-
-#endif /* CONFIG_SOC_HAS_REALTIME_COUNTER */
-
void __init omap5_realtime_timer_init(void)
{
omap_clk_init();
--
2.26.2