arm_mptimer: Fix timer shutdown and mode change
commit8a52340cbaf60d4dd0a78bbfe12632639fe3da6d
authorDmitry Osipenko <digetx@gmail.com>
Sun, 5 Jul 2015 22:47:47 +0000 (6 01:47 +0300)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 6 Jul 2015 09:25:37 +0000 (6 10:25 +0100)
tree73f82b1c8f19b101e5ee6d9606f1a0b576965b72
parent12dc273e98e4e111880b25c12bf671dc8951b8e6
arm_mptimer: Fix timer shutdown and mode change

The running timer can't be stopped because timer control code just
doesn't handle disabling the timer. Fix it by deleting the timer if
the enable bit is cleared.

The timer won't start periodic ticking if a ONE-SHOT -> PERIODIC mode
change happens after a one-shot tick was completed. Fix it by
re-starting ticking if the timer isn't ticking right now.

To avoid code churning, these two fixes are squashed in one commit.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/timer/arm_mptimer.c