From nobody Mon Feb 9 20:12:46 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=google.com ARC-Seal: i=1; a=rsa-sha256; t=1675900545; cv=none; d=zohomail.com; s=zohoarc; b=XmjxnU8SsLd51n1xFBu+PdqfiHiZ31YMDXUBcmVz8E08l+vXHV+aMcHcPgfztKESrJ3QbA1durV79VGnYh9Qaf68H3ASJbckEJ+jT0kqqIocSk4ls+4S3lGosemeVdJSJ4+GaNq9n7aS9eIsnGxmmcMqZ2Ig3dyGdMFKH4gHRNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675900545; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0+NgHraPggD1/G/0Zic2rQg5R0ycbmNyiemBx69rPPw=; b=aUdI2vjtnCwAxyzoYipTg90bGhGo4q7IuIjWmr/9NqVow+Tby9oQs7vKoqOeCIHzNFqKSZUnu89chW/TOTP4FCzpOcA9MYF7jIAxGQCA+uuf2qB9f5ZPgrVPXokiX/SulYEVoOyhCQBqROB2/CkFNrkTiUXiyxrU2ea0h2nTcXI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1675900545230662.1760227807574; Wed, 8 Feb 2023 15:55:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pPuH6-0002Ut-V6; Wed, 08 Feb 2023 18:54:52 -0500 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 <3QjbkYwgKCmUZXKDRWVKJRRJOH.FRPTHPX-GHYHOQRQJQX.RUJ@flex--wuhaotsh.bounces.google.com>) id 1pPuH1-0002U7-Sm for qemu-devel@nongnu.org; Wed, 08 Feb 2023 18:54:47 -0500 Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3QjbkYwgKCmUZXKDRWVKJRRJOH.FRPTHPX-GHYHOQRQJQX.RUJ@flex--wuhaotsh.bounces.google.com>) id 1pPuH0-0003X7-16 for qemu-devel@nongnu.org; Wed, 08 Feb 2023 18:54:47 -0500 Received: by mail-pf1-x449.google.com with SMTP id s8-20020a056a00178800b00593e2189278so110986pfg.19 for ; Wed, 08 Feb 2023 15:54:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1675900483; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=0+NgHraPggD1/G/0Zic2rQg5R0ycbmNyiemBx69rPPw=; b=TGqzduTXpM4UcqOd9A9Fd8NwGd2CGYTtAhHKkgCE0F+vCNnVqUNakxa3xxk8PZRmw/ kAyxu/dUHRYK4zOnqmsm0zUMyWzN2nmNVPKhaUyqxVG5Ky4jVrE11kztbxgXyaEf+miA oK6WOT6u7Dop7k8P2L1+8O0r08ilBMgjI0VP+AU+692Qf4zk1fPny1Y0U+ZulawShBgN QD2OTu15kC3naQ3SZGDFTifH75HmnopIXWrVpjgnrG/pzoeMSogqn4NvrQ8PtIq4BA4A b5X9wEDVveRmpVwL6AZi6soJ/Cz+0CyhLpT3+Clcg25B60MAaNmeDxrgrXKHWOktv42C ZxmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1675900483; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0+NgHraPggD1/G/0Zic2rQg5R0ycbmNyiemBx69rPPw=; b=h4dHK4spGA7/62baAiMdCG98lhk0i1/rPk0SM01EbOWVFfSeZh7wbuO5Xv+myTidZz Ne7a6qcn4pN5PnIz6afYvfffKBN6kmUfjrjkLPc2xofiXLblZKE9eZywA4gnki1POZ5e 5OJpf3uGCIHTKiGuqO7sFlqT/QS6THVwpUofHzpAPusUw2n3JTVmxcYAYmDPZhE8+tgS NhzzQhZCeypwjLqS5kLeL0V+lUtHFipI4McXvUp1IODGOHn2U/TfhP3BYG6NaRqxW68b UhGYqXuiHzAgsfaPxhu1c3dB4c2tCqg26XnlT/hiCUueBsv/n3XhLbKQY40wViaocItt 0agQ== X-Gm-Message-State: AO0yUKXrq9M6zeL/VLNIurGNOBxz+IlFvrWRXtVMzPM+2HwOtIO4rAZm 6c+FnPiv5qqH1tfc5GhRirXIOr/HH1bqog== X-Google-Smtp-Source: AK7set+1jQeuNmeT/igKY1msI+ttU78zetVqp7ySXDXQPYTTP8js00dB+l3h0/XVNP24JjmxKbuiGAp2gTceHA== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a62:4e93:0:b0:5a2:d581:efe1 with SMTP id c141-20020a624e93000000b005a2d581efe1mr2225919pfb.28.1675900482733; Wed, 08 Feb 2023 15:54:42 -0800 (PST) Date: Wed, 8 Feb 2023 15:54:33 -0800 In-Reply-To: <20230208235433.3989937-1-wuhaotsh@google.com> Mime-Version: 1.0 References: <20230208235433.3989937-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.39.1.519.gcb327c4b5f-goog Message-ID: <20230208235433.3989937-4-wuhaotsh@google.com> Subject: [PATCH v3 3/3] hw/arm: Attach PSPI module to NPCM7XX SoC From: Hao Wu To: peter.maydell@linaro.org Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, titusr@google.com, Philippe Mathieu-Daude Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2607:f8b0:4864:20::449; envelope-from=3QjbkYwgKCmUZXKDRWVKJRRJOH.FRPTHPX-GHYHOQRQJQX.RUJ@flex--wuhaotsh.bounces.google.com; helo=mail-pf1-x449.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, USER_IN_DEF_DKIM_WL=-7.5 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @google.com) X-ZM-MESSAGEID: 1675900546351100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Hao Wu Reviewed-by: Titus Rwantare Reviewed-by: Philippe Mathieu-Daude --- docs/system/arm/nuvoton.rst | 2 +- hw/arm/npcm7xx.c | 25 +++++++++++++++++++++++-- include/hw/arm/npcm7xx.h | 2 ++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst index c38df32bde..0424cae4b0 100644 --- a/docs/system/arm/nuvoton.rst +++ b/docs/system/arm/nuvoton.rst @@ -49,6 +49,7 @@ Supported devices * SMBus controller (SMBF) * Ethernet controller (EMC) * Tachometer + * Peripheral SPI controller (PSPI) =20 Missing devices --------------- @@ -64,7 +65,6 @@ Missing devices =20 * Ethernet controller (GMAC) * USB device (USBD) - * Peripheral SPI controller (PSPI) * SD/MMC host * PECI interface * PCI and PCIe root complex and bridges diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index d85cc02765..15ff21d047 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -86,6 +86,8 @@ enum NPCM7xxInterrupt { NPCM7XX_EMC1RX_IRQ =3D 15, NPCM7XX_EMC1TX_IRQ, NPCM7XX_MMC_IRQ =3D 26, + NPCM7XX_PSPI2_IRQ =3D 28, + NPCM7XX_PSPI1_IRQ =3D 31, NPCM7XX_TIMER0_IRQ =3D 32, /* Timer Module 0 */ NPCM7XX_TIMER1_IRQ, NPCM7XX_TIMER2_IRQ, @@ -220,6 +222,12 @@ static const hwaddr npcm7xx_emc_addr[] =3D { 0xf0826000, }; =20 +/* Register base address for each PSPI Module */ +static const hwaddr npcm7xx_pspi_addr[] =3D { + 0xf0200000, + 0xf0201000, +}; + static const struct { hwaddr regs_addr; uint32_t unconnected_pins; @@ -444,6 +452,10 @@ static void npcm7xx_init(Object *obj) object_initialize_child(obj, "emc[*]", &s->emc[i], TYPE_NPCM7XX_EM= C); } =20 + for (i =3D 0; i < ARRAY_SIZE(s->pspi); i++) { + object_initialize_child(obj, "pspi[*]", &s->pspi[i], TYPE_NPCM_PSP= I); + } + object_initialize_child(obj, "mmc", &s->mmc, TYPE_NPCM7XX_SDHCI); } =20 @@ -715,6 +727,17 @@ static void npcm7xx_realize(DeviceState *dev, Error **= errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->mmc), 0, npcm7xx_irq(s, NPCM7XX_MMC_IRQ)); =20 + /* PSPI */ + QEMU_BUILD_BUG_ON(ARRAY_SIZE(npcm7xx_pspi_addr) !=3D ARRAY_SIZE(s->psp= i)); + for (i =3D 0; i < ARRAY_SIZE(s->pspi); i++) { + SysBusDevice *sbd =3D SYS_BUS_DEVICE(&s->pspi[i]); + int irq =3D (i =3D=3D 0) ? NPCM7XX_PSPI1_IRQ : NPCM7XX_PSPI2_IRQ; + + sysbus_realize(sbd, &error_abort); + sysbus_mmio_map(sbd, 0, npcm7xx_pspi_addr[i]); + sysbus_connect_irq(sbd, 0, npcm7xx_irq(s, irq)); + } + create_unimplemented_device("npcm7xx.shm", 0xc0001000, 4 * = KiB); create_unimplemented_device("npcm7xx.vdmx", 0xe0800000, 4 * = KiB); create_unimplemented_device("npcm7xx.pcierc", 0xe1000000, 64 * = KiB); @@ -724,8 +747,6 @@ static void npcm7xx_realize(DeviceState *dev, Error **e= rrp) create_unimplemented_device("npcm7xx.peci", 0xf0100000, 4 * = KiB); create_unimplemented_device("npcm7xx.siox[1]", 0xf0101000, 4 * = KiB); create_unimplemented_device("npcm7xx.siox[2]", 0xf0102000, 4 * = KiB); - create_unimplemented_device("npcm7xx.pspi1", 0xf0200000, 4 * = KiB); - create_unimplemented_device("npcm7xx.pspi2", 0xf0201000, 4 * = KiB); create_unimplemented_device("npcm7xx.ahbpci", 0xf0400000, 1 * = MiB); create_unimplemented_device("npcm7xx.mcphy", 0xf05f0000, 64 * = KiB); create_unimplemented_device("npcm7xx.gmac1", 0xf0802000, 8 * = KiB); diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h index f1b7e4a48d..72c7722096 100644 --- a/include/hw/arm/npcm7xx.h +++ b/include/hw/arm/npcm7xx.h @@ -32,6 +32,7 @@ #include "hw/nvram/npcm7xx_otp.h" #include "hw/timer/npcm7xx_timer.h" #include "hw/ssi/npcm7xx_fiu.h" +#include "hw/ssi/npcm_pspi.h" #include "hw/usb/hcd-ehci.h" #include "hw/usb/hcd-ohci.h" #include "target/arm/cpu.h" @@ -104,6 +105,7 @@ struct NPCM7xxState { NPCM7xxFIUState fiu[2]; NPCM7xxEMCState emc[2]; NPCM7xxSDHCIState mmc; + NPCMPSPIState pspi[2]; }; =20 #define TYPE_NPCM7XX "npcm7xx" --=20 2.39.1.519.gcb327c4b5f-goog