From patchwork Thu Apr 20 10:04:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 675602 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp221430wrs; Thu, 20 Apr 2023 03:07:51 -0700 (PDT) X-Google-Smtp-Source: AKy350bto0w30GoNeo1EarSVg8lOuEwWJNwqqhoxZo+wIZ9gh3Pj7y/V9ptNg+xdMvm3jn4kQ7eE X-Received: by 2002:a05:6214:27c8:b0:5e7:b5c5:5558 with SMTP id ge8-20020a05621427c800b005e7b5c55558mr867696qvb.44.1681985270907; Thu, 20 Apr 2023 03:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681985270; cv=none; d=google.com; s=arc-20160816; b=pSqDMELb84gFPVJYK0hFBNghPNzvbmtVb51qGfb+hML3fVwVK1x7+UDb8obxjj1JOg h0vJCf6E+KvJwF54CeUqErSJmjn/Pb5Xl6aAxQ6448T8Ne7xUQNPb7572XM0ugcQhCm1 lsc4z3QG3Rxf6Vs1rqaZRl/HGdbzs//GyBwiN4txhIHnsKQqlp8mlnzSUdBID3Brot2G bwbVvcEpBtPy2khX0ioE0YTMElUuTbi7NAehdQHCvvRXS2cnh6t902zTO4B1Zj9vRSFf Vk52Agsyq4IDd2asw9uwFDDvDwosC5wUOuf1TYmeyS843BOo+QdWLfk+CjinyRwBJu20 ecUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=gHMd6Mccc9WWoHnZhKOQsV6TX3fZq4KK5xzXCVpXhHc=; b=ncL1aBfkgk+xiaa323jy4baAUpdR7S8om2XZ7R71DR2nF55E2zWg/EtD26k8X+XYtC XlykS//Zi/mAty4L+STzGkZypseTHGRQLsaCNWuFQjUIGPzEJqM9iSbLZ+P249N5W9D8 xNM6leFiiJKX++vhsEVEwd/NQEeff1AzryRlOrtaw/rC21B4yD6yd8GthuLsyIxCWB4Z CKDuyIAnBCkw944krtMgohaFmLyv+/0+PLA7Zk6co0d18mpZuVBnSpgPPocmjzsgE88m IO621pYmAKXqurQCLtULTLqH9ibIs9Z8xCcfzkNRh5wpNqe/b41vm3QQt71inIbkQMQM hzyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jV43J+jP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 1-20020a0562140d0100b005ef41e0272asi976075qvh.212.2023.04.20.03.07.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Apr 2023 03:07:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jV43J+jP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ppRAC-0000ba-PN; Thu, 20 Apr 2023 06:05:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppRA7-0000Yi-8O for qemu-devel@nongnu.org; Thu, 20 Apr 2023 06:05:11 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ppRA1-0003f2-KN for qemu-devel@nongnu.org; Thu, 20 Apr 2023 06:05:10 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-2febac9cacdso282817f8f.1 for ; Thu, 20 Apr 2023 03:05:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681985102; x=1684577102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=gHMd6Mccc9WWoHnZhKOQsV6TX3fZq4KK5xzXCVpXhHc=; b=jV43J+jPPgeZZ1rafSh+11Yui31ZGn0F+Gg8wWEyD4/N8wfisjlzfLmg629dax6O+j oovT03f6gnlsu5AX4cSC3Q3OQMJEcv47LhD8kVs2LU6RpSXH1UXk3oydrzlrag0VKW2G XFZuLMLWWidW5yFA/dxtszsyPu++eWDbzboS19KGx9BnfkgeFU1fR07HKkI4OOFgL7Jx wCzyyQ89mnI2Q/15Lvry9v/OLRrbUeXcDql6oz/A1y9LXMdK/fT/1I/zZnEpA7H1d4Pn iT6fIVce9hkjx+ztZqYNN5KkwszMeV/JvAguA4HDIPOvNNlJ8xTucuDSWbz6cVfbx9SZ B3Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985102; x=1684577102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gHMd6Mccc9WWoHnZhKOQsV6TX3fZq4KK5xzXCVpXhHc=; b=M/XGLGIOSlkB98OiRGi4nE0V7ws0VNJYEAmAsc7eDD8K64SXceTwSgRHEEhh0tiAyo Kg7GrtaSb+jSZOOr5lIAK8eDEqvStGGL7+RMz2udOz+yhzhy/4ZKBsb3XyLX2cXuXXxX yzSETK2FP+0d+LCuCaB8wY5z/zIcT0r75CCg9u/+Bhy+SF6SDDLM6t6I8geA5h/PR0bb G2wO6sewLNWNNBCauu0wHe35Ynwm4o/4R3QHBXKDLoTOmibtRNyZ4kSJ+5ROnpi6LiNv e+JgHTLu4Jixiu54bUi4NohHZDsusOmk25+03H+UbPGg167StCQG7LnQqMxhRgjzKr4P qDeA== X-Gm-Message-State: AAQBX9eJ/8MSF8m654fD+KyFAs90UCuM3EcrpOR4diRMp0EzfkYgriBL l0qY5TrrYecO0JEIRU6tjubklJfGWlziciOTqQU= X-Received: by 2002:adf:ff83:0:b0:2f9:5841:a4d4 with SMTP id j3-20020adfff83000000b002f95841a4d4mr905392wrr.27.1681985102123; Thu, 20 Apr 2023 03:05:02 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id o2-20020a5d58c2000000b002fe522117fdsm1556388wrf.36.2023.04.20.03.05.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:01 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 05/21] hw/arm: Add WDT to Allwinner-H3 and Orangepi-PC Date: Thu, 20 Apr 2023 11:04:40 +0100 Message-Id: <20230420100456.944969-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230420100456.944969-1-peter.maydell@linaro.org> References: <20230420100456.944969-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_QUOTING=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Strahinja Jankovic This patch adds WDT to Allwinner-H3 and Orangepi-PC. WDT is added as an overlay to the Timer module memory area. Signed-off-by: Strahinja Jankovic Reviewed-by: Niek Linnenbank Message-id: 20230326202256.22980-4-strahinja.p.jankovic@gmail.com Signed-off-by: Peter Maydell --- docs/system/arm/orangepi.rst | 1 + include/hw/arm/allwinner-h3.h | 5 ++++- hw/arm/allwinner-h3.c | 8 ++++++++ hw/arm/Kconfig | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/system/arm/orangepi.rst b/docs/system/arm/orangepi.rst index e5973600a15..9afa54213b0 100644 --- a/docs/system/arm/orangepi.rst +++ b/docs/system/arm/orangepi.rst @@ -26,6 +26,7 @@ The Orange Pi PC machine supports the following devices: * System Control module * Security Identifier device * TWI (I2C) + * Watchdog timer Limitations """"""""""" diff --git a/include/hw/arm/allwinner-h3.h b/include/hw/arm/allwinner-h3.h index 59e0f822d2d..f15d6d7cc7d 100644 --- a/include/hw/arm/allwinner-h3.h +++ b/include/hw/arm/allwinner-h3.h @@ -48,6 +48,7 @@ #include "hw/net/allwinner-sun8i-emac.h" #include "hw/rtc/allwinner-rtc.h" #include "hw/i2c/allwinner-i2c.h" +#include "hw/watchdog/allwinner-wdt.h" #include "target/arm/cpu.h" #include "sysemu/block-backend.h" @@ -96,7 +97,8 @@ enum { AW_H3_DEV_RTC, AW_H3_DEV_CPUCFG, AW_H3_DEV_R_TWI, - AW_H3_DEV_SDRAM + AW_H3_DEV_SDRAM, + AW_H3_DEV_WDT }; /** Total number of CPU cores in the H3 SoC */ @@ -141,6 +143,7 @@ struct AwH3State { AWI2CState r_twi; AwSun8iEmacState emac; AwRtcState rtc; + AwWdtState wdt; GICState gic; MemoryRegion sram_a1; MemoryRegion sram_a2; diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c index 69d0ad6f50e..f05afddf7e0 100644 --- a/hw/arm/allwinner-h3.c +++ b/hw/arm/allwinner-h3.c @@ -49,6 +49,7 @@ const hwaddr allwinner_h3_memmap[] = { [AW_H3_DEV_OHCI3] = 0x01c1d400, [AW_H3_DEV_CCU] = 0x01c20000, [AW_H3_DEV_PIT] = 0x01c20c00, + [AW_H3_DEV_WDT] = 0x01c20ca0, [AW_H3_DEV_UART0] = 0x01c28000, [AW_H3_DEV_UART1] = 0x01c28400, [AW_H3_DEV_UART2] = 0x01c28800, @@ -234,6 +235,8 @@ static void allwinner_h3_init(Object *obj) object_initialize_child(obj, "twi1", &s->i2c1, TYPE_AW_I2C_SUN6I); object_initialize_child(obj, "twi2", &s->i2c2, TYPE_AW_I2C_SUN6I); object_initialize_child(obj, "r_twi", &s->r_twi, TYPE_AW_I2C_SUN6I); + + object_initialize_child(obj, "wdt", &s->wdt, TYPE_AW_WDT_SUN6I); } static void allwinner_h3_realize(DeviceState *dev, Error **errp) @@ -453,6 +456,11 @@ static void allwinner_h3_realize(DeviceState *dev, Error **errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->r_twi), 0, qdev_get_gpio_in(DEVICE(&s->gic), AW_H3_GIC_SPI_R_TWI)); + /* WDT */ + sysbus_realize(SYS_BUS_DEVICE(&s->wdt), &error_fatal); + sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->wdt), 0, + s->memmap[AW_H3_DEV_WDT], 1); + /* Unimplemented devices */ for (i = 0; i < ARRAY_SIZE(unimplemented); i++) { create_unimplemented_device(unimplemented[i].device_name, diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 338dabce427..91636ab460c 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -337,6 +337,7 @@ config ALLWINNER_H3 select ALLWINNER_A10_PIT select ALLWINNER_SUN8I_EMAC select ALLWINNER_I2C + select ALLWINNER_WDT select SERIAL select ARM_TIMER select ARM_GIC