From patchwork Wed Nov 4 08:50:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4974 Delivered-To: michael@amarulasolutions.com Received: by 2002:a05:7301:6783:b0:36a:3487:1c26 with SMTP id qo3csp69780dyb; Wed, 4 Nov 2026 00:52:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AKwUvBwOvvUghUbQSA/gExmCfN09IlxUFjUKDM2iGrMzd5XNMJF5aQ2Gz4Tv9e1zbZGC8RKmMla5GO1X@amarulasolutions.com X-Received: by 2002:a05:600c:6216:b0:4a3:5aea:21e5 with SMTP id 5b1f17b1804b1-4ac1737c533mr345250715e9.9.1793782351936; Wed, 04 Nov 2026 00:52:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793782351; cv=none; d=google.com; s=arc-20260327; b=Uttagt5wruub7IQP96wlMgwhnIbrWvZ+KTR3eOOR/y12ax8BpKEkBOUxvgF5DwgLfg z1DPVwloG29Js8ZGg2W4P2ImIeg54w8xtXLj2H83t0jkZB/SZS+45ml/qhG6JWKiC83s 5hBkTi6xWJsQV2QEe0u6ldHWj4pUKPOBU64qjUg3AIUszfuxwscQ8NAr+Q2P97W+BVH0 E0kFSnCMbFx7fxb9UwN9DTHinqO0ni396BWwXRwEhIWJNkFTuYq8NtwzbiTykvfi9y2h eeY7yDKzwak+Oq/hKTQylXBobLBrlyv72BCFmlFtkwQYAkqg6iyJ1HxtGcn0eI4FJjXM Aebg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=yP+fN+M0TliDkq9pNH7Qa6MfF5414Zb23x0hMUZfQuk=; fh=BrEFHndavxea55kfvkNYQ0TMzskhPL8NpmsWL+Wdn8g=; b=WqRaV+DZJKcW9d469jr0LvtZOnrOU132ul2koko8/II/B/Hp02YYkDUh7fgL5UOOzZ 7YmRJM6EiV+KDc/eqa8TMZS23DNG+irWztNO5ya86yy825pcaWZlpf5kACbP5nNJdia8 iLmb3Qgho/ZcSgtRcptvTIcNbhguauy97Bazsvcb7UqQQD+sM4aaDSfPZZVidlkNvrOo TQ6aYofJhwGWleWeGhFhfOHRuSd7I1guPE5k7ZAR4Sv0IsT28tn/5O7or+2HcgGZCtI0 s7WsNVZ5hRx1docw6+qGCLRVTQYwazke1NzwbH2wNq46u0duIT/ZkiSXRK7hjj1a6/2p ohBw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Bxr18qYH; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-4b43cc1a9bfsor2682085e9.3.2026.11.04.00.52.31 for (Google Transport Security); Wed, 04 Nov 2026 00:52:31 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Bxr18qYH; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1793782351; x=1794387151; darn=amarulasolutions.com; 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=yP+fN+M0TliDkq9pNH7Qa6MfF5414Zb23x0hMUZfQuk=; b=Bxr18qYHJeJCcsYm4XV1ZIbPqO1uNtgBYk3X4sQ3dPQFnxnPCZG54SqVvh6Ba1II6A hAaHKiu6xkdnZYBS/SnyBDCh0wgxKxbjQyz0UO4qN7czDFAE+SXFF93Avd4v36fFOLkB c+We22mNhMufnnm+aKy4boD5BqGoN/EZjF7i4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793782351; x=1794387151; 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=yP+fN+M0TliDkq9pNH7Qa6MfF5414Zb23x0hMUZfQuk=; b=eQhQs3qTANBVmRzMXRRh5hqcUDBJAMNq8/z8beTING+zzJ92sUFsxryMQQ2KJT+OUz kWhtsGOeJnd0uIljIzRd8E2vpNEILWTYtIuR1trXnSGEfnbjzOxv/47s4gLj7tRSnuXi 7J7MWJCQnHwx5VK4hndPasb8mDH6KyIDb1gemVurDbncty0xnipT9BgMN7V+TDU8dy1i rxy2n/JParyjtuGV44YOkEzHUyiZJRHkRiRcjpqs+hUz0kfyrqUxQem+8y2nP67d99Zi 6CFDsFVcnNh796FTKXO2lZH/+QkPx6O+q7lH5SAzeCSJMj9OnR7BZws7UMpOlAu1q76B uzZw== X-Forwarded-Encrypted: i=1; AKwUvByw996FuEuxhLuJ7EDJxLoNgzmcrNmcp84UkZpOvsupW6sygypB5jo8akeO7h3Dm8z+quOiiZZz@amarulasolutions.com X-Gm-Message-State: APuU4Z/KZgqIAHry1o7pgMS1Be7bv8ziwvqiOkPsKoI2a2KRKPUOwceJ 1mOyosd7lSxNaKP917XI/+M342ZlTFtDzKuO5cb9zT54hSTqZ4iLOfes8t3fFbo58VvKjQ== X-Gm-Gg: AYBFou2Yz6hC8NLW0ploF339DuiZK1RxNkkhy8G+YgqoetKCnOEfckq37nHFbJYuHmw XZ5LlgMq1f6mysoXOeeKwg5QWP0tvjFW0vNDjXeOE+xFU6qCtbOArsbmn3hA2iO4DAZTZyhrs62 r2yks3ELOfGUWeHTot+dCeCvVxp//0SnB49XsXmmTpLGAkizdrj+ED8HJ4ZhUe7RFlb9dYUBDTw 8G1NBU9puCYNGNQC1i7gx/yAhRvbWvrQnHkzjgNZv4c8C68GyYS5ovZJSdMwXN3jTzDUpnsOVuV 29JhfRMjhYjmBjfsucfRHgQ0CVaD0DeIZbpoJYrE+C4o5QZ7TRSY7AchD/aE49jzKsgRH3ifBbZ C4RdMrZjFcpJ6xGZG1U5S8ML+pxSMJO0MTzvs4xNmZYnP8fICDCVbncsbsmuK6HJHbmOyKVhtU6 0pcvohP7SccjUMbEwdtTyvgkKgbOSEiHqIoOJZrR8ryp0TEzr5g/+QSF62vXBhJeYFjnNG6ufu7 WEUz0Csj+M4bB05B2N6iGSuIRcgzX6W6p+W5aDQB2+0b12CoQUf11s55PxtncGCYEC/8F7QmIc8 JfrbbdGwKkLVTgrZfMTt350G+DRRi2WqAxvAGgDksHP/M9YKPR+Xn+61S3wPdpcWWGrtRQbLGso yglGOWcH+Z/2IgTYPr313ebyPkaLXJu0+Kd1N2Oiii+iq2nxM X-Received: by 2002:a05:600c:630d:b0:4a7:a309:6b73 with SMTP id 5b1f17b1804b1-4ac150b2896mr332035695e9.1.1793782351277; Wed, 04 Nov 2026 00:52:31 -0800 (PST) Return-Path: Received: from dario-ThinkPad-P14s-Gen-5.. ([109.54.139.206]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4b413312a4fsm20555915e9.1.2026.11.04.00.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2026 00:52:30 -0800 (PST) From: Dario Binacchi To: Patrice Chotard , Patrick Delaunay Cc: linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Dario Binacchi , Ilias Apalodimas , Tom Rini , u-boot@lists.u-boot-project.org, uboot-stm32@st-md-mailman.stormreply.com Subject: [PATCH 32/33] board: engicam: stm32mp2: support FWU A/B bank bootup Date: Wed, 4 Nov 2026 09:50:05 +0100 Message-ID: <20261104085036.4012238-33-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261104085036.4012238-1-dario.binacchi@amarulasolutions.com> References: <20261104085036.4012238-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 Enable the FWU multi-bank update. The FWU metadata are stored in the boot device, so point the "fwu-mdata-store" property to it at runtime. Signed-off-by: Dario Binacchi --- ...m32mp257d-engicam-microgea-rmm-u-boot.dtsi | 6 +++ board/engicam/stm32mp2/stm32mp2.c | 40 +++++++++++++++++++ configs/stm32mp25-microgea-rmm_defconfig | 6 +++ 3 files changed, 52 insertions(+) -- 2.43.0 diff --git a/arch/arm/dts/stm32mp257d-engicam-microgea-rmm-u-boot.dtsi b/arch/arm/dts/stm32mp257d-engicam-microgea-rmm-u-boot.dtsi index feca4e7d5f26..a6d81e309f36 100644 --- a/arch/arm/dts/stm32mp257d-engicam-microgea-rmm-u-boot.dtsi +++ b/arch/arm/dts/stm32mp257d-engicam-microgea-rmm-u-boot.dtsi @@ -11,6 +11,12 @@ config { u-boot,mmc-env-partition = "u-boot-env"; }; + + /* moved to the eMMC, when booting from it, by board_fix_fdt() */ + fwu-mdata { + compatible = "u-boot,fwu-mdata-gpt"; + fwu-mdata-store = <&sdmmc1>; + }; }; / { diff --git a/board/engicam/stm32mp2/stm32mp2.c b/board/engicam/stm32mp2/stm32mp2.c index 51274f6b9dc7..5f2db3a53146 100644 --- a/board/engicam/stm32mp2/stm32mp2.c +++ b/board/engicam/stm32mp2/stm32mp2.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -146,6 +147,45 @@ int splash_screen_prepare(void) } #endif +#if CONFIG_IS_ENABLED(OF_BOARD_FIXUP) +/* + * The FWU metadata are stored in the boot device, the SD card or the + * eMMC, so point the "fwu-mdata-store" property to it. The phandle is + * replaced in place, since the devicetree is already in use. + */ +int board_fix_fdt(void *blob) +{ + u32 bootmode = get_bootmode(); + unsigned int instance = (bootmode & TAMP_BOOT_INSTANCE_MASK) - 1; + int node, store; + char alias[8]; + u32 phandle; + + node = fdt_node_offset_by_compatible(blob, -1, "u-boot,fwu-mdata-gpt"); + if (node < 0) + return 0; + + switch (bootmode & TAMP_BOOT_DEVICE_MASK) { + case BOOT_FLASH_SD: + case BOOT_FLASH_EMMC: + break; + default: + return 0; + } + + snprintf(alias, sizeof(alias), "mmc%u", instance); + store = fdt_path_offset(blob, alias); + if (store < 0) + return store; + + phandle = fdt_get_phandle(blob, store); + if (!phandle) + return -ENOENT; + + return fdt_setprop_inplace_u32(blob, node, "fwu-mdata-store", phandle); +} +#endif + int board_late_init(void) { const char *fdt_compat; diff --git a/configs/stm32mp25-microgea-rmm_defconfig b/configs/stm32mp25-microgea-rmm_defconfig index 9fee56512488..0c71d1a48db3 100644 --- a/configs/stm32mp25-microgea-rmm_defconfig +++ b/configs/stm32mp25-microgea-rmm_defconfig @@ -14,10 +14,13 @@ CONFIG_CMD_STM32KEY=y CONFIG_MFD_STM32_TIMERS=y CONFIG_ENV_OFFSET_REDUND=0x940000 CONFIG_TARGET_MICROGEA_STM32MP257=y +CONFIG_FWU_NUM_IMAGES_PER_BANK=3 +CONFIG_OF_BOARD_FIXUP=y CONFIG_SYS_MEMTEST_START=0x84000000 CONFIG_SYS_MEMTEST_END=0x88000000 CONFIG_API=y CONFIG_SYS_MMC_MAX_DEVICE=3 +CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_FIT=y CONFIG_DISTRO_DEFAULTS=y CONFIG_BOOTDELAY=1 @@ -25,6 +28,7 @@ CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" # CONFIG_BOARD_INIT is not set CONFIG_SYS_PROMPT="STM32MP> " # CONFIG_CMD_BDI is not set +CONFIG_CMD_FWU_METADATA=y CONFIG_CMD_BOOTZ=y CONFIG_CMD_ADTIMG=y # CONFIG_CMD_ELF is not set @@ -118,3 +122,5 @@ CONFIG_WDT_STM32MP=y CONFIG_WDT_ARM_SMC=y # CONFIG_UBIFS_SILENCE_DEBUG_DUMP is not set CONFIG_ERRNO_STR=y +CONFIG_FWU_MULTI_BANK_UPDATE=y +CONFIG_FWU_MDATA_V2=y