From patchwork Wed Jan 19 18:55:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 533275 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp1130735imr; Wed, 19 Jan 2022 10:57:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1vzUJmKbKokctgjEFlHktPiaNiGhJOR5fLOt37tI2n4tGxH90tjGNBuDj5Rw+jXimz2kz X-Received: by 2002:aa7:de82:: with SMTP id j2mr31411024edv.389.1642618639569; Wed, 19 Jan 2022 10:57:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642618639; cv=none; d=google.com; s=arc-20160816; b=t3jARyawAzm36hXFbzJzHmJfjTSMW4+vKmcte5oWQsUD+Fe2BQu1XJNTl4XGU/YSin Uh+QApoD2J+71+GTPTldw59QVKQwyQjdwr54IkHnqeOiHh6gdjsMivqgnD3WNh1VOWLs n2p1ucoaR/nWCKcX67zFWfTdz3EVOrl8xnde8CBNSRJAZDA4qMaN+cWPkXuqIi1w7Sje v923f21Nn5yH0oErtUgT1p3x60j07wn52P+KUEpuS80bEnjhQYaXv0J0g1goa/PjF3Oe M7s35jyu46Ow1WtUJ7JF8ziOM51QiEa/P0Jymh0nxUnETTijGm+8GU/pTLtjcoAShfSh BGXA== 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=r1ebGMGRMUC/qYMBc29oJhzXMSExK2NlBkFBpX0GhhI=; b=ekQptjYi7Khqi1IPbbYa4jeLiVZktbHBiGuj7gtw29RpxEJLQEEqdIp0YVUI7/VJcs dUeC7cI18W8TIQvRW74EQT7fUERCNM/wWpcsPf2L+zj0GUcJbCuZqTWIr/94MgaeoFcS 6HsVhxTcmMk2wnC6wOTBRrSm9DIkXmrSDhm9duQkKmahbsm66FJpmKYptqgcgvC678h1 nP5rPhKi/Cram2xOiJN5pTY1t5AriRKKsE9EomZAXLC1N16XNylRRnYqeVTRv+QIskpR Oybmb+Ps5+64Y525Gq7BNmdFdOWqziCKaxJlMqfQQiX77K3j/BoiE63FikTcO8aju0bQ zhFw== 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 hs27si369469ejc.46.2022.01.19.10.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 10:57:19 -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 E845D83857; Wed, 19 Jan 2022 19:57:01 +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 E835083855; Wed, 19 Jan 2022 19:56:59 +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 85DAA83857 for ; Wed, 19 Jan 2022 19:56:56 +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 078611FB; Wed, 19 Jan 2022 10:56:56 -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 D44523F73D; Wed, 19 Jan 2022 10:56:50 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Masami Hiramatsu , Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , Sughosh Ganu Subject: [RFC PATCH v3 4/9] FWU: STM32MP1: Add support to read boot index from backup register Date: Thu, 20 Jan 2022 00:25:43 +0530 Message-Id: <20220119185548.16730-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220119185548.16730-1-sughosh.ganu@linaro.org> References: <20220119185548.16730-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.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 V2: None 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 66cbe3f798..6e7aaaa8a4 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -1104,6 +1104,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 b23a93ac40..6393a1dbb5 100644 --- a/include/fwu.h +++ b/include/fwu.h @@ -63,5 +63,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(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_ */