From nobody Wed Apr 16 15:11:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 155077632888141.51514267256471; Thu, 21 Feb 2019 11:12:08 -0800 (PST) Received: from localhost ([127.0.0.1]:37066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwtlM-0003mS-MS for importer@patchew.org; Thu, 21 Feb 2019 14:12:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwtXt-00005j-W8 for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwtXr-0007Vd-I6 for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:09 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:35736) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gwtXr-0007UV-9J for qemu-devel@nongnu.org; Thu, 21 Feb 2019 13:58:07 -0500 Received: by mail-wr1-x433.google.com with SMTP id t18so31879910wrx.2 for ; Thu, 21 Feb 2019 10:58:07 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id c18sm29065085wre.32.2019.02.21.10.58.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Feb 2019 10:58:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=yjhsrKSxsIGixPKEGIdTSx/b3ttWRTc/Rj+eZtFIv6c=; b=ruAdVKUednxw9QjSF/4jonZBja4yJ2ZwLjIQUHhRFsK3kQ9TNuaA5ef+dWjo9ofCtH wbOtZFrjzfWokm9c8V53VIg3FSXXLrfBjGFOdKNhQ79tjzVIPC39WE3hF0ly6yDsP70p uEDaEdK/wD+IRpDtDEUd7LGQEHtgunGmOSXTuxDAmuwaadeyUH0INE2M6UiohSJD4XIg l0CoAfBNDmDfwFxFmWJOG0kgcIyw9KBJa10mUsy6Mu0iT7fWPwJPXGvxssYXOh3RFOgw zF2xpivJd46AOIDK+pOVjvQgWX9EXxqG80A4Tas5D/viwcwyH91TZR1BQ9W7D5N98hDr LvCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yjhsrKSxsIGixPKEGIdTSx/b3ttWRTc/Rj+eZtFIv6c=; b=Co6zhWFOsXONL1Y/uMiPJWH3t9o7EluQ3OHnMWa8hQ65iDVc/hYBss9m7s4ApbggNP fSf9nBedFqpV4M/LS1/tujiWSA7EA4zOfhCP3b8FquQD4KOcVnxHHjnHCovau9IoV54H nvFB69epbW4desMycdNxNBFU8uB4eaXheDNSqqc2NMh1weB8wEtWLqX85N4atxNGG5Lq gsPkByROneLZM5ijDIl/ibHj/myO4HMEK7GprzZXDoNPHfGVLa5asWJfNzRGPd2n+/+s CyiiO/rPsSpoF+XJs44hIZG7zNZuKFF031BbliIwvdmUbkUIZXJ0C1bg9tfkIUtTYD2X k78Q== X-Gm-Message-State: AHQUAuZczVJ5ke7pu1MPljN5p63md+Sehby8Iu5fM5zKugOA/b52E2is bK6tN44qyWajSW7OUw99bwW/cP0nJRk= X-Google-Smtp-Source: AHgI3IaTLRaUCx8vejQrPqlGwfdreOcnwyDPEXrb7BAa2r5u3W1gA2aHmV45q3OkDZ8usDp79N7dkA== X-Received: by 2002:a5d:5681:: with SMTP id f1mr29623779wrv.95.1550775486165; Thu, 21 Feb 2019 10:58:06 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2019 18:57:37 +0000 Message-Id: <20190221185739.25362-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190221185739.25362-1-peter.maydell@linaro.org> References: <20190221185739.25362-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 Subject: [Qemu-devel] [PULL 19/21] hw/arm/musca: Wire up PL031 RTC 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Wire up the PL031 RTC for the Musca board. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson --- hw/arm/musca.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/hw/arm/musca.c b/hw/arm/musca.c index c4095c4579b..378912b7385 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -30,6 +30,7 @@ #include "hw/misc/tz-mpc.h" #include "hw/misc/tz-ppc.h" #include "hw/misc/unimp.h" +#include "hw/timer/pl031.h" =20 #define MUSCA_NUMIRQ_MAX 96 #define MUSCA_PPC_MAX 3 @@ -73,7 +74,7 @@ typedef struct { UnimplementedDeviceState spi; UnimplementedDeviceState scc; UnimplementedDeviceState timer; - UnimplementedDeviceState rtc; + PL031State rtc; UnimplementedDeviceState pvt; UnimplementedDeviceState sdio; UnimplementedDeviceState gpio; @@ -98,6 +99,14 @@ typedef struct { */ #define SYSCLK_FRQ 40000000 =20 +static qemu_irq get_sse_irq_in(MuscaMachineState *mms, int irqno) +{ + /* Return a qemu_irq which will signal IRQ n to all CPUs in the SSE. */ + assert(irqno < MUSCA_NUMIRQ_MAX); + + return qdev_get_gpio_in(DEVICE(&mms->cpu_irq_splitter[irqno]), 0); +} + /* * Most of the devices in the Musca board sit behind Peripheral Protection * Controllers. These data structures define the layout of which devices @@ -265,6 +274,17 @@ static MemoryRegion *make_mpc(MuscaMachineState *mms, = void *opaque, return sysbus_mmio_get_region(SYS_BUS_DEVICE(mpc), 0); } =20 +static MemoryRegion *make_rtc(MuscaMachineState *mms, void *opaque, + const char *name, hwaddr size) +{ + PL031State *rtc =3D opaque; + + sysbus_init_child_obj(OBJECT(mms), name, rtc, sizeof(mms->rtc), TYPE_P= L031); + object_property_set_bool(OBJECT(rtc), true, "realized", &error_fatal); + sysbus_connect_irq(SYS_BUS_DEVICE(rtc), 0, get_sse_irq_in(mms, 39)); + return sysbus_mmio_get_region(SYS_BUS_DEVICE(rtc), 0); +} + static MemoryRegion *make_musca_a_devs(MuscaMachineState *mms, void *opaqu= e, const char *name, hwaddr size) { @@ -287,7 +307,7 @@ static MemoryRegion *make_musca_a_devs(MuscaMachineStat= e *mms, void *opaque, { "i2c1", make_unimp_dev, &mms->i2c[1], 0x5000, 0x1000 }, { "i2s", make_unimp_dev, &mms->i2s, 0x6000, 0x1000 }, { "pwm0", make_unimp_dev, &mms->pwm[0], 0x7000, 0x1000 }, - { "rtc", make_unimp_dev, &mms->rtc, 0x8000, 0x1000 }, + { "rtc", make_rtc, &mms->rtc, 0x8000, 0x1000 }, { "qspi", make_unimp_dev, &mms->qspi, 0xa000, 0x1000 }, { "timer", make_unimp_dev, &mms->timer, 0xb000, 0x1000 }, { "scc", make_unimp_dev, &mms->scc, 0xc000, 0x1000 }, @@ -447,7 +467,7 @@ static void musca_init(MachineState *machine) { "spi", make_unimp_dev, &mms->spi, 0x4010a000, 0x1000 }, { "scc", make_unimp_dev, &mms->scc, 0x5010b000, 0x1000 }, { "timer", make_unimp_dev, &mms->timer, 0x4010c000, 0x1000= }, - { "rtc", make_unimp_dev, &mms->rtc, 0x4010d000, 0x1000 }, + { "rtc", make_rtc, &mms->rtc, 0x4010d000, 0x1000 }, { "pvt", make_unimp_dev, &mms->pvt, 0x4010e000, 0x1000 }, { "sdio", make_unimp_dev, &mms->sdio, 0x4010f000, 0x1000 }, }, --=20 2.20.1