ARM i.MX timers: fix reset handling
commitc98c9eba888c9ae450d41d92b1e6abbb66832e4c
authorKurban Mallachiev <mallachiev@ispras.ru>
Tue, 28 Feb 2017 12:08:16 +0000 (28 12:08 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 28 Feb 2017 12:08:16 +0000 (28 12:08 +0000)
treeb9eb3db369d685e707ee1dcecd3e9ee43ae2addd
parentccc11b027923d738e5196ef355c48aac866802a9
ARM i.MX timers: fix reset handling

The i.MX timer device can be reset by writing to the SWR bit
of the CR register. This has to behave differently from hard
(power-on) reset because it does not reset all of the bits
in the CR register.

We were incorrectly implementing soft reset and hard reset
the same way, and in addition had a logic error which meant
that we were clearing the bits that soft-reset is supposed
to preserve and not touching the bits that soft-reset clears.
This was not correct behaviour for either kind of reset.

Separate out the soft reset and hard reset code paths, and
correct the handling of reset of the CR register so that it
is correct in both cases.

Signed-off-by: Kurban Mallachiev <mallachiev@ispras.ru>
[PMM: rephrased commit message, spacing on operators;
 use bool rather than int for is_soft_reset]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/timer/imx_gpt.c