From patchwork Sat May 25 15:12:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 165181 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4951845ili; Sat, 25 May 2019 08:20:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJ9INVGhLjlldL1w2S+YZu4MyTA8Im9FSD5OOBJ2I2IX1l4G0mphhIryPzcc227oRJ7JU3 X-Received: by 2002:a67:fc91:: with SMTP id x17mr21065456vsp.31.1558797655699; Sat, 25 May 2019 08:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558797655; cv=none; d=google.com; s=arc-20160816; b=XEunXtMM9ZVXk7KRhNA9OsbDhJ8PXzhiN7+VyDnn+jHPxRTSlqdRmPClPG0q7AEM3P u9N5G5W6pzmjNOVfX5d8wgIrb88EnRHr+mrZQ2UkSmNsXcyfbfXB/O22mC+XjOJcnkzn ZCIJUCfnY+oK5hLjm3rmKA8y6ReW6YSnBZzmIgKOKZhXFkDLfxaWyP7D33z8MAUUREtL qAYkuTLDTLhUGRPWFVq4abhJFRBgy9KART+AfduCgK33FfiBd2WhZ82/07N1PE5mqTdn voY/mWSIWvelGnmnapjAqkr9XGE4BScBHRUIxSETfWShN8JENZAy46zPDDa/h1hOy1BH cBMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from; bh=gkHKQOl9Piw+J9fLp0nAdM99S3uIYNTsgDRJHxccht4=; b=hv4PYvxOafHbZ/ivp+AwyRfUPEx48yjGaP2cusLhHUUyQIazVamlQWHpHIAVdAYgvm lLtEgFR1kpbfgytcpbvy7zt4qM0qaLGUyju+m4LDd59fX+paxU9HkD2dAmhfj6+bvqxp tEUlG5G6d0/QXXaKA5zJ5KFX1dkQCmMTFHLUeLt509K5gR2eW59OpuqU47E6yYDXpO57 P+E7lUp2kgP3WtSnHMAPCk5NcZXcAh+pBDsLVBrb6EYD/XYhjcBDZk7T0kokP53IGUPj DCsKbOOrhaSQbRUz4iw6jq5cAAMIfEX6jfAeoEnM6VG4mFB6HEEYfv1XpeLHG9D0EdID Z/KQ== ARC-Authentication-Results: i=1; mx.google.com; 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" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q25si1216307vsk.158.2019.05.25.08.20.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 25 May 2019 08:20:55 -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; 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" Received: from localhost ([127.0.0.1]:43290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUYTf-00031w-4S for patch@linaro.org; Sat, 25 May 2019 11:20:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hUYMa-0005fW-01 for qemu-devel@nongnu.org; Sat, 25 May 2019 11:13:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hUYMY-0001bG-QB for qemu-devel@nongnu.org; Sat, 25 May 2019 11:13:35 -0400 Received: from 17.mo5.mail-out.ovh.net ([46.105.56.132]:52356) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hUYMY-0001ZK-K3 for qemu-devel@nongnu.org; Sat, 25 May 2019 11:13:34 -0400 Received: from player698.ha.ovh.net (unknown [10.109.143.145]) by mo5.mail-out.ovh.net (Postfix) with ESMTP id 52CE8237AB2 for ; Sat, 25 May 2019 17:13:31 +0200 (CEST) Received: from kaod.org (lfbn-1-10649-41.w90-89.abo.wanadoo.fr [90.89.235.41]) (Authenticated sender: clg@kaod.org) by player698.ha.ovh.net (Postfix) with ESMTPSA id BE434625A77F; Sat, 25 May 2019 15:13:24 +0000 (UTC) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Peter Maydell Date: Sat, 25 May 2019 17:12:27 +0200 Message-Id: <20190525151241.5017-6-clg@kaod.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190525151241.5017-1-clg@kaod.org> References: <20190525151241.5017-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 6600869682718346001 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddruddukedgkeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 46.105.56.132 Subject: [Qemu-devel] [PATCH 05/19] hw/arm/aspeed: Add RTC to SoC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , =?utf-8?q?C=C3=A9dric_Le_Goater?= , qemu-arm@nongnu.org, qemu-devel@nongnu.org, Joel Stanley Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley All systems have an RTC. The IRQ is hooked up but the model does not use it at this stage. There is no guest code that uses it, so this limitation is acceptable. Signed-off-by: Joel Stanley Reviewed-by: Peter Maydell Signed-off-by: Cédric Le Goater --- include/hw/arm/aspeed_soc.h | 2 ++ hw/arm/aspeed_soc.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) -- 2.20.1 diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 88b901d5dfa9..fa0ba957a611 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -16,6 +16,7 @@ #include "hw/misc/aspeed_scu.h" #include "hw/misc/aspeed_sdmc.h" #include "hw/timer/aspeed_timer.h" +#include "hw/timer/aspeed_rtc.h" #include "hw/i2c/aspeed_i2c.h" #include "hw/ssi/aspeed_smc.h" #include "hw/watchdog/wdt_aspeed.h" @@ -32,6 +33,7 @@ typedef struct AspeedSoCState { ARMCPU cpu; MemoryRegion sram; AspeedVICState vic; + AspeedRtcState rtc; AspeedTimerCtrlState timerctrl; AspeedI2CState i2c; AspeedSCUState scu; diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index 4b705afd096a..d1dc8f03f35c 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -189,6 +189,9 @@ static void aspeed_soc_init(Object *obj) sysbus_init_child_obj(obj, "vic", OBJECT(&s->vic), sizeof(s->vic), TYPE_ASPEED_VIC); + sysbus_init_child_obj(obj, "rtc", OBJECT(&s->rtc), sizeof(s->rtc), + TYPE_ASPEED_RTC); + sysbus_init_child_obj(obj, "timerctrl", OBJECT(&s->timerctrl), sizeof(s->timerctrl), TYPE_ASPEED_TIMER); object_property_add_const_link(OBJECT(&s->timerctrl), "scu", @@ -275,6 +278,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->vic), 1, qdev_get_gpio_in(DEVICE(&s->cpu), ARM_CPU_FIQ)); + /* RTC */ + object_property_set_bool(OBJECT(&s->rtc), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, sc->info->memmap[ASPEED_RTC]); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, + aspeed_soc_get_irq(s, ASPEED_RTC)); + /* Timer */ object_property_set_bool(OBJECT(&s->timerctrl), true, "realized", &err); if (err) {