From patchwork Mon Feb 7 18:19:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 540569 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp344587imr; Mon, 7 Feb 2022 10:21:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQkTvKWgaEGp40TSzELdC8a17jnKCFMxb73ZjszXzqL2w9Pe5vVvZxHjo6+CFiTVP+L83U X-Received: by 2002:a05:6402:1395:: with SMTP id b21mr715952edv.305.1644258109012; Mon, 07 Feb 2022 10:21:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644258109; cv=none; d=google.com; s=arc-20160816; b=eNFkuXminztMH1vz6nc3II8iMSrfdl+sGyIGp6LGKewdgNAHTkTGf9kDn/PVGaVYhR jZIWf89Gz4QkfVbGXHExu75mQUD1i7hMIuUWueS9bnX17mrtUYw8BDu6SeNfDo30lP6E fFxdpZH+G8GVLl+E8AogvOyH829dSbdUyl143K/v+aLrMErk/xtvMVoCa3cdLRbtUhyC IxQWLcqI2MT/klDrIfDo7WjSu8hFLL6UFIbB+mKs8BO4Q+4ZXTjrdaIZ7lSy4vLSU5kJ OoPFJiIJpUGvng2K2aFYj9prJYiqomlPX7rY1PsnTAeUzKM+OdT5Vc5dIEkxJ1j+4lQD FTJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from; bh=pG9F974Ufuhq+VY+QS0h8T3U8L5gp+9mtxCQLbeAZm4=; b=Xfz5E1KkUtC7RXRchvLSazM4R7/lUYMeoBb66xCuU30uYRrC4qUBWuqXzu+0wmgxkx nRIwK2U8qaGmrE+ce6km34K2YXOyPfvVTtbKrjgtEgAWMQrUgNbBMlb+k6s9PC1YVjVa yHQAWry6ENN8mf+l+YUgFEbiSR3iiVJt4HrcjIrJCQBEVJo/vq1fUAQFJzpEJxApAsYm 2Jpt1GxzdV9o0b8oI7FwZTLRKncWyZt5HhKMj5+DyHYhEGyvSX0J/tTmnvTXFhL0sxUA HNPeuHlvBPYDchfS8yumm1HChrbB3N49g7447jBeDDkjjx5yrmyi368aYWbHrhWjAEih 4BUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id l14si8476901edb.241.2022.02.07.10.21.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 10:21:49 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32EB383BD3; Mon, 7 Feb 2022 19:21:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2B42583BC3; Mon, 7 Feb 2022 19:21:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id BE0B583B8E for ; Mon, 7 Feb 2022 19:21:19 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 124CA11B3; Mon, 7 Feb 2022 10:21:19 -0800 (PST) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1101B3F718; Mon, 7 Feb 2022 10:21:14 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Masami Hiramatsu , Patrick Delaunay , Patrice Chotard , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu Subject: [PATCH v4 04/11] FWU: STM32MP1: Add support to read boot index from backup register Date: Mon, 7 Feb 2022 23:49:54 +0530 Message-Id: <20220207182001.31270-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220207182001.31270-1-sughosh.ganu@linaro.org> References: <20220207182001.31270-1-sughosh.ganu@linaro.org> 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.5 at phobos.denx.de X-Virus-Status: Clean 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 --- Changes since V3: None board/st/stm32mp1/stm32mp1.c | 6 ++++++ include/fwu.h | 1 + 2 files changed, 7 insertions(+) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 5e8cb29067..5525b69392 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -1015,4 +1015,10 @@ 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_BOOTCOUNT); +} #endif /* CONFIG_FWU_MULTI_BANK_UPDATE */ diff --git a/include/fwu.h b/include/fwu.h index b746e616b2..90b8cd41e5 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -52,5 +52,6 @@ int fwu_clear_accept_image(efi_guid_t *img_type_id, u32 bank); int fwu_plat_get_update_index(u32 *update_idx); int fwu_plat_get_alt_num(struct udevice *dev, void *identifier); +void fwu_plat_get_bootidx(void *boot_idx); #endif /* _FWU_H_ */