linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] arm: omap2: AM43xx: enable ARM TWD timer
@ 2015-12-14 20:34 Grygorii Strashko
  2015-12-14 20:34 ` [PATCH 1/2] ARM: OMAP: am43xx: enable GENERIC_CLOCKEVENTS_BROADCAST Grygorii Strashko
  2015-12-14 20:34 ` [PATCH v2 2/2] arm: omap2: AM43xx: select ARM TWD timer Grygorii Strashko
  0 siblings, 2 replies; 4+ messages in thread
From: Grygorii Strashko @ 2015-12-14 20:34 UTC (permalink / raw)
  To: Felipe Balbi, Tony Lindgren
  Cc: Grygorii Strashko, linux-omap, nsekhar, linux-arm-kernel,
	Santosh Shilimkar

Now ARM TWD timer can be enabled for AM437x devices since all prerequisite
patches have been merged already [1] [2].

But before finally enable ARM TWD timer for UP AM437x devices - 
the Broadcast event source and infrustructure need to be enabled properly.
Otherwise CPUIdle will be broken.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-August/363989.html
[2] http://www.spinics.net/lists/linux-omap/msg123940.html
Felipe Balbi (1):
  arm: omap2: AM43xx: select ARM TWD timer

Grygorii Strashko (1):
  ARM: OMAP: am43xx: enable GENERIC_CLOCKEVENTS_BROADCAST

 arch/arm/mach-omap2/Kconfig | 2 ++
 arch/arm/mach-omap2/timer.c | 6 ++++++
 2 files changed, 8 insertions(+)

-- 
2.6.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ARM: OMAP: am43xx: enable GENERIC_CLOCKEVENTS_BROADCAST
  2015-12-14 20:34 [PATCH 0/2] arm: omap2: AM43xx: enable ARM TWD timer Grygorii Strashko
@ 2015-12-14 20:34 ` Grygorii Strashko
  2015-12-21 19:13   ` Tony Lindgren
  2015-12-14 20:34 ` [PATCH v2 2/2] arm: omap2: AM43xx: select ARM TWD timer Grygorii Strashko
  1 sibling, 1 reply; 4+ messages in thread
From: Grygorii Strashko @ 2015-12-14 20:34 UTC (permalink / raw)
  To: Felipe Balbi, Tony Lindgren
  Cc: Grygorii Strashko, linux-omap, nsekhar, linux-arm-kernel,
	Santosh Shilimkar

System will misbehave in the following case:
- AM43XX only build (UP);
- CONFIG_CPU_IDLE=y
- ARM TWD timer enabled and selected as clockevent device.

In the above case, It's expected that broadcast timer will be used as
backup timer when CPUIdle will put MPU in low power states where ARM
TWD will stop and lose its context. But, the CONFIG_SMP might not be
selected when kernel is built for AM43XX SoC only and, as result,
GENERIC_CLOCKEVENTS_BROADCAST option will not be selected also. This
will break CPUIdle and System will stuck in low power states.

Hence, fix it by selecting GENERIC_CLOCKEVENTS_BROADCAST option for
AM43XX SoCs always and add empty tick_broadcast() function
implementation - no need to send any IPI on UP. After this change
timer1 will be selected as broadcast timer the same way as for SMP,
and CPUIdle will work properly.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 arch/arm/mach-omap2/Kconfig | 1 +
 arch/arm/mach-omap2/timer.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4b4371d..32a0086 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -65,6 +65,7 @@ config SOC_AM43XX
 	select MACH_OMAP_GENERIC
 	select MIGHT_HAVE_CACHE_L2X0
 	select HAVE_ARM_SCU
+	select GENERIC_CLOCKEVENTS_BROADCAST
 
 config SOC_DRA7XX
 	bool "TI DRA7XX"
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index 3bfde44..f34a809 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -320,6 +320,12 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
 	return r;
 }
 
+#if !defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
+void tick_broadcast(const struct cpumask *mask)
+{
+}
+#endif
+
 static void __init omap2_gp_clockevent_init(int gptimer_id,
 						const char *fck_source,
 						const char *property)
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] arm: omap2: AM43xx: select ARM TWD timer
  2015-12-14 20:34 [PATCH 0/2] arm: omap2: AM43xx: enable ARM TWD timer Grygorii Strashko
  2015-12-14 20:34 ` [PATCH 1/2] ARM: OMAP: am43xx: enable GENERIC_CLOCKEVENTS_BROADCAST Grygorii Strashko
@ 2015-12-14 20:34 ` Grygorii Strashko
  1 sibling, 0 replies; 4+ messages in thread
From: Grygorii Strashko @ 2015-12-14 20:34 UTC (permalink / raw)
  To: Felipe Balbi, Tony Lindgren
  Cc: Grygorii Strashko, linux-omap, nsekhar, linux-arm-kernel,
	Santosh Shilimkar

From: Felipe Balbi <balbi@ti.com>

Make sure to tell the kernel that AM437x devices have ARM TWD timer.

Signed-off-by: Felipe Balbi <balbi@ti.com>
[grygorii.strashko@ti.com: drop ARM Global timer selection, because
 it's incompatible with PM (cpuidle/cpufreq). So, it's unsafe to enable
 it unconditionally]
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
v1: http://www.spinics.net/lists/arm-kernel/msg459649.html

 arch/arm/mach-omap2/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 32a0086..0517f0c 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -66,6 +66,7 @@ config SOC_AM43XX
 	select MIGHT_HAVE_CACHE_L2X0
 	select HAVE_ARM_SCU
 	select GENERIC_CLOCKEVENTS_BROADCAST
+	select HAVE_ARM_TWD
 
 config SOC_DRA7XX
 	bool "TI DRA7XX"
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ARM: OMAP: am43xx: enable GENERIC_CLOCKEVENTS_BROADCAST
  2015-12-14 20:34 ` [PATCH 1/2] ARM: OMAP: am43xx: enable GENERIC_CLOCKEVENTS_BROADCAST Grygorii Strashko
@ 2015-12-21 19:13   ` Tony Lindgren
  0 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2015-12-21 19:13 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: linux-omap, nsekhar, linux-arm-kernel, Felipe Balbi,
	Santosh Shilimkar

* Grygorii Strashko <grygorii.strashko@ti.com> [151214 12:35]:
> System will misbehave in the following case:
> - AM43XX only build (UP);
> - CONFIG_CPU_IDLE=y
> - ARM TWD timer enabled and selected as clockevent device.
> 
> In the above case, It's expected that broadcast timer will be used as
> backup timer when CPUIdle will put MPU in low power states where ARM
> TWD will stop and lose its context. But, the CONFIG_SMP might not be
> selected when kernel is built for AM43XX SoC only and, as result,
> GENERIC_CLOCKEVENTS_BROADCAST option will not be selected also. This
> will break CPUIdle and System will stuck in low power states.
> 
> Hence, fix it by selecting GENERIC_CLOCKEVENTS_BROADCAST option for
> AM43XX SoCs always and add empty tick_broadcast() function
> implementation - no need to send any IPI on UP. After this change
> timer1 will be selected as broadcast timer the same way as for SMP,
> and CPUIdle will work properly.

I've applied both of these into omap-for-v4.4/fixes because of the
description above.

Regards,

Tony

> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
> ---
>  arch/arm/mach-omap2/Kconfig | 1 +
>  arch/arm/mach-omap2/timer.c | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
> index 4b4371d..32a0086 100644
> --- a/arch/arm/mach-omap2/Kconfig
> +++ b/arch/arm/mach-omap2/Kconfig
> @@ -65,6 +65,7 @@ config SOC_AM43XX
>  	select MACH_OMAP_GENERIC
>  	select MIGHT_HAVE_CACHE_L2X0
>  	select HAVE_ARM_SCU
> +	select GENERIC_CLOCKEVENTS_BROADCAST
>  
>  config SOC_DRA7XX
>  	bool "TI DRA7XX"
> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
> index 3bfde44..f34a809 100644
> --- a/arch/arm/mach-omap2/timer.c
> +++ b/arch/arm/mach-omap2/timer.c
> @@ -320,6 +320,12 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer,
>  	return r;
>  }
>  
> +#if !defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)
> +void tick_broadcast(const struct cpumask *mask)
> +{
> +}
> +#endif
> +
>  static void __init omap2_gp_clockevent_init(int gptimer_id,
>  						const char *fck_source,
>  						const char *property)
> -- 
> 2.6.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-21 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-14 20:34 [PATCH 0/2] arm: omap2: AM43xx: enable ARM TWD timer Grygorii Strashko
2015-12-14 20:34 ` [PATCH 1/2] ARM: OMAP: am43xx: enable GENERIC_CLOCKEVENTS_BROADCAST Grygorii Strashko
2015-12-21 19:13   ` Tony Lindgren
2015-12-14 20:34 ` [PATCH v2 2/2] arm: omap2: AM43xx: select ARM TWD timer Grygorii Strashko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).