qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/5] aspeed/wdt: Introduce a container for the MMIO region


From: Cédric Le Goater
Subject: [PATCH v2 1/5] aspeed/wdt: Introduce a container for the MMIO region
Date: Mon, 18 Oct 2021 15:26:05 +0200

On the AST2600, the 2nd watchdog timer can be controlled through the
FMC controller to disable the alternate boot function. Next changes
will map the WDT2 registers in the AST2600 FMC memory region. Add a
container on top of the register region for this purpose.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 include/hw/watchdog/wdt_aspeed.h | 1 +
 hw/watchdog/wdt_aspeed.c         | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h
index f945cd6c5833..14e91acb1284 100644
--- a/include/hw/watchdog/wdt_aspeed.h
+++ b/include/hw/watchdog/wdt_aspeed.h
@@ -28,6 +28,7 @@ struct AspeedWDTState {
     QEMUTimer *timer;
 
     /*< public >*/
+    MemoryRegion iomem_container;
     MemoryRegion iomem;
     uint32_t regs[ASPEED_WDT_REGS_MAX];
 
diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c
index 146ffcd71301..803e861a9c61 100644
--- a/hw/watchdog/wdt_aspeed.c
+++ b/hw/watchdog/wdt_aspeed.c
@@ -275,9 +275,13 @@ static void aspeed_wdt_realize(DeviceState *dev, Error 
**errp)
      */
     s->pclk_freq = PCLK_HZ;
 
+    memory_region_init(&s->iomem_container, OBJECT(s),
+                       TYPE_ASPEED_WDT ".container", ASPEED_WDT_REGS_MAX * 4);
+    sysbus_init_mmio(sbd, &s->iomem_container);
+
     memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_wdt_ops, s,
                           TYPE_ASPEED_WDT, ASPEED_WDT_REGS_MAX * 4);
-    sysbus_init_mmio(sbd, &s->iomem);
+    memory_region_add_subregion(&s->iomem_container, 0x0, &s->iomem);
 }
 
 static Property aspeed_wdt_properties[] = {
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]