From patchwork Sat Mar 28 17:15:17 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4510 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D2A3A3F0C6 for ; Sat, 28 Mar 2026 18:17:12 +0100 (CET) Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-483786a09b1sf37442025e9.3 for ; Sat, 28 Mar 2026 10:17:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1774718232; cv=pass; d=google.com; s=arc-20240605; b=d+bSxlvzf5ZbDSGR6rEZeWdhba7xQ9qKJjbl7nKaKg0ZgsBLnR/nk2vptL/g7ZneA0 6XXrDeiCk2vkN2ngG2bOpK6mgU4Wa70dvTqaO4cVIUrrkyzWiJueHj/q+A+gOKGXyj6V dQAplqbPvpi/tnUNKJkToMMykXffhuNEu1czx6LkrneY2cCuIsyHIrCvZS/HPgzDr1a/ Kg44/K7hVzRsRm14V20QFEWA59o/SPuuDNbhHPxQg+HFQRIUec+VLDNFMcQKCvEKPVsX c+O9uUK8NFh0RkxVCv99weKsR1fcuA8cwfqAxg+CF1BQV3sAaiCwkpQc9nCUEcXEYEMJ uJmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=V508J5kKS6ashjJy4t0kEcg/nEDUZKoy+xGni1CB/Ws=; fh=Y61GkEuwT6UloqyzOvYBRIBOr+iYjvQ+9HqzIVecdag=; b=Dl6iIdpsdyxyNFmZ6eMghvs+qUyZ1V/fia4mgeKz0+DBfVn5Bl20aYIa7+uNfns4J7 ckyP2GAOSOFbtJEGd+R9w7NS4oIhwB6rK8brDKDm6FEwgJXqgQNkYdtVpDpmqFiZDVj9 q14hZec/ewLNcLO/l8w11/W//nlLBW1yCOT8EQaEsVGS9OKQVpthRcG4Pc6HEFx5GxAu TXa7gNUPqhnXvTZm2feLiFgzAQIbVQj5vu4B6m+EDG+kEAOMIwkDVsHwRSwH/VAw762J Tp28ccHPNUFCCn/0dMwW4GXXexVXhpNUooP2k1BpVV3W2zbrVmNAA1/HUrZixGiLmuhf eXkA==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qL9ybxkz; 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=1774718232; x=1775323032; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=V508J5kKS6ashjJy4t0kEcg/nEDUZKoy+xGni1CB/Ws=; b=L6Dpg2ykrM4xtnlYIOm91rrptA2Yi6yG9Wj7UlHtKyla7qlCqByTEuyiM3aMDaGNHw /OC5AUsX+IGWX0DcIWTQnlaLcY+JgVeLrFTryeSX3DB8yK2DY5+t5OniLUIq5cVcbe8h G6q2Tqj+fPwWef+Xs3Ky8CHUadQ2QrYg+ipoo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774718232; x=1775323032; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V508J5kKS6ashjJy4t0kEcg/nEDUZKoy+xGni1CB/Ws=; b=Ky6fi53kZkBnM/cTReNIYt93O6r0SHsvbAinn9Y60E2QFqm/nU46qKDXyi9pI+7I60 0fN0S/ArAN+kc/oGLhIv9spvS3U0IoKynpIDfzhdQeds1pYfiadpps8z3pPRYwDRCIVQ 8muLf5RW40DHRIUCrn/DBQSiSoVHTxv48TU07SJqqg737kAo8iqeGnKUjuPGyUJsVl7D yY07Le9kDjr45TtV6A4cuvR1spr60Q47CDZ291BQks+lxCn8NEfZSDNNoZDpv7olpJBZ dOw4i8Uto2Yb+ZyTiEuW/0/7FNlRqiv0jLRm0CDj6e0r9e+cP7zQXrveEaBEb3oJsDrC d2BQ== X-Forwarded-Encrypted: i=2; AJvYcCXOzPYiqsJAwNEhvHzerUCtOLARhYJtofVJ2x7Qw+UJIb/RBO3GiirhgDoiudsMtvA9fLw2vLjrnKlgldsc@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YysgpHessU7n1W6i4K/N8YAU5GGZ26F4un2gJhdrC/64s4YQJ+5 1hphBAiz1kjvhoNtl6MAfJHanc/Zt5p6bKhdGEn4i940gEROd39qBmw6daYnuhLgDQx1OQ== X-Received: by 2002:a05:600c:3112:b0:485:3b34:2f62 with SMTP id 5b1f17b1804b1-48727ea2803mr123120725e9.14.1774718232405; Sat, 28 Mar 2026 10:17:12 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com; h="AYAyTiJBpa3mrWKdhGOT4m7d5a0WxOydS8l2evNvCe0b6whg1w==" Received: by 2002:a05:600c:6c4e:b0:485:2e9c:9e81 with SMTP id 5b1f17b1804b1-4871f347fe0ls17816375e9.1.-pod-prod-09-eu; Sat, 28 Mar 2026 10:17:11 -0700 (PDT) X-Received: by 2002:a05:600c:1e8c:b0:485:304a:58cd with SMTP id 5b1f17b1804b1-48727d5a25dmr113962375e9.4.1774718230763; Sat, 28 Mar 2026 10:17:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774718230; cv=none; d=google.com; s=arc-20240605; b=EuTqM89Vnti1zywJ4TXrgRQN7ImYo4WH/Q0REnX7aF01wR7ZN43RL6GIiikIMbEhX0 4Y9jfsKAG8UjS9vfVG+aRl10aXYIKcTdI5d992d+WieZGWbFwVye/Wv5SsBtktreERGX VKH5OftC1/oHoRC/dU2QjSMU5fdwKbGzHFQPGIl/nqEjg/k3bf0jQ+4C22GLuk9eY+If AqWF/Bc+9Qk1L0WxS7cBC8CxRAi/j/w/kS7+m459tssi2JxPdinuichM3w5KUbRAhXGD NkvSllCOh0QCH4dyj3kbBzjPoourQHO9qos4Sl1gqrIuF1duEq5PaFsO7mSrFgwhf4fe Xr/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=uhbnKG6I3uBd8YPHLeHNZI+uBaM8ZyYIr9wbspDdQNI=; fh=bSxFN8ofQGgsTNSZRd8x00EydQvhyYnF2HxrnwkKvNY=; b=SK6xLBAQmbmoOHyvSvCIKVgN0pHyJPtF+p3EE7CpOgpk1rzV1T1sMmXSfUIDf2mXwG Gsygp2IY/mQUKKXW04Oe2t/xv4H8lbG92mt6x5JjK5VvaTo056Acp/MI+3KYRvWAd5Ey PnM8dwUyxIXj6YRYQKJhH4GRm/H46sj2EfL/bUoam7vr7WnbXK/hrkQ4B5KmxOC87v7I PEQ42eW6o9UapZ2cubfM3pxI2d76U4AzigzKjdTqxHY6Hh5sLH3j2NcDdA76TgoMmQ4u 0jgrafNgieGeyscMG7in83K1CwpjQAzO4olbpsaILRZaU6KN5pTClmo32IpXuNJ+CJ5u UJJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qL9ybxkz; 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 Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-487307341e0sor6464965e9.19.2026.03.28.10.17.10 for (Google Transport Security); Sat, 28 Mar 2026 10:17:10 -0700 (PDT) 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; X-Gm-Gg: ATEYQzx+Em9mMlr24yDd+H9UeWt2Gutj1Dhby0jFNqw5ZrWTplxT6lAlBm6z7BYugRe 5QcsQ40ejGXrHOBfr0OTChRvkdPgNjjo8EYcfdl8ruxr8Zi15khsZ+t1Ajck8MJc6Jjtx8SRBOE /CHnhjH+lnVuYZGMTMQ1zGyrXI+7yZFqqfYPeJ8NZOq6/JhFPaIAKCeAVsAQ/INombnDQg8lcwi P2aPjKMnku6JSCjUJ8tHgZz4eIsvAdZ46zVqKJF/R08mCtu6FmFwcRj+cu5eOc94tvATS3pO/vH wtILS2VbZqFFdDjcDVHSndH9uvNJVelBcfcFYoO9/4wWrNI9sA9u4JsRr04ZE2/OgpEeIBnwKuX wyXvJaOJy0xwqYvgcQsx45RBlnr2XeTkQ51sLprFmA/Hb/n0ZfUc3uOEmCmTTa8x1jD4Whu+Nal 81HHJK6tamr5wfI7XtBq97bWooqSOUILXuRwZ1Grw2eIdkX8w8mGuOcRAKJogVpj0yoeL5j8ks6 w2vPMBijQYCbZCKK8Xm4v9WEC+kPKrK2ixG0zcfIQIIwX3nTwVimAA6eezqnoBdrJaXk45r4BYM h9fxnVBp3xM9U02kF7kuQRVF X-Received: by 2002:a05:600c:800f:b0:487:1520:d107 with SMTP id 5b1f17b1804b1-48727f4e9d3mr108463165e9.31.1774718230218; Sat, 28 Mar 2026 10:17:10 -0700 (PDT) Received: from dario-ThinkPad-P14s-Gen-5.homenet.telecomitalia.it (host-87-9-100-184.retail.telecomitalia.it. [87.9.100.184]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48722c6b105sm332432465e9.1.2026.03.28.10.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Mar 2026 10:17:09 -0700 (PDT) From: Dario Binacchi To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Marek Vasut , Patrice Chotard , Patrick Delaunay , Quentin Schulz , Tom Rini , uboot-stm32@st-md-mailman.stormreply.com Subject: [PATCH 4/4] board: st: stm32mp25: support dynamic A/B bank bootup Date: Sat, 28 Mar 2026 18:15:17 +0100 Message-ID: <20260328171624.2377527-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260328171624.2377527-1-dario.binacchi@amarulasolutions.com> References: <20260328171624.2377527-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qL9ybxkz; 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 Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Enable automatic detection of the active A/B bank by retrieving partition GUIDs from FWU metadata. This ensures the system correctly identifies the bootable partitions even in multi-bank scenarios, falling back to a standard bootable flag scan if the UUIDs are missing. To enable A/B bank bootup on stm32mp25 boards, add the following Kconfig options to the stm32mp25_defconfig: CONFIG_FWU_MULTI_BANK_UPDATE=y CONFIG_FWU_MDATA=y CONFIG_FWU_NUM_BANKS=2 CONFIG_FWU_NUM_IMAGES_PER_BANK=3 CONFIG_CMD_FWU_METADATA=y CONFIG_FWU_MDATA_V2=y Signed-off-by: Dario Binacchi --- board/st/stm32mp2/stm32mp2.c | 25 +++++++++++++++++++++++++ include/configs/stm32mp25_st_common.h | 15 +++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/board/st/stm32mp2/stm32mp2.c b/board/st/stm32mp2/stm32mp2.c index 43bc583378e6..42df750eae9b 100644 --- a/board/st/stm32mp2/stm32mp2.c +++ b/board/st/stm32mp2/stm32mp2.c @@ -208,4 +208,29 @@ void fwu_plat_get_bootidx(uint *boot_idx) *boot_idx = (readl(TAMP_FWU_BOOT_INFO_REG) >> TAMP_FWU_BOOT_IDX_OFFSET) & TAMP_FWU_BOOT_IDX_MASK; } + +int fwu_platform_hook(struct udevice *dev, struct fwu_data *data) +{ + uint boot_idx; + efi_guid_t boot_uuid, root_uuid; + const efi_guid_t boot_type_guid = PARTITION_XBOOTLDR; + const efi_guid_t root_type_guid = + PARTITION_LINUX_FILE_SYSTEM_DATA_GUID; + char uuidbuf[UUID_STR_LEN + 1]; + + fwu_plat_get_bootidx(&boot_idx); + + if (!fwu_mdata_get_image_guid(&boot_uuid, boot_type_guid, + boot_idx) && + !fwu_mdata_get_image_guid(&root_uuid, root_type_guid, + boot_idx)) { + uuid_bin_to_str(boot_uuid.b, uuidbuf, UUID_STR_FORMAT_GUID); + env_set("boot_partuuid", uuidbuf); + + uuid_bin_to_str(root_uuid.b, uuidbuf, UUID_STR_FORMAT_GUID); + env_set("root_partuuid", uuidbuf); + } + + return 0; +} #endif /* CONFIG_FWU_MULTI_BANK_UPDATE */ diff --git a/include/configs/stm32mp25_st_common.h b/include/configs/stm32mp25_st_common.h index cb679eb1be22..0b0267ae99b0 100644 --- a/include/configs/stm32mp25_st_common.h +++ b/include/configs/stm32mp25_st_common.h @@ -8,7 +8,22 @@ #ifndef __CONFIG_STM32MP25_ST_COMMON_H__ #define __CONFIG_STM32MP25_ST_COMMON_H__ +#ifdef CONFIG_FWU_MULTI_BANK_UPDATE +#define SCAN_DEV_FOR_BOOT_PARTS \ + "setenv devplist; " \ + "env exists boot_partuuid && " \ + "part number ${devtype} ${devnum} ${boot_partuuid} devplist; " \ + "env exists devplist || " \ + "part list ${devtype} ${devnum} -bootable devplist; " + +#define ST_STM32MP25_FWU_ENV \ + "altbootcmd=${bootcmd}\0" +#else +#define ST_STM32MP25_FWU_ENV +#endif + #define STM32MP_BOARD_EXTRA_ENV \ + ST_STM32MP25_FWU_ENV \ "usb_pgood_delay=2000\0" \ "console=ttySTM0\0"