Skip to contentSkip to conversation

ARM: at91: rm9200 fix time support

PATCH New Jean-Christophe PLAGNIOL-VILLARD 2 participants 2 messages May 15, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: at91: rm9200 fix time support

since commit 838a2ae80a6ab52139fb1bf0a93ea8c5eff94488

Author: Shawn Guo <[email protected]>
Date:   Sat Jan 12 11:50:05 2013 +0000

ARM: use clockevents_config_and_register() where possible

The timer is wrongly configured and result in a nice crash so revert it on rm9200 timer

---
 arch/arm/mach-at91/at91rm9200_time.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-at91/at91rm9200_time.c +5 -2
index 2acdff4..180b302 100644
@@ -174,6 +174,7 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev)
 static struct clock_event_device clkevt = {
 	.name		= "at91_tick",
 	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
+	.shift		= 32,
 	.rating		= 150,
 	.set_next_event	= clkevt32k_next_event,
 	.set_mode	= clkevt32k_mode,
@@ -264,9 +265,11 @@ void __init at91rm9200_timer_init(void)
 	at91_st_write(AT91_ST_RTMR, 1);
 
 	/* Setup timer clockevent, with minimum of two ticks (important!!) */
+	clkevt.mult = div_sc(AT91_SLOW_CLOCK, NSEC_PER_SEC, clkevt.shift);
+	clkevt.max_delta_ns = clockevent_delta2ns(AT91_ST_ALMV, &clkevt);
+	clkevt.min_delta_ns = clockevent_delta2ns(2, &clkevt) + 1;
 	clkevt.cpumask = cpumask_of(0);
-	clockevents_config_and_register(&clkevt, AT91_SLOW_CLOCK,
-					2, AT91_ST_ALMV);
+	clockevents_register_device(&clkevt);
 
 	/* register clocksource */
 	clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK);
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 ARM: at91: rm9200 fix time support

On 15/05/2013 12:12, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 6 lines

since commit 838a2ae80a6ab52139fb1bf0a93ea8c5eff94488

Author: Shawn Guo <[email protected]>
Date:   Sat Jan 12 11:50:05 2013 +0000

ARM: use clockevents_config_and_register() where possible

Quoted 7 lines

The timer is wrongly configured and result in a nice crash so revert it on rm9200 timer

Ok, even if I said that it would have been better to understand the root cause of this, it is also true that we have to move forward in the meantime...

So, yes, I take it for at91-3.10-fixes:

Thanks,

Quoted 31 lines
---
  arch/arm/mach-at91/at91rm9200_time.c |    7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-at91/at91rm9200_time.c +5 -2
index 2acdff4..180b302 100644
@@ -174,6 +174,7 @@ clkevt32k_next_event(unsigned long delta, struct clock_event_device *dev)
  static struct clock_event_device clkevt = {
  	.name		= "at91_tick",
  	.features	= CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
+	.shift		= 32,
  	.rating		= 150,
  	.set_next_event	= clkevt32k_next_event,
  	.set_mode	= clkevt32k_mode,
@@ -264,9 +265,11 @@ void __init at91rm9200_timer_init(void)
  	at91_st_write(AT91_ST_RTMR, 1);
 
  	/* Setup timer clockevent, with minimum of two ticks (important!!) */
+	clkevt.mult = div_sc(AT91_SLOW_CLOCK, NSEC_PER_SEC, clkevt.shift);
+	clkevt.max_delta_ns = clockevent_delta2ns(AT91_ST_ALMV, &clkevt);
+	clkevt.min_delta_ns = clockevent_delta2ns(2, &clkevt) + 1;
  	clkevt.cpumask = cpumask_of(0);
-	clockevents_config_and_register(&clkevt, AT91_SLOW_CLOCK,
-					2, AT91_ST_ALMV);
+	clockevents_register_device(&clkevt);
 
  	/* register clocksource */
  	clocksource_register_hz(&clk32k, AT91_SLOW_CLOCK);
Signature · 1 line
Nicolas Ferre