From patchwork Sun May 17 16:21:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 11554189 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AEBE739 for ; Sun, 17 May 2020 16:24:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D51972070A for ; Sun, 17 May 2020 16:24:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aOazsU8k" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D51972070A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:35304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaM56-0002Ap-1K for patchwork-qemu-devel@patchwork.kernel.org; Sun, 17 May 2020 12:24:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaM2v-00064s-Ab for qemu-devel@nongnu.org; Sun, 17 May 2020 12:21:49 -0400 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]:37276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaM2u-0006kj-Lf for qemu-devel@nongnu.org; Sun, 17 May 2020 12:21:49 -0400 Received: by mail-pf1-x441.google.com with SMTP id y198so2105191pfb.4 for ; Sun, 17 May 2020 09:21:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dgqnDiR9xlTi5bsYt9yMIaI3tHzhP3WJ+wYKfU87qKk=; b=aOazsU8kQ9nmXrYy3WCpe3A+D/fpH6zkD3U8C/uLzX4OmgxLZPISOMofS74e6VH7Bf IPASkwnWCtc8VBvZH0YQiX0MGPrsVvaoeGxbX86hLUpWliO4jzLF5w1KJDW2pim7Lj1F uB4NbSsebq22zXEMEjtJ2s152bKmN+D4pvCsJHe/J/rCrleTMroFPHLel68NVT1T9faD M+eMJOdLq+Ty6DGA5CkoMjI1uUGtEf70IEkbyCLAWZJyHRGg+nWWhp0S4uVpfqVQm9pH ONn0sAxc8NSr8t2nUXVpTJanYjaY2TW80hQjs5GlMV0pXt/3uA0cG7VHkgnfIr80Z1s1 xdMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dgqnDiR9xlTi5bsYt9yMIaI3tHzhP3WJ+wYKfU87qKk=; b=Q/q0UvRgKFMXI+MOUip39vwcD6boZiEFdbIzdFRKG+vOb/5uqU/pj3S6DlIvtAk5LQ yZdqv/UnmuLbHpIGgcxU/qQP74xdGuyI5gjUyzuolw51b7oUWVqwj+kNZAPpRX9YeJ9h 8ww7mDfcnKRNh0GXJdG11Fq6zVHXLf8aF1ZBj0W0Cuk2xGNH+Ea3JpwBgv4Ow+XWMWvu 1LCloX2ekm5fSSJU+GPfzFPlT63dqaLKJvQWOec9PY9qV8ca0xBkGTNY9edUUGUo/Ws+ hN8gjdet8ycIfc2CdWSHRZ/17lcg+c3p2vpWolQIVsa1RPXRPD01Rvh0MaedAzhp7tqg oZgQ== X-Gm-Message-State: AOAM531Uqmpyc/fsQQZFWeyUMOEEHcdxhteeQfK+9yNnY+PMT9zHB5Em OOitaBoGch4JOs41YT48xjI= X-Google-Smtp-Source: ABdhPJwATxWvmCRtoI1nny2t9Aanz3DeBA/a9VuZwapakSHx1XfWuegVQ6wEv7eAutPRkvhoTsjQyA== X-Received: by 2002:aa7:99cc:: with SMTP id v12mr9742062pfi.279.1589732507257; Sun, 17 May 2020 09:21:47 -0700 (PDT) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id b8sm6500762pft.11.2020.05.17.09.21.46 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 May 2020 09:21:46 -0700 (PDT) From: Guenter Roeck To: Peter Maydell Subject: [PATCH v3 4/8] hw/arm/fsl-imx31: Wire up watchdog Date: Sun, 17 May 2020 09:21:31 -0700 Message-Id: <20200517162135.110364-5-linux@roeck-us.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200517162135.110364-1-linux@roeck-us.net> References: <20200517162135.110364-1-linux@roeck-us.net> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::441; envelope-from=groeck7@gmail.com; helo=mail-pf1-x441.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Smirnov , Peter Chubb , qemu-devel@nongnu.org, Guenter Roeck , Jean-Christophe Dubois Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" With this patch, the watchdog on i.MX31 emulations is fully operational. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Guenter Roeck --- v3: No change v2: Select WDT_IMX2 explicitly Added Philippe's Reviewed-by: tag hw/arm/Kconfig | 1 + hw/arm/fsl-imx31.c | 6 ++++++ include/hw/arm/fsl-imx31.h | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 54a49aeabd..9c77f4cbb4 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -366,6 +366,7 @@ config FSL_IMX31 select SERIAL select IMX select IMX_I2C + select WDT_IMX2 select LAN9118 config FSL_IMX6 diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 8472d2e911..1e7959863d 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -63,6 +63,8 @@ static void fsl_imx31_init(Object *obj) sysbus_init_child_obj(obj, "gpio[*]", &s->gpio[i], sizeof(s->gpio[i]), TYPE_IMX_GPIO); } + + sysbus_init_child_obj(obj, "wdt", &s->wdt, sizeof(s->wdt), TYPE_IMX2_WDT); } static void fsl_imx31_realize(DeviceState *dev, Error **errp) @@ -205,6 +207,10 @@ static void fsl_imx31_realize(DeviceState *dev, Error **errp) gpio_table[i].irq)); } + /* Watchdog */ + object_property_set_bool(OBJECT(&s->wdt), true, "realized", &error_abort); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt), 0, FSL_IMX31_WDT_ADDR); + /* On a real system, the first 16k is a `secure boot rom' */ memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom", FSL_IMX31_SECURE_ROM_SIZE, &err); diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h index ac5ca9826a..dd8561b309 100644 --- a/include/hw/arm/fsl-imx31.h +++ b/include/hw/arm/fsl-imx31.h @@ -25,6 +25,7 @@ #include "hw/timer/imx_epit.h" #include "hw/i2c/imx_i2c.h" #include "hw/gpio/imx_gpio.h" +#include "hw/watchdog/wdt_imx2.h" #include "exec/memory.h" #include "target/arm/cpu.h" @@ -49,6 +50,7 @@ typedef struct FslIMX31State { IMXEPITState epit[FSL_IMX31_NUM_EPITS]; IMXI2CState i2c[FSL_IMX31_NUM_I2CS]; IMXGPIOState gpio[FSL_IMX31_NUM_GPIOS]; + IMX2WdtState wdt; MemoryRegion secure_rom; MemoryRegion rom; MemoryRegion iram; @@ -87,6 +89,8 @@ typedef struct FslIMX31State { #define FSL_IMX31_GPIO1_SIZE 0x4000 #define FSL_IMX31_GPIO2_ADDR 0x53FD0000 #define FSL_IMX31_GPIO2_SIZE 0x4000 +#define FSL_IMX31_WDT_ADDR 0x53FDC000 +#define FSL_IMX31_WDT_SIZE 0x4000 #define FSL_IMX31_AVIC_ADDR 0x68000000 #define FSL_IMX31_AVIC_SIZE 0x100 #define FSL_IMX31_SDRAM0_ADDR 0x80000000