From nobody Wed Nov 19 20:18:46 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=none dis=none) header.from=git.sr.ht Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1702235211003303.43118348141456; Sun, 10 Dec 2023 11:06:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rCP74-0007D1-6h; Sun, 10 Dec 2023 14:05:14 -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 ) id 1rCP71-0007C8-Ii; Sun, 10 Dec 2023 14:05:11 -0500 Received: from mail-b.sr.ht ([173.195.146.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rCP6z-0000jt-Cs; Sun, 10 Dec 2023 14:05:11 -0500 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id 159E311F029; Sun, 10 Dec 2023 19:05:07 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~inesvarhol Date: Sun, 10 Dec 2023 19:06:50 +0100 Subject: [PATCH qemu 3/3] hw/arm: Connect STM32L4xx SYSCFG to STM32L4x5 SoC MIME-Version: 1.0 Message-ID: <170223510627.13579.3191933474458037037-3@git.sr.ht> X-Mailer: git.sr.ht In-Reply-To: <170223510627.13579.3191933474458037037-0@git.sr.ht> To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, alistair@alistair23.me, philmd@linaro.org, peter.maydell@linaro.org, ines.varhol@telecom-paris.fr, arnaud.minier@telecom-paris.fr Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Reply-To: ~inesvarhol Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1702235212967100003 From: In=C3=A8s Varhol Signed-off-by: Arnaud Minier Signed-off-by: In=C3=A8s Varhol --- hw/arm/Kconfig | 1 + hw/arm/stm32l4x5_soc.c | 24 ++++++++++++++++-------- include/hw/arm/stm32l4x5_soc.h | 2 ++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 9c9d5bb541..ea77977d4b 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -458,6 +458,7 @@ config STM32L4X5_SOC bool select ARM_V7M select OR_IRQ + select STM32L4XX_SYSCFG select STM32L4X5_EXTI =20 config XLNX_ZYNQMP_ARM diff --git a/hw/arm/stm32l4x5_soc.c b/hw/arm/stm32l4x5_soc.c index cf786eac1d..9b45a9e606 100644 --- a/hw/arm/stm32l4x5_soc.c +++ b/hw/arm/stm32l4x5_soc.c @@ -46,6 +46,7 @@ #define SRAM2_SIZE (32 * KiB) =20 #define EXTI_ADDR 0x40010400 +#define SYSCFG_ADDR 0x40010000 =20 #define NUM_EXTI_IRQ 40 /* Match exti line connections with their CPU IRQ number */ @@ -90,6 +91,8 @@ static void stm32l4x5_soc_initfn(Object *obj) =20 object_initialize_child(obj, "exti", &s->exti, TYPE_STM32L4X5_EXTI); =20 + object_initialize_child(obj, "syscfg", &s->syscfg, TYPE_STM32L4XX_SYSC= FG); + s->sysclk =3D qdev_init_clock_in(DEVICE(s), "sysclk", NULL, NULL, 0); s->refclk =3D qdev_init_clock_in(DEVICE(s), "refclk", NULL, NULL, 0); } @@ -167,6 +170,15 @@ static void stm32l4x5_soc_realize(DeviceState *dev_soc= , Error **errp) return; } =20 + /* System configuration controller */ + dev =3D DEVICE(&s->syscfg); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->syscfg), errp)) { + return; + } + busdev =3D SYS_BUS_DEVICE(dev); + sysbus_mmio_map(busdev, 0, SYSCFG_ADDR); + + /* EXTI device */ dev =3D DEVICE(&s->exti); if (!sysbus_realize(SYS_BUS_DEVICE(&s->exti), errp)) { return; @@ -178,13 +190,10 @@ static void stm32l4x5_soc_realize(DeviceState *dev_so= c, Error **errp) sysbus_connect_irq(busdev, i, qdev_get_gpio_in(armv7m, exti_irq[i]= )); } =20 - /* - * Uncomment when Syscfg is implemented - * for (i =3D 0; i < 16; i++) { - * qdev_connect_gpio_out(DEVICE(&s->syscfg), i, - * qdev_get_gpio_in(dev, i)); - * } - */ + for (i =3D 0; i < 16; i++) { + qdev_connect_gpio_out(DEVICE(&s->syscfg), i, + qdev_get_gpio_in(dev, i)); + } =20 /* APB1 BUS */ create_unimplemented_device("TIM2", 0x40000000, 0x400); @@ -223,7 +232,6 @@ static void stm32l4x5_soc_realize(DeviceState *dev_soc,= Error **errp) /* RESERVED: 0x40009800, 0x6800 */ =20 /* APB2 BUS */ - create_unimplemented_device("SYSCFG", 0x40010000, 0x30); create_unimplemented_device("VREFBUF", 0x40010030, 0x1D0); create_unimplemented_device("COMP", 0x40010200, 0x200); /* RESERVED: 0x40010800, 0x1400 */ diff --git a/include/hw/arm/stm32l4x5_soc.h b/include/hw/arm/stm32l4x5_soc.h index ac47158596..5ff757f15b 100644 --- a/include/hw/arm/stm32l4x5_soc.h +++ b/include/hw/arm/stm32l4x5_soc.h @@ -37,6 +37,7 @@ #include "qemu/units.h" #include "hw/qdev-core.h" #include "hw/arm/armv7m.h" +#include "hw/misc/stm32l4xx_syscfg.h" #include "hw/misc/stm32l4x5_exti.h" #include "qom/object.h" =20 @@ -52,6 +53,7 @@ struct Stm32l4x5SocState { ARMv7MState armv7m; =20 Stm32l4x5ExtiState exti; + STM32L4xxSyscfgState syscfg; =20 MemoryRegion sram1; MemoryRegion sram2; --=20 2.38.5