aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2018-07-09 14:51:34 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-07-09 14:51:34 +0100
commit0e256833085cc9d292e59a5bda9b886fd09a5f83 (patch)
tree7195a9ab3316c86cc62f317dddb12ab2a83ae6d3
parent6583080ed87ea218acae59f1c52b7b11ffec240d (diff)
downloadqemu-arm-0e256833085cc9d292e59a5bda9b886fd09a5f83.tar.gz
hw/timer/cmsdk-apb-timer: Correctly identify and set one-shot mode
The CMSDK APB timer is currently always configured as periodic timer. This results in the following messages when trying to boot Linux. Timer with delta zero, disabling If the timer limit set with the RELOAD command is 0, the timer needs to be enabled as one-shot timer. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/timer/cmsdk-apb-timer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c
index 1f99081db1..3ebdc7be40 100644
--- a/hw/timer/cmsdk-apb-timer.c
+++ b/hw/timer/cmsdk-apb-timer.c
@@ -119,7 +119,7 @@ static void cmsdk_apb_timer_write(void *opaque, hwaddr offset, uint64_t value,
}
s->ctrl = value & 0xf;
if (s->ctrl & R_CTRL_EN_MASK) {
- ptimer_run(s->timer, 0);
+ ptimer_run(s->timer, ptimer_get_limit(s->timer) == 0);
} else {
ptimer_stop(s->timer);
}