From patchwork Thu Mar 28 06:22:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 10874485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D2E5417E0 for ; Thu, 28 Mar 2019 06:28:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACDC328BAE for ; Thu, 28 Mar 2019 06:28:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E97628BF2; Thu, 28 Mar 2019 06:28:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3132728BAE for ; Thu, 28 Mar 2019 06:28:37 +0000 (UTC) Received: from localhost ([127.0.0.1]:59914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9OWh-0004Uv-Rh for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Mar 2019 02:28:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33163) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h9OVC-0003Hx-TJ for qemu-devel@nongnu.org; Thu, 28 Mar 2019 02:27:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h9ORE-00019a-Pd for qemu-devel@nongnu.org; Thu, 28 Mar 2019 02:22:57 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:36903) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h9ORD-00017F-Fl; Thu, 28 Mar 2019 02:22:55 -0400 Received: by mail-pl1-x642.google.com with SMTP id q6so4488091pll.4; Wed, 27 Mar 2019 23:22:55 -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=T2OKv2m/G6Ac9dhT4+Z47k07pb4CVTwyvO34O6COeYw=; b=oPwWZ7T8NdrkR/EmICIfVNzWPankJCntayBQY2EbkVAceSIjP7WuKb1APqgoBcF/F+ cEsrk9CydV+XUVGnousHxNtm0t7Uvh6TYiwrarkfNq+KvSw0c+RSfzehRkbE6IS2vdJE gbU1+wKglm453SrEPtiwlVrc78BQcxoNXuhAnd7ZMkH3ZCU8kuK0ouZ8sEHCP2mH/VLb +vMNQCmVPqWH1JiKGDWnwppt415pCpvR75/T3J8q16wc0IN7wMpXB3SGBDimUl/QzCS6 eeNicFzjMEQ5/2XuGCJ1k77e3OEsYkrBSHJG5Z/491KVfY7Xb2ZmS56r7xbqr3BG/nfg AVyg== 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=T2OKv2m/G6Ac9dhT4+Z47k07pb4CVTwyvO34O6COeYw=; b=PqYvBMOfgli5vcEFKnQlqXLIE5Gxq6ZEgECSBS2MAwWGnVH2ny5q5BBRR0m6JR3roS 4SPG9bCg5VwIRjVsMwRS4WzShwY8TsAZtq1RV5FA6LbcyWTT+hdXKDFdAHhFeyM7vvK8 XjkzcMkqRip6O9w+jlQ+/cVdDMYkqkEjuXF/SSbyyRd0pZ+YkZGrIyRg0E8ZCySy4aeB ZZ6kSd5jkFg31IFUkYiZ3fZJDvRMNyg96PugYP+ioPZeb0xkuus2BD05n51Wz3ni/Ixc CTB8E10sCwMSaii2BNA6bWQ7Pp6+oM31dnucARRpgDKWjETStTEPs8DTpteB5SOFGNSg 4KCQ== X-Gm-Message-State: APjAAAUG4aFk0TpO89sm7iYrgy7PbjtpBqegXolarkBv3e4cxO4WwSeB nzeJ7iZpXcL6P/H45p8qVC4= X-Google-Smtp-Source: APXvYqwig1KxSvFWHbJ25e7BoHab7Gp0xACqhSk0yTerCTmQ+CYghCjNwW8ImkczR4qDBb7qd/Pzfw== X-Received: by 2002:a17:902:7892:: with SMTP id q18mr31016373pll.163.1553754174488; Wed, 27 Mar 2019 23:22:54 -0700 (PDT) Received: from voyager.jms.id.au ([36.255.48.244]) by smtp.gmail.com with ESMTPSA id a8sm11035145pfo.144.2019.03.27.23.22.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Mar 2019 23:22:53 -0700 (PDT) Received: by voyager.jms.id.au (sSMTP sendmail emulation); Thu, 28 Mar 2019 16:52:48 +1030 From: Joel Stanley To: Peter Maydell , =?utf-8?q?C=C3=A9dric_Le_Goate?= =?utf-8?q?r?= , Andrew Jeffery Date: Thu, 28 Mar 2019 16:52:22 +1030 Message-Id: <20190328062222.8409-3-joel@jms.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190328062222.8409-1-joel@jms.id.au> References: <20190328062222.8409-1-joel@jms.id.au> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH 2/2] 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: qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater --- hw/arm/aspeed_soc.c | 15 +++++++++++++++ include/hw/arm/aspeed_soc.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index a27233d4876b..628ec633c91a 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -32,6 +32,7 @@ #define ASPEED_SOC_SDMC_BASE 0x1E6E0000 #define ASPEED_SOC_SCU_BASE 0x1E6E2000 #define ASPEED_SOC_SRAM_BASE 0x1E720000 +#define ASPEED_SOC_RTC_BASE 0x1E781000 #define ASPEED_SOC_TIMER_BASE 0x1E782000 #define ASPEED_SOC_WDT_BASE 0x1E785000 #define ASPEED_SOC_I2C_BASE 0x1E78A000 @@ -135,6 +136,10 @@ static void aspeed_soc_init(Object *obj) object_property_add_child(obj, "i2c", OBJECT(&s->i2c), NULL); qdev_set_parent_bus(DEVICE(&s->i2c), sysbus_get_default()); + object_initialize(&s->rtc, sizeof(s->rtc), TYPE_ASPEED_RTC); + object_property_add_child(obj, "rtc", OBJECT(&s->rtc), NULL); + qdev_set_parent_bus(DEVICE(&s->rtc), sysbus_get_default()); + object_initialize(&s->fmc, sizeof(s->fmc), sc->info->fmc_typename); object_property_add_child(obj, "fmc", OBJECT(&s->fmc), NULL); qdev_set_parent_bus(DEVICE(&s->fmc), sysbus_get_default()); @@ -231,6 +236,16 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->timerctrl), i, irq); } + /* 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, ASPEED_SOC_RTC_BASE); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, + qdev_get_gpio_in(DEVICE(&s->vic), 22)); + /* UART - attach an 8250 to the IO space as our UART5 */ if (serial_hd(0)) { qemu_irq uart5 = qdev_get_gpio_in(DEVICE(&s->vic), uart_irqs[4]); diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 11ec0179db50..a5f8f219e404 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -17,6 +17,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" @@ -33,6 +34,7 @@ typedef struct AspeedSoCState { ARMCPU cpu; MemoryRegion sram; AspeedVICState vic; + AspeedRtcState rtc; AspeedTimerCtrlState timerctrl; AspeedI2CState i2c; AspeedSCUState scu;