Patchwork [2/2] arm_timer: fix oneshot mode

login
register
mail settings
Submitter Rabin Vincent
Date May 2, 2010, 9:50 a.m.
Message ID <1272793852-26260-2-git-send-email-rabin@rab.in>
Download mbox | patch
Permalink /patch/51461/
State New
Headers show

Comments

Rabin Vincent - May 2, 2010, 9:50 a.m.
In oneshot mode, the delta needs to come from the TimerLoad register,
not the maximum limit.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 hw/arm_timer.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Aurelien Jarno - May 21, 2010, 10 a.m.
On Sun, May 02, 2010 at 03:20:52PM +0530, Rabin Vincent wrote:
> In oneshot mode, the delta needs to come from the TimerLoad register,
> not the maximum limit.
> 
> Signed-off-by: Rabin Vincent <rabin@rab.in>

Thanks, applied.

> ---
>  hw/arm_timer.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/arm_timer.c b/hw/arm_timer.c
> index 5b6947a..9073ffc 100644
> --- a/hw/arm_timer.c
> +++ b/hw/arm_timer.c
> @@ -71,7 +71,7 @@ static void arm_timer_recalibrate(arm_timer_state *s, int reload)
>  {
>      uint32_t limit;
>  
> -    if ((s->control & TIMER_CTRL_PERIODIC) == 0) {
> +    if ((s->control & (TIMER_CTRL_PERIODIC | TIMER_CTRL_ONESHOT)) == 0) {
>          /* Free running.  */
>          if (s->control & TIMER_CTRL_32BIT)
>              limit = 0xffffffff;
> -- 
> 1.7.0.4
> 
> 
> 
>

Patch

diff --git a/hw/arm_timer.c b/hw/arm_timer.c
index 5b6947a..9073ffc 100644
--- a/hw/arm_timer.c
+++ b/hw/arm_timer.c
@@ -71,7 +71,7 @@  static void arm_timer_recalibrate(arm_timer_state *s, int reload)
 {
     uint32_t limit;
 
-    if ((s->control & TIMER_CTRL_PERIODIC) == 0) {
+    if ((s->control & (TIMER_CTRL_PERIODIC | TIMER_CTRL_ONESHOT)) == 0) {
         /* Free running.  */
         if (s->control & TIMER_CTRL_32BIT)
             limit = 0xffffffff;