[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH qemu.git 07/11] hw/timer/imx_epit: do not persist CR.SWR bit
From: |
~axelheider |
Subject: |
[PATCH qemu.git 07/11] hw/timer/imx_epit: do not persist CR.SWR bit |
Date: |
Tue, 25 Oct 2022 20:06:20 +0200 |
From: Axel Heider <axel.heider@hensoldt.net>
Signed-off-by: Axel Heider <axel.heider@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
- Re: [PATCH qemu.git 04/11] hw/timer/imx_epit: remove explicit fields cnt and freq, (continued)
- [PATCH qemu.git 03/11] hw/timer/imx_epit: factor out register write handlers, ~axelheider, 2022/10/30
- [PATCH qemu.git 06/11] hw/timer/imx_epit: software reset clears the interrupt, ~axelheider, 2022/10/30
- [PATCH qemu.git 09/11] hw/timer/imx_epit: cleanup CR defines, ~axelheider, 2022/10/30
- [PATCH qemu.git 01/11] hw/timer/imx_epit: fix typo in comment, ~axelheider, 2022/10/30
- [PATCH qemu.git 05/11] hw/timer/imx_epit: simplify interrupt logic, ~axelheider, 2022/10/30
- [PATCH qemu.git 08/11] hw/timer/imx_epit: simplify CR.ENMOD handling, ~axelheider, 2022/10/30
- [PATCH qemu.git 07/11] hw/timer/imx_epit: do not persist CR.SWR bit,
~axelheider <=
- [PATCH qemu.git 10/11] hw/timer/imx_epit: fix compare timer update, ~axelheider, 2022/10/30
- [PATCH qemu.git 11/11] hw/timer/imx_epit: rework CR write handling, ~axelheider, 2022/10/30