From: Axel Heider <axel.hei...@hensoldt.net> Signed-off-by: Axel Heider <axel.hei...@hensoldt.net> --- hw/timer/imx_epit.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 2e4ff89613..bba9c87cd4 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -175,9 +175,12 @@ static void imx_epit_reload_compare_timer(IMXEPITState *s) static void imx_epit_write_cr(IMXEPITState *s, uint32_t value) { uint32_t freq = 0; + + /* SWR bit is never persisted, it clears itself once reset is done */ uint32_t oldcr = s->cr; - s->cr = value & 0x03ffffff; - if (s->cr & CR_SWR) { + s->cr = (value & ~CR_SWR) & 0x03ffffff; + + if (value & CR_SWR) { /* handle the reset */ imx_epit_reset(DEVICE(s)); /* @@ -189,7 +192,7 @@ static void imx_epit_write_cr(IMXEPITState *s, uint32_t value) ptimer_transaction_begin(s->timer_cmp); ptimer_transaction_begin(s->timer_reload); - if (!(s->cr & CR_SWR)) { + if (!(value & CR_SWR)) { freq = imx_epit_set_freq(s); } -- 2.34.5