Skip to contentSkip to conversation

Check correct register for clock source

PATCH In review Amithash Prasad 3 participants 4 messages Sep 6, 2019 – Sep 13, 2019 Arm/Aspeed machine support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Check correct register for clock source

When WDT_RESTART is written, the data is not the contents of the WDT_CTRL register. Hence ensure we are looking at WDT_CTRL to check if bit WDT_CTRL_1MHZ_CLK is set or not.

---
 hw/watchdog/wdt_aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/watchdog/wdt_aspeed.c +1 -1
index 9b93213417..f710036535 100644
@@ -140,7 +140,7 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
     case WDT_RESTART:
         if ((data & 0xFFFF) == WDT_RESTART_MAGIC) {
             s->regs[WDT_STATUS] = s->regs[WDT_RELOAD_VALUE];
-            aspeed_wdt_reload(s, !(data & WDT_CTRL_1MHZ_CLK));
+            aspeed_wdt_reload(s, !(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK));
         }
         break;
     case WDT_CTRL:
Signature · 1 line
2.21.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Amithash Prasad

When WDT_RESTART is written, the data is not the contents of the WDT_CTRL register. Hence ensure we are looking at WDT_CTRL to check if bit WDT_CTRL_1MHZ_CLK is set or not.

Thanks for the patch!

Quoted 20 lines
---
 hw/watchdog/wdt_aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/watchdog/wdt_aspeed.c +1 -2
index 9b93213417..f710036535 100644
@@ -140,7 +140,7 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
     case WDT_RESTART:
         if ((data & 0xFFFF) == WDT_RESTART_MAGIC) {
             s->regs[WDT_STATUS] = s->regs[WDT_RELOAD_VALUE];
-            aspeed_wdt_reload(s, !(data & WDT_CTRL_1MHZ_CLK));
+            aspeed_wdt_reload(s, !(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK));
         }
         break;
     case WDT_CTRL:
--

2.21.0

#2 lore raw
Quoted 11 lines · Joel Stanley
Quoted 6 lines · Amithash Prasad

When WDT_RESTART is written, the data is not the contents of the WDT_CTRL register. Hence ensure we are looking at WDT_CTRL to check if bit WDT_CTRL_1MHZ_CLK is set or not.

Thanks for the patch!

yes. I have pushed it on the aspeed-4.2 branch but it can go independently as there are no conflicts. I changed the title slightly to reflect the area being changed.

On the clock topic, we should consider looking at the "Clock framework API" from Damien Hedde :

	http://patchwork.ozlabs.org/cover/1157671/

Thanks,

C.

Quoted 21 lines
Quoted 21 lines
---
 hw/watchdog/wdt_aspeed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/watchdog/wdt_aspeed.c +1 -2
index 9b93213417..f710036535 100644
@@ -140,7 +140,7 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data,
     case WDT_RESTART:
         if ((data & 0xFFFF) == WDT_RESTART_MAGIC) {
             s->regs[WDT_STATUS] = s->regs[WDT_RELOAD_VALUE];
-            aspeed_wdt_reload(s, !(data & WDT_CTRL_1MHZ_CLK));
+            aspeed_wdt_reload(s, !(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK));
         }
         break;
     case WDT_CTRL:
--

2.21.0

#3 lore raw
Quoted 3 lines
Quoted 3 lines

yes. I have pushed it on the aspeed-4.2 branch but it can go independently
as there are no conflicts. I changed the title slightly to reflect the area being changed.

Thanks! If required, I can change the patch title and resubmit.