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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9A64C43334 for ; Fri, 15 Jul 2022 06:18:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EDEBD84121; Fri, 15 Jul 2022 08:18:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kooNsjSl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A7FF784127; Fri, 15 Jul 2022 08:18:05 +0200 (CEST) Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AFF58840B1 for ; Fri, 15 Jul 2022 08:18:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-31d85f82f0bso38002797b3.7 for ; Thu, 14 Jul 2022 23:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LMUARs7L0SC8/sDfCvB4vGIUkcw7ZvxvSIDKwfwF+Wc=; b=kooNsjSl5KV71TqQRidPSBWJc3vJ/AB6F4XLJi3NedTEPd3SqFeM1FJJDOyB5XXuRi VjBGG2uPbW/+O1+CBWjTlT8Sl4GrOvMuEmTRiUWNtbFf79iAsXR2m+NH9g1BUiHucKRv EQE5z6uY3wkdCU/T0Bju6+mbN7yF9KPVyoXotEtyjTMD1nmtrSc8ZJVb7z41nADujPfA MmUFk2rRTC78ybtm70JSmQ69ThKMI97Rq39rPF6gLIcb6TnXwho43AbT6oyl1bwbcgHL 8nh1NZ74PF6NKoMX9OY/aMK8y56kLunhpLHL8nRtrqMZiefAIzM413ED/kjJgt8tTeR5 a+UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LMUARs7L0SC8/sDfCvB4vGIUkcw7ZvxvSIDKwfwF+Wc=; b=iXgOq7UL9yTBYy1efheRMbI+7x6D+ASr2Mjxtrs/x0RbpeAU47A+fSzIv53JOBW7su 8L4StWk+9n9Ejc2mnnSKwFjBCZKPTmRcOlkB+6w4kwPxn5j7/G5G0yA0aB9qqQ9v0ujz l04GnE7TiSWYic5p4kl9nV6Lx3wdPGQn52DabGLQOyseRj+9w7B7Y5npKK4sAZkUgNPj GZSaVe5DvqehhZOHZiHY00txV8lbE5JiuMc+pj1Bd9aA8lXmwvnokKJ5pdxMUe5Yx86/ YlvOH4TeN4vkcJ0uE1DfTv7USb3kJ+33T+pi0d2DT28HGp1A+POkoxeEYivzR90+ZjjI bvYg== X-Gm-Message-State: AJIora+V5ZTWJ6yp/QNiXgFQzDubcib5Y3nXsll2j3yu9ky5KmUPV2/C AcN0c5HSJ522i9kdaoUMdQd0dWf/a6BceEJ+JpbTnw== X-Google-Smtp-Source: AGRyM1v4La6R6uxCAWfdy6wfkW6K1X4wFfBqJbHSi/JKwgxEof3qllVAUSlDRUS29ASa6nvYvq4LBbwGTWNRNm7rC00= X-Received: by 2002:a81:52d5:0:b0:31c:924e:f569 with SMTP id g204-20020a8152d5000000b0031c924ef569mr14358374ywb.382.1657865880393; Thu, 14 Jul 2022 23:18:00 -0700 (PDT) MIME-Version: 1.0 References: <20220714183913.118505-1-sughosh.ganu@linaro.org> <20220714183913.118505-8-sughosh.ganu@linaro.org> In-Reply-To: <20220714183913.118505-8-sughosh.ganu@linaro.org> From: Ilias Apalodimas Date: Fri, 15 Jul 2022 09:17:24 +0300 Message-ID: Subject: Re: [PATCH v7 07/13] FWU: STM32MP1: Add support to read boot index from backup register To: Sughosh Ganu Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Takahiro Akashi , Patrick Delaunay , Patrice Chotard , Simon Glass , Bin Meng , Tom Rini , Etienne Carriere , Michal Simek , Jassi Brar Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Thu, 14 Jul 2022 at 21:40, Sughosh Ganu wrote: > > The FWU Multi Bank Update feature allows the platform to boot the > firmware images from one of the partitions(banks). The first stage > bootloader(fsbl) passes the value of the boot index, i.e. the bank > from which the firmware images were booted from to U-Boot. On the > STM32MP157C-DK2 board, this value is passed through one of the SoC's > backup register. Add a function to read the boot index value from the > backup register. > > Signed-off-by: Sughosh Ganu > Reviewed-by: Patrick Delaunay > --- > Changes since V6: None > > arch/arm/mach-stm32mp/include/mach/stm32.h | 5 +++++ > board/st/stm32mp1/stm32mp1.c | 8 ++++++++ > include/fwu.h | 1 + > 3 files changed, 14 insertions(+) > > diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h > index c70375a723..c85ae6a34e 100644 > --- a/arch/arm/mach-stm32mp/include/mach/stm32.h > +++ b/arch/arm/mach-stm32mp/include/mach/stm32.h > @@ -112,11 +112,16 @@ enum boot_device { > #ifdef CONFIG_STM32MP15x > #define TAMP_BACKUP_MAGIC_NUMBER TAMP_BACKUP_REGISTER(4) > #define TAMP_BACKUP_BRANCH_ADDRESS TAMP_BACKUP_REGISTER(5) > +#define TAMP_FWU_BOOT_INFO_REG TAMP_BACKUP_REGISTER(10) > #define TAMP_COPRO_RSC_TBL_ADDRESS TAMP_BACKUP_REGISTER(17) > #define TAMP_COPRO_STATE TAMP_BACKUP_REGISTER(18) > #define TAMP_BOOT_CONTEXT TAMP_BACKUP_REGISTER(20) > #define TAMP_BOOTCOUNT TAMP_BACKUP_REGISTER(21) > > +#define TAMP_FWU_BOOT_IDX_MASK GENMASK(3, 0) > + > +#define TAMP_FWU_BOOT_IDX_OFFSET 0 > + > #define TAMP_COPRO_STATE_OFF 0 > #define TAMP_COPRO_STATE_INIT 1 > #define TAMP_COPRO_STATE_CRUN 2 > diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c > index 44c7943f1d..ddf5053601 100644 > --- a/board/st/stm32mp1/stm32mp1.c > +++ b/board/st/stm32mp1/stm32mp1.c > @@ -1001,4 +1001,12 @@ int fwu_plat_get_update_index(u32 *update_idx) > > return ret; > } > + > +void fwu_plat_get_bootidx(void *boot_idx) > +{ > + u32 *bootidx = boot_idx; > + > + *bootidx = (readl(TAMP_FWU_BOOT_INFO_REG) >> > + TAMP_FWU_BOOT_IDX_OFFSET) & TAMP_FWU_BOOT_IDX_MASK; > +} > #endif /* CONFIG_FWU_MULTI_BANK_UPDATE */ > diff --git a/include/fwu.h b/include/fwu.h > index 38dceca9c5..edb28c9659 100644 > --- a/include/fwu.h > +++ b/include/fwu.h > @@ -49,6 +49,7 @@ int fwu_revert_boot_index(void); > int fwu_accept_image(efi_guid_t *img_type_id, u32 bank); > int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank); > > +void fwu_plat_get_bootidx(void *boot_idx); > int fwu_plat_get_alt_num(struct udevice *dev, efi_guid_t *image_guid, > int *alt_num); > int fwu_gpt_get_alt_num(struct blk_desc *desc, efi_guid_t *image_guid, > -- > 2.34.1 > Acked-by: Ilias Apalodimas