From patchwork Tue Jun 18 16:52:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 167187 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp4495879ilk; Tue, 18 Jun 2019 10:24:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOYYy+yQYJUH8Q6iFWqNxD37DxqfXApY5yX0Envm/gWxruulinOtw8uEGl80vTB6mbYlHa X-Received: by 2002:a0c:d94e:: with SMTP id t14mr27478820qvj.18.1560878641752; Tue, 18 Jun 2019 10:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560878641; cv=none; d=google.com; s=arc-20160816; b=cua1Fk6z3U+xfy20IklM4RH3v/IUTLKULGeMo1Gn8ht62b7ONmDd4cdYo9fRFt5nQ+ iqgjuPqigWa+/Hy21so9zPyVqPyFUPvthvt3vr18jDBHMoZDGXR+wNAsx+v6UyyLbOP9 d1/9AMHQE5XK0OB1WvwC/kBYI57YWapWui5DW5AU5mjrSOJppA0bTWM1/J7BdRwLQOZB O7e8m+sCtaVcC2v4i0P15Kfbk8ff84mQFimQBXosx/dkoIerEgsa4TsMfIqGZ77FBRuj Afyf2bkkJFBgCMexA3rR5RHJgBux6zUdHefpQ0tMPqjJ8A36+zzC8tUehf0Frb+FQoLv f9Xg== 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=gX8+7MWV+OYcYOCPeCD6tuOtLzUfQ7At93ryWUJ/rJ0=; b=n7q+v3VXt86F2k28waL+38GD2zqSCk9rd9AUgEu9w0w+CM0Qulx4FQm+eb8Ao+xT32 icThdCuKfvuTSXiEPmIB932WBPDfcM/R5WpeOty55lEjM/jVhibRnexoxwFeTZ1iHtI4 peHCHJlPk9mKSPkuHeG7VMoXhOrxXjnFCwED4pPclvfA+p8oph+c/LzXoJyJnxUuqUPc CvjLjZ3E+cOTHD2X3njpmSgjWKAuTZYUFpAo1cXWmi2uSXmT8u+qDUjcJrcv4+4OCttq Pd8Tov36MAbaj6thSKxbA7ZumZUR5ZzOcAY3ZYRPIMjA/xR/dAqkkUMLnxQJ4KiK3DdO drNg== 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 s54si661458qte.241.2019.06.18.10.24.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Jun 2019 10:24:01 -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 ([::1]:60464 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdHpx-0006vA-Cr for patch@linaro.org; Tue, 18 Jun 2019 13:24:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60326) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdHMr-0007xd-KW for qemu-devel@nongnu.org; Tue, 18 Jun 2019 12:53:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdHMp-0003rq-Gn for qemu-devel@nongnu.org; Tue, 18 Jun 2019 12:53:57 -0400 Received: from 3.mo69.mail-out.ovh.net ([188.165.52.203]:46562) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hdHMp-0003o9-A3 for qemu-devel@nongnu.org; Tue, 18 Jun 2019 12:53:55 -0400 Received: from player157.ha.ovh.net (unknown [10.108.42.83]) by mo69.mail-out.ovh.net (Postfix) with ESMTP id 74F275E026 for ; Tue, 18 Jun 2019 18:53:53 +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 player157.ha.ovh.net (Postfix) with ESMTPSA id 07F456EB5154; Tue, 18 Jun 2019 16:53:48 +0000 (UTC) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Peter Maydell Date: Tue, 18 Jun 2019 18:52:54 +0200 Message-Id: <20190618165311.27066-5-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190618165311.27066-1-clg@kaod.org> References: <20190618165311.27066-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 1666613338521832209 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrtddtgdejjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 188.165.52.203 Subject: [Qemu-devel] [PATCH v2 04/21] hw/arm/aspeed: Add RTC to SoC 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: Andrew Jeffery , 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 --- include/hw/arm/aspeed_soc.h | 2 ++ hw/arm/aspeed_soc.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) -- 2.21.0 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 1cc98b9f4045..5faa78d81fd6 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) {