From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45009C531C9 for ; Sat, 25 Jul 2026 01:28:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wnRAA-00051n-69; Fri, 24 Jul 2026 21:26:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wnRA8-00050L-74 for qemu-arm@nongnu.org; Fri, 24 Jul 2026 21:26:48 -0400 Received: from mail-vs1-xe2e.google.com ([2607:f8b0:4864:20::e2e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wnRA6-0006GM-LL for qemu-arm@nongnu.org; Fri, 24 Jul 2026 21:26:47 -0400 Received: by mail-vs1-xe2e.google.com with SMTP id ada2fe7eead31-737de525d2eso744363137.2 for ; Fri, 24 Jul 2026 18:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784942806; x=1785547606; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Sv4Do54efz6CSaj7wJa92SFTaZ0J6tHEWKHA9fHHKzQ=; b=DWnarfuaoebzeDcj/v1UPHmpoKg77FxRx2c/6tv9ieTubF3cF8yy88gir9o6KYX3Tg IEciQGJ+cdqcDtG9dUg0U2tuwTs4cpXV/sa+EHPlLJNftTSKfUC30iHFMlX7JhwtwkTT NREvb4dHcSexx1NbJaecCvnBnC5JKh5YHMaf4fVUqc5X8Md6vC5ezdcX7SH7EgxJzwSZ 45dbVybIyAuu6RYP8qtLVuNNabOhOpzjkF1EMgXi7oQpks/J6dfvOeKyCcF+ziyMYAaj rM8kfa6gCRu4Zy2BbSi/oY9tfOrCZ88aYS3Ad8gWVAFM4DX0A1JS+zJ8ero1sH9A4zeW X+Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784942806; x=1785547606; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Sv4Do54efz6CSaj7wJa92SFTaZ0J6tHEWKHA9fHHKzQ=; b=gm94PwjxYcFe+eQyt8OYLkQfa4rroLqPyP2jLG2ZKjQSYQ9fdXrwQvSYXVxBZJZP32 ybQ11h4c+LO5+H6PaGXwK+b5TJEAzlB7smPUqdoFVkcAh7Lkjhxd5G/oVsdVGxFL7Jgn Y3Cjq7SqxQav1KiGVs4JiN8L3MJpGEGaluYhW7fpasAJ46oj8BumYH29oKqRlvmC63sF E3+9yXby5wDq9OYpa5FP5HBR91ibeagewOZI2md/tA7zMs7Gvp5m4bp1YUKOmutcVa5l izaQQm/wEodRbH/dZTYyS5+d23KsO6zuonKQ4YCe8BZMrlK5zOJ+ZO8WaqTTfz6fY7fR 4vMQ== X-Gm-Message-State: AOJu0Yw/PpNf7zkL0eq2fNJYhqMUB4hBh4wmva6wz+hQVJYH0KPiOWQ4 e37qSzEGWIAg7d5R25qupiZ+BIMVA9vqt936zo5xbr/kVasafjqn+Zp9GjQvOgqL X-Gm-Gg: AR+sD13oDcJV5+zf8VGVkA3paGP/z0KUUnMC7f2KeWa+sRJDHFfeVrwYqxn0Xi2zibi h/YQfr4KpKjEengokMdI8x9NidXzt17deLZ4b+llwdfwtD9VcviuAM13lUO1Fq6kIWgUDc/VLUk 8lEpnNjmKvHK4eGCRrzLCADzbee4rDw8SafIrzO+ZbjZCjq2+SXg0pLLeKvjCeOdjux+Mnc+G9V IoPjtCgJ1ogMvWSJ075dfXWN43meYAt+Ou+ScK9Cy/QzAtMLtiPtPnSC8unIF3GLoIQZDTRC3NF YX0QymCsbpVbwULIB7iP3W2VUh0tmq/Zj+3ehIP+DUWuJgIIGqLS2zPNUOaDv6TRlV+XAunCSYx LljKrwER7DAJDaPKdo++Hfh6wsnxnRy+/IRt9HqN1nCoHVRHQNR3bGbS8VUCswgdb//kwrjbGkG 2ny545SbBNZZYGSHbZMV9fK+WpM6fEe7Hh X-Received: by 2002:a05:6102:94f:b0:726:cd42:d039 with SMTP id ada2fe7eead31-750409bda93mr694912137.24.1784942805732; Fri, 24 Jul 2026 18:26:45 -0700 (PDT) Received: from localhost.localdomain ([146.71.8.128]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-97774c388d7sm1092856241.1.2026.07.24.18.26.44 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 24 Jul 2026 18:26:44 -0700 (PDT) From: Marcelo Manzo To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Sergey Kambalin , Marcelo Manzo Subject: [PATCH 4/5] hw/arm/bcm2838: enable BCM2838 thermal sensor Date: Fri, 24 Jul 2026 21:26:34 -0400 Message-ID: <20260725012635.4925-5-marcelomanzo@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20260725012635.4925-1-marcelomanzo@gmail.com> References: <20260725012635.4925-1-marcelomanzo@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::e2e; envelope-from=marcelomanzo@gmail.com; helo=mail-vs1-xe2e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@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-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Wire the BCM2838 thermal sensor (added in the previous patch) into the SoC: instantiate it in the peripherals block and map its register region at the real BCM2711 physical address. This is also the last device masked out of the raspi4b DTB, so drop the "brcm,bcm2711-thermal" node-removal entry -- and with it the whole nodes_to_remove[] mechanism in raspi4_modify_dtb(), which is now empty (GENET, PCIe, RNG200, and this thermal sensor were the only four devices it ever masked, and all four are now implemented). Adapted from patch 17/41 of Sergey Kambalin's Raspberry Pi 4B series (patchwork series 829638) against current QEMU master. Signed-off-by: Marcelo Manzo --- hw/arm/bcm2838_peripherals.c | 11 +++++++++++ hw/arm/raspi4b.c | 18 ------------------ include/hw/arm/bcm2838_peripherals.h | 2 ++ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/hw/arm/bcm2838_peripherals.c b/hw/arm/bcm2838_peripherals.c index 7c202b00..c268fffd 100644 --- a/hw/arm/bcm2838_peripherals.c +++ b/hw/arm/bcm2838_peripherals.c @@ -43,6 +43,9 @@ static void bcm2838_peripherals_init(Object *obj) /* Random Number Generator */ object_initialize_child(obj, "rng200", &s->rng200, TYPE_BCM2838_RNG200); + /* Thermal */ + object_initialize_child(obj, "thermal", &s->thermal, TYPE_BCM2838_THERMAL); + /* PCIe Host Bridge */ object_initialize_child(obj, "pcie-host", &s->pcie_host, TYPE_BCM2838_PCIE_HOST); @@ -87,6 +90,7 @@ static void bcm2838_peripherals_realize(DeviceState *dev, Error **errp) MemoryRegion *mmio_mr; MemoryRegion *rng200_mr; qemu_irq rng_200_irq; + MemoryRegion *thermal_mr; int n; bcm_soc_peripherals_common_realize(dev, errp); @@ -111,6 +115,13 @@ static void bcm2838_peripherals_realize(DeviceState *dev, Error **errp) BCM2835_IC_GPU_IRQ, INTERRUPT_RNG); sysbus_connect_irq(SYS_BUS_DEVICE(&s->rng200), 0, rng_200_irq); + /* THERMAL */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->thermal), errp)) { + return; + } + thermal_mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->thermal), 0); + memory_region_add_subregion(&s->peri_low_mr, 0x15D2000, thermal_mr); + /* Extended Mass Media Controller 2 */ object_property_set_uint(OBJECT(&s->emmc2), "sd-spec-version", 3, &error_abort); diff --git a/hw/arm/raspi4b.c b/hw/arm/raspi4b.c index 1c063a1c..b92840e1 100644 --- a/hw/arm/raspi4b.c +++ b/hw/arm/raspi4b.c @@ -62,24 +62,6 @@ static void raspi4_modify_dtb(const struct arm_boot_info *info, void *fdt) { uint64_t ram_size; - /* Temporarily disable following devices until they are implemented */ - const char *nodes_to_remove[] = { - "brcm,bcm2711-thermal", - }; - - for (int i = 0; i < ARRAY_SIZE(nodes_to_remove); i++) { - const char *dev_str = nodes_to_remove[i]; - int offset; - - offset = fdt_node_offset_by_compatible(fdt, -1, dev_str); - while (offset >= 0) { - if (fdt_nop_node(fdt, offset) == 0) { - warn_report("bcm2711 dtb: %s has been disabled!", dev_str); - } - offset = fdt_node_offset_by_compatible(fdt, offset, dev_str); - } - } - ram_size = board_ram_size(info->board_id); if (info->ram_size > UPPER_RAM_BASE) { diff --git a/include/hw/arm/bcm2838_peripherals.h b/include/hw/arm/bcm2838_peripherals.h index 52eabf67..49ca780b 100644 --- a/include/hw/arm/bcm2838_peripherals.h +++ b/include/hw/arm/bcm2838_peripherals.h @@ -11,6 +11,7 @@ #include "hw/arm/bcm2835_peripherals.h" #include "hw/misc/bcm2838_rng200.h" +#include "hw/misc/bcm2838_thermal.h" #include "hw/arm/bcm2838_pcie.h" #include "hw/net/bcm2838_genet.h" #include "hw/sd/sdhci.h" @@ -70,6 +71,7 @@ struct BCM2838PeripheralState { MemoryRegion mphi_mr_alias; BCM2838Rng200State rng200; + Bcm2838ThermalState thermal; SDHCIState emmc2; BCM2838PcieHostState pcie_host; BCM2838GenetState genet; -- 2.47.1