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 1FB86C433EF for ; Thu, 20 Jan 2022 12:24:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BFD3883876; Thu, 20 Jan 2022 13:24:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="jWE2wwci"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B6F4D83870; Thu, 20 Jan 2022 13:24:25 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E0E9B8338C for ; Thu, 20 Jan 2022 13:24:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1642681457; bh=gxRC2oba82aO2vDs3TmcHCReCh/IJJU3dSSFIYHrtnM=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=jWE2wwciCGTMRwmAPqkDkGtAIJEzr7SZw7gbtHJUa8+gpuhQcVgMPBNbuo25y6SP0 BCkEfD0wkQVuEDTsZRv5uUonnMTau2CWySTiJdd172DCqd+MxDhh8ATq5MbCKsaj6G 6/boCUh4XDlNaOrxHmQAMYH3YTyWrRX5WAd9XfZY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.123.55] ([88.152.144.107]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N95iR-1mGmpC1mkR-016Bwp; Thu, 20 Jan 2022 13:24:17 +0100 Message-ID: <329dee64-ecf4-55be-8705-f3dbdc570751@gmx.de> Date: Thu, 20 Jan 2022 13:24:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC PATCH v3 4/9] FWU: STM32MP1: Add support to read boot index from backup register Content-Language: en-US To: Sughosh Ganu Cc: Masami Hiramatsu , Patrick Delaunay , Patrice Chotard , Alexander Graf , AKASHI Takahiro , Simon Glass , Bin Meng , Ilias Apalodimas , Jose Marinho , Grant Likely , Tom Rini , Etienne Carriere , u-boot@lists.denx.de References: <20220119185548.16730-1-sughosh.ganu@linaro.org> <20220119185548.16730-5-sughosh.ganu@linaro.org> From: Heinrich Schuchardt In-Reply-To: <20220119185548.16730-5-sughosh.ganu@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ETzhNoTcJmmnZxJijSmGthlfFIMPuLZ+WoJZ75msVusH0OnPWQM f0febV7pPs6fEMQlgQURon7+NVNpFTNcpSHkfBUnXImLtnW27Pq5TJ+DC58RqJIy0OTlkAR WQfZnXzWSsokOVFyDHaZkYUN2iikhUoHaaoqGBa0h0jT23EyzKTgrU1yw6Hly8SbNAcjOua bT+ozX7m4segZYwMil+xA== X-UI-Out-Filterresults: notjunk:1;V03:K0:gNK9eB+ClLk=:yBM1LEE0H21cpdrj/19QJv WdX0RMqsFp+cMzPIj8tDV0wi6m1ASIvAfWl4SS6KW7PVBrTGC+rYgqZjA1cf0yYT9J1pkt/2B 6sYSeW/s9vKOgw3ISUye25RvMBXcjDhRggmgpJum+rRu665yJKI5CmEu9SgUYWSrxiKgtUiA6 YotDTYwP5tFHpTRMw0YO1NEv1WN5fa8pArufir20zfxTJRkPygRPKNH6o5zBVMSuoGO63O1fH j1PbymE6v1u7/13hKzDN+aaeALoo/ekxAB31BAeNzecv1n7xbiW0P00kzSA4wsABKBS60QZmM kTHIuIwSFWIfuuon+E54IWDVimJ0P1GzZ6nCQJNDILuLB9MXpsTkhOHSM9Zp07znADjR/98Co 9p7A4wfdOCUMi+dA5/TqwQ0es4iu+gh3lT4wwviv5xXitPQNdF9Q8HJv3EpONhpkTBpIxja4g EkSybABfFdFSCXx6Xg/fsL4Q+rFaeamef56nSGDVeiUKh28n4fnF1b+EuOg2EQmss1KKvwxOd 1vR524xvJ4qS3z6W0I4gbu3oc0FMdqMVwByocpGsJYjL0PkaWu5vq33WYOfvNjZT/xx7OJM1h 04Yq4iNL1OvwDEg+VyPJzL0+1YVKjIbONDK5t9ULpoWujvieslACMHJ8/frfTp8mKOz5dso9G Xqr1ztEaf8iJPfExV/HdWzJ08vldNR9inCicQxRD4+FGjIc6/yZC4LznROnV45piyeW6SX9b5 xqq3CLR/UqpCccRP/xvptZ4bckI71RUwC2NCJCh94Owx+sWWsrRIHUzq3UM7bVrpbSWtP8j7k J9uDfkUQCGVrX0rbMb404ANCnKfIJ6t87EGw8ldkVydyLh0I2iM5qY2eg7593u0HpWptPKsT4 3Zpbh7DKnJjRVZd0QrzfsKU+WX3fQbPtKVQDHbVmQgR9qSHejsBEggUCEf9N2JLDAdLzXH/P8 QqXuRWuNaDQVhpkXR1zaA/zY4B6J5smsOhGvlNQjtagO83xZLW8HfRDqS/se8qn9J36zUjAa9 XbOwjsztBOcWDsWVFwAy54apaY+gAB//QKzxsxIiL/8eZeTdYM75BJeG0Q08BCVTYO6Gor53K VIxnjgVKtsIFfY= 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 On 1/19/22 19:55, 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 > --- > > 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 =3D boot_idx; > + > + *bootidx =3D readl(TAMP_BOOTCOUNT); > +} > + Please, follow the driver model in your implementation. https://u-boot.readthedocs.io/en/latest/develop/driver-model/index.html Best regards Heinrich > 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_ */