hw/timer/imx_epit: fix compare timer handling
authorAxel Heider <axel.heider@hensoldt.net>
Sun, 20 Nov 2022 19:05:25 +0000 (20:05 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 5 Jan 2023 12:14:43 +0000 (12:14 +0000)
commit8d71beaf1e6b49266c4d98286f4ce6c874c998ae
treea5419c7a8bccb25b22841564caf8f045ed6660d4
parente662449aa670bff938a011220593dd059b75e84b
hw/timer/imx_epit: fix compare timer handling

- fix #1263 for CR writes
- rework compare time handling
  - The compare timer has to run even if CR.OCIEN is not set,
    as SR.OCIF must be updated.
  - The compare timer fires exactly once when the
    compare value is less than the current value, but the
    reload values is less than the compare value.
  - The compare timer will never fire if the reload value is
    less than the compare value. Disable it in this case.

Signed-off-by: Axel Heider <axel.heider@hensoldt.net>
[PMM: fixed minor style nits]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/timer/imx_epit.c