qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Joaquin de Andres" <me@xcancerberox.com.ar>,
	qemu-arm@nongnu.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Esteban Bosse" <estebanbosse@gmail.com>
Subject: [PATCH v2 08/14] hw/arm/mps2: Add CMSDK APB watchdog device
Date: Wed, 17 Jun 2020 07:51:59 +0200	[thread overview]
Message-ID: <20200617055205.3576-9-f4bug@amsat.org> (raw)
In-Reply-To: <20200617055205.3576-1-f4bug@amsat.org>

We already model the CMSDK APB watchdog device, let's use it!

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v2: Use existing TYPE_CMSDK_APB_WATCHDOG (pm215)
---
 hw/arm/mps2.c  | 7 +++++++
 hw/arm/Kconfig | 1 +
 2 files changed, 8 insertions(+)

diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
index 4fe5cc8622..f7bef20b40 100644
--- a/hw/arm/mps2.c
+++ b/hw/arm/mps2.c
@@ -312,6 +312,13 @@ static void mps2_common_init(MachineState *machine)
     sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0,
                        qdev_get_gpio_in(armv7m, 10));
     sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0x40002000);
+    object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog,
+                            TYPE_CMSDK_APB_WATCHDOG);
+    qdev_prop_set_uint32(DEVICE(&mms->watchdog), "wdogclk-frq", SYSCLK_FRQ);
+    sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal);
+    sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0,
+                       qdev_get_gpio_in_named(armv7m, "NMI", 0));
+    sysbus_mmio_map(SYS_BUS_DEVICE(&mms->watchdog), 0, 0x40008000);
 
     /* FPGA APB subsystem */
     object_initialize_child(OBJECT(mms), "scc", &mms->scc, TYPE_MPS2_SCC);
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 9afa6eee79..5c8f689b3d 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -405,6 +405,7 @@ config MPS2
     select PL080    # DMA controller
     select SPLIT_IRQ
     select UNIMP
+    select CMSDK_APB_WATCHDOG
 
 config FSL_IMX7
     bool
-- 
2.21.3



  parent reply	other threads:[~2020-06-17  5:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17  5:51 [PATCH v2 00/14] mps2: Add few more peripherals Philippe Mathieu-Daudé
2020-06-17  5:51 ` [PATCH v2 01/14] hw/watchdog/cmsdk-apb-watchdog: Add trace event for lock status Philippe Mathieu-Daudé
2020-06-17  5:51 ` [PATCH v2 02/14] hw/i2c/versatile_i2c: Add definitions for register addresses Philippe Mathieu-Daudé
2020-06-17  5:51 ` [PATCH v2 03/14] hw/i2c/versatile_i2c: Add SCL/SDA definitions Philippe Mathieu-Daudé
2020-06-17  5:51 ` [PATCH v2 04/14] hw/i2c: Add header for ARM SBCon two-wire serial bus interface Philippe Mathieu-Daudé
2020-06-17  5:51 ` [PATCH v2 05/14] hw/arm: Use TYPE_VERSATILE_I2C instead of hardcoded string Philippe Mathieu-Daudé
2020-06-17  5:51 ` [PATCH v2 06/14] hw/arm/mps2: Document CMSDK/FPGA APB subsystem sections Philippe Mathieu-Daudé
2020-06-17  5:51 ` [PATCH v2 07/14] hw/arm/mps2: Rename CMSDK AHB peripheral region Philippe Mathieu-Daudé
2020-06-17  5:51 ` Philippe Mathieu-Daudé [this message]
2020-06-17  5:52 ` [PATCH v2 09/14] hw/arm/mps2: Add CMSDK AHB GPIO peripherals as unimplemented devices Philippe Mathieu-Daudé
2020-06-17  5:52 ` [PATCH v2 10/14] hw/arm/mps2: Map the FPGA I/O block Philippe Mathieu-Daudé
2020-06-17  5:52 ` [PATCH v2 11/14] hw/arm/mps2: Add SPI devices Philippe Mathieu-Daudé
2020-06-17  5:52 ` [PATCH v2 12/14] hw/arm/mps2: Add I2C devices Philippe Mathieu-Daudé
2020-06-17  5:52 ` [PATCH v2 13/14] hw/arm/mps2: Add audio I2S interface as unimplemented device Philippe Mathieu-Daudé
2020-06-17  5:52 ` [PATCH v2 14/14] hw/arm/mps2-tz: Use the ARM SBCon two-wire serial bus interface Philippe Mathieu-Daudé
2020-06-17  6:27 ` [PATCH v2 00/14] mps2: Add few more peripherals no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200617055205.3576-9-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=estebanbosse@gmail.com \
    --cc=me@xcancerberox.com.ar \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).