From patchwork Sun Dec 19 07:06:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 525853 Delivered-To: patch@linaro.org Received: by 2002:a05:6e04:2287:0:0:0:0 with SMTP id bl7csp3053233imb; Sat, 18 Dec 2021 23:07:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzy/DBYAqAm2aACOrKvSeLcjw+ZCFY+4wt4KM21cXuscpo74CC6ziMXpVztscdOI0rk7yoI X-Received: by 2002:a05:6402:445:: with SMTP id p5mr10334219edw.110.1639897638971; Sat, 18 Dec 2021 23:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639897638; cv=none; d=google.com; s=arc-20160816; b=eUTFhIh9PVFWJR1Y4ezyJhsDePprxIZzxW6TYTCu4dKsPjrqe8u3xaIRQnIlL0ygtP O9PFYPDP0zjXWWPemQJhG75ksqhSa1/uYAn0Hh8ixwX1q5RDS6TJ0pmzXUtzAu5/MPzm 35viCFj+hyDGhSLD2eCMi1p41cEqjZaIFkMyVx4VeDqw2Tzeh6SL0nebnIvroYC2OvA8 asj39ERcSD/mlYqc6hUKfFmbLl6AlQz5DrEQAD/G0DuHOO7iGq8aHCnVwtypG+QObwUt /v+MSZFrP2yGxSeDJOawpx9bLATHV18BufsUsxYK2uI7FVT0lt3sAtZuA2JwCVAfIdvi 28VQ== 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=7IbFXfSx1vOLnKoUhMhl50fEHsFg2Yqf0/a9SP6w4VU=; b=rlwTpYhz0KmJzgl2Yw4RhuUblIVbKaz/M4UM4qOUqQPynV+FUX3rRYZC0+LJpKMovq W7RzrJ+z9XCCRvwFBAMtwbzbX+owGsriSXMJMpoxjwcBMQUkctAjuEMgwcztP97FP64w YL2UtZ3kpMsM3pWWuSBz3015uaiMXcKTlSl8H/lGT8a8kCQXqcTRqobuoIXvQ+bkEvFp UVeewTcCKp0NOXnqGHEZACCeIskoNA1F1HVTrk/JV8fYWlYJBIMttdFqr5KgZhN9HuwD aHcecxnPRhQOUwSKebW+97q2kMDrvkEZe77v7v8Ma6twIcad341rgWM/pClguLhHLEfS SpNw== 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 g18si1045862edb.144.2021.12.18.23.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Dec 2021 23:07:18 -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 38E1A830C4; Sun, 19 Dec 2021 08:07:00 +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 A76E88307B; Sun, 19 Dec 2021 08:06:49 +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 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 E15E983076 for ; Sun, 19 Dec 2021 08:06:44 +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 33D5F11B3; Sat, 18 Dec 2021 23:06:44 -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 33EC03F5A1; Sat, 18 Dec 2021 23:06:39 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Jason Liu , Tom Rini , Etienne Carriere , Sughosh Ganu Subject: [RFC PATCH v2 4/8] FWU: STM32MP1: Add support to read boot index from backup register Date: Sun, 19 Dec 2021 12:36:01 +0530 Message-Id: <20211219070605.14894-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211219070605.14894-1-sughosh.ganu@linaro.org> References: <20211219070605.14894-1-sughosh.ganu@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 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 V1: * Use the TAMP_BOOTCOUNT register as suggested by Yann Gautier instead of the earlier unused register 10 board/st/stm32mp1/stm32mp1.c | 7 +++++++ include/fwu.h | 1 + 2 files changed, 8 insertions(+) diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 28402fd127..a8543c6410 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -1090,6 +1090,13 @@ int fwu_plat_get_blk_desc(struct blk_desc **desc) return 0; } +void fwu_plat_get_bootidx(void *boot_idx) +{ + u32 *bootidx = boot_idx; + + *bootidx = readl(TAMP_BOOTCOUNT); +} + struct fwu_mdata_ops *get_plat_fwu_mdata_ops(void) { if (CONFIG_IS_ENABLED(TARGET_ST_STM32MP15x) && diff --git a/include/fwu.h b/include/fwu.h index 1e7a1eabff..5ba437798d 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -29,5 +29,6 @@ int fwu_plat_get_update_index(u32 *update_idx); int fwu_plat_get_blk_desc(struct blk_desc **desc); int fwu_plat_get_alt_num(int dev_num, void *identifier); int fwu_plat_fill_partition_guids(efi_guid_t **part_guid_arr); +void fwu_plat_get_bootidx(void *boot_idx); #endif /* _FWU_H_ */