Skip to content

Commit d86ad46

Browse files
tmlindarndb
authored andcommitted
ARM: OMAP2+: Fix regression for using local timer on non-SMP SoCs
On am437x we use also an ARM timer in addition to the dmtimer. As am437x is not an SMP SoC, we need tick_broadcast() implemented. With the recent dmtimer changes, Arnd started to see link failures for non-SMP am437x configuration: kernel/time/tick-broadcast.o: in function `tick_device_uses_broadcast': tick-broadcast.c:(.text+0x130): undefined reference to `tick_broadcast' Let's fix the issue by reverting dmtimer related changes that started building timer.c only for CONFIG_SOC_HAS_REALTIME_COUNTER. We still always need timer.c built-in for omap5 and dra7 for timer_probe(). And let's also move am437x tick_broadcast() to board-generic.c as that's where we now call timer_probe() for am437x. This way we avoid adding back more ifdefs to timer.c. Fixes: 2ee04b8 ("ARM: OMAP2+: Drop old timer code for dmtimer and 32k counter") Reported-by: Arnd Bergmann <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent 5f55f1f commit d86ad46

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

arch/arm/mach-omap2/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ hwmod-common = omap_hwmod.o omap_hwmod_reset.o \
1616
clock-common = clock.o
1717
secure-common = omap-smc.o omap-secure.o
1818

19-
obj-$(CONFIG_SOC_HAS_REALTIME_COUNTER) += timer.o
20-
2119
obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
2220
obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
2321
obj-$(CONFIG_ARCH_OMAP4) += $(hwmod-common) $(secure-common)
@@ -48,6 +46,10 @@ obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common) $(smp-y) sleep44xx.o
4846
obj-$(CONFIG_SOC_AM43XX) += $(omap-4-5-common)
4947
obj-$(CONFIG_SOC_DRA7XX) += $(omap-4-5-common) $(smp-y) sleep44xx.o
5048

49+
omap5-dra7-common = timer.o
50+
obj-$(CONFIG_SOC_OMAP5) += $(omap5-dra7-common)
51+
obj-$(CONFIG_SOC_DRA7XX) += $(omap5-dra7-common)
52+
5153
# Functions loaded to SRAM
5254
obj-$(CONFIG_SOC_OMAP2420) += sram242x.o
5355
obj-$(CONFIG_SOC_OMAP2430) += sram243x.o

arch/arm/mach-omap2/board-generic.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ void __init __maybe_unused omap_init_time_of(void)
3939
timer_probe();
4040
}
4141

42+
/* Used by am437x for ARM timer in non-SMP configurations */
43+
#if !defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
44+
void tick_broadcast(const struct cpumask *mask)
45+
{
46+
}
47+
#endif
48+
4249
#ifdef CONFIG_SOC_OMAP2420
4350
static const char *const omap242x_boards_compat[] __initconst = {
4451
"ti,omap2420",

arch/arm/mach-omap2/timer.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,15 @@
3939
#define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14
4040
#define NUMERATOR_DENUMERATOR_MASK 0xfffff000
4141

42+
#ifdef CONFIG_SOC_HAS_REALTIME_COUNTER
43+
4244
static unsigned long arch_timer_freq;
4345

4446
void set_cntfreq(void)
4547
{
4648
omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq);
4749
}
4850

49-
#if !defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
50-
void tick_broadcast(const struct cpumask *mask)
51-
{
52-
}
53-
#endif
54-
55-
#if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
56-
5751
/*
5852
* The realtime counter also called master counter, is a free-running
5953
* counter, which is related to real time. It produces the count used
@@ -165,11 +159,18 @@ static void __init realtime_counter_init(void)
165159
iounmap(base);
166160
}
167161

162+
#else
163+
164+
static inline void realtime_counter_init(void)
165+
{
166+
}
167+
168+
#endif /* CONFIG_SOC_HAS_REALTIME_COUNTER */
169+
168170
void __init omap5_realtime_timer_init(void)
169171
{
170172
omap_clk_init();
171173
realtime_counter_init();
172174

173175
timer_probe();
174176
}
175-
#endif /* CONFIG_SOC_OMAP5 || CONFIG_SOC_DRA7XX */

0 commit comments

Comments
 (0)