[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/12] aspeed/wdt: Support software reset mode for AST2600
From: |
Cédric Le Goater |
Subject: |
[PULL 11/12] aspeed/wdt: Support software reset mode for AST2600 |
Date: |
Mon, 27 Jan 2025 10:42:38 +0100 |
From: Jamin Lin <jamin_lin@aspeedtech.com>
On the AST2400 and AST2500 platforms, the system can only be reset by enabling
the WDT (Watchdog Timer) and waiting for the WDT timeout. However, starting
from the AST2600 platform, the reset event can be triggered directly and
intentionally by software, without relying on the WDT timeout.
This mechanism, referred to as "software restart", is implemented in hardware.
When using the software restart mechanism, the WDT counter is not enabled.
To trigger a reset generation in software mode, write 0xAEEDF123 to register
0x24 and software mode reset only support SOC reset mode.
A new function, "aspeed_wdt_is_soc_reset_mode", is introduced to determine
whether the SoC reset mode is active.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link:
20250124030249.1706996-3-jamin_lin@aspeedtech.com">https://lore.kernel.org/qemu-devel/20250124030249.1706996-3-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/watchdog/wdt_aspeed.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
index 22e94e7b9c99..d94b83c10934 100644
--- a/hw/watchdog/wdt_aspeed.c
+++ b/hw/watchdog/wdt_aspeed.c
@@ -51,11 +51,20 @@
#define WDT_TIMEOUT_CLEAR (0x14 / 4)
#define WDT_RESTART_MAGIC 0x4755
+#define WDT_SW_RESET_ENABLE 0xAEEDF123
#define AST2600_SCU_RESET_CONTROL1 (0x40 / 4)
#define SCU_RESET_CONTROL1 (0x04 / 4)
#define SCU_RESET_SDRAM BIT(0)
+static bool aspeed_wdt_is_soc_reset_mode(const AspeedWDTState *s)
+{
+ uint32_t mode;
+
+ mode = extract32(s->regs[WDT_CTRL], 5, 2);
+ return (mode == WDT_CTRL_RESET_MODE_SOC);
+}
+
static bool aspeed_wdt_is_enabled(const AspeedWDTState *s)
{
return s->regs[WDT_CTRL] & WDT_CTRL_ENABLE;
@@ -199,13 +208,18 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset,
uint64_t data,
case WDT_TIMEOUT_STATUS:
case WDT_TIMEOUT_CLEAR:
case WDT_RESET_MASK2:
- case WDT_SW_RESET_CTRL:
case WDT_SW_RESET_MASK1:
case WDT_SW_RESET_MASK2:
qemu_log_mask(LOG_UNIMP,
"%s: uninmplemented write at offset 0x%" HWADDR_PRIx
"\n",
__func__, offset);
break;
+ case WDT_SW_RESET_CTRL:
+ if (aspeed_wdt_is_soc_reset_mode(s) &&
+ (data == WDT_SW_RESET_ENABLE)) {
+ watchdog_perform_action();
+ }
+ break;
default:
qemu_log_mask(LOG_GUEST_ERROR,
"%s: Out-of-bounds write at offset 0x%" HWADDR_PRIx "\n",
--
2.48.1
- [PULL 00/12] aspeed queue, Cédric Le Goater, 2025/01/27
- [PULL 01/12] hw/arm/aspeed: fix connect_serial_hds_to_uarts, Cédric Le Goater, 2025/01/27
- [PULL 02/12] hw/sd/sdhci: Introduce a new Write Protected pin inverted property, Cédric Le Goater, 2025/01/27
- [PULL 03/12] hw/arm/aspeed: Invert sdhci write protected pin for AST2600 EVB, Cédric Le Goater, 2025/01/27
- [PULL 04/12] hw/timer/aspeed: Refactor Timer Callbacks for SoC-Specific Implementations, Cédric Le Goater, 2025/01/27
- [PULL 06/12] aspeed/soc: Support Timer for AST2700, Cédric Le Goater, 2025/01/27
- [PULL 07/12] test/functional: Update the Aspeed aarch64 test, Cédric Le Goater, 2025/01/27
- [PULL 05/12] hw/timer/aspeed: Add AST2700 Support, Cédric Le Goater, 2025/01/27
- [PULL 10/12] aspeed/wdt: Fix coding style, Cédric Le Goater, 2025/01/27
- [PULL 08/12] test/functional: Update buildroot images to 2024.11, Cédric Le Goater, 2025/01/27
- [PULL 11/12] aspeed/wdt: Support software reset mode for AST2600,
Cédric Le Goater <=
- [PULL 09/12] aspeed: Create sd devices only when defaults are enabled, Cédric Le Goater, 2025/01/27
- [PULL 12/12] docs/system/arm/aspeed: Remove tacoma-bmc from the documentation, Cédric Le Goater, 2025/01/27
- Re: [PULL 00/12] aspeed queue, Stefan Hajnoczi, 2025/01/27