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 A1EF3C433EF for ; Fri, 22 Apr 2022 07:43:13 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 53D5F83D86; Fri, 22 Apr 2022 09:43:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com 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=foss.st.com header.i=@foss.st.com header.b="naCdDCPx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E1BFA83D8B; Fri, 22 Apr 2022 09:43:09 +0200 (CEST) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E07B083D85 for ; Fri, 22 Apr 2022 09:43:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=011196f9c1=patrice.chotard@foss.st.com Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 23M5uVoa014485; Fri, 22 Apr 2022 09:43:06 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=CczlXjdzWUXgGli9LcsLJDNnMrCZ81iZNFq5DfcgscE=; b=naCdDCPxPBlUM7ByEZWRwaLtgzss/e29rVQMdCqux6K7tEb1xcCFipbQl2uqgNvHen3K YcOFDwd74ONhhfkhtAmntmXHz+w2iD34y8EyaVE++QnIBMrQxLzKa3Im69U7PtUscSpP 7+j8aOizrQLY267piwYK/eOUI0NDw8aX6175YNAvbTtrnJ9uhvjK4gf/DBn6WNj6v4M4 6PaM549sAfVr42QDN7FzVBI4xyc6Vk7nOPjXsladBmVGClBsTt0bVvEEi/4kaKrZBn+T N61dxJ8foTQo9vBK4XVj9pUMN4hPlyHJ2RXjv2UIMuVqbCS8FALo/bIfMTCYeXaWGabL 2A== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3ffpqh79bx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Apr 2022 09:43:06 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 91229100034; Fri, 22 Apr 2022 09:43:05 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 89364216840; Fri, 22 Apr 2022 09:43:05 +0200 (CEST) Received: from [10.201.21.201] (10.75.127.44) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Fri, 22 Apr 2022 09:43:04 +0200 Message-ID: Date: Fri, 22 Apr 2022 09:43:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH 7/8] stm32mp: stm32prog: handle U-Boot script in flashlayout alternate Content-Language: en-US To: Patrick Delaunay , CC: Jaehoon Chung , Simon Glass , U-Boot STM32 References: <20220328172534.1196119-1-patrick.delaunay@foss.st.com> <20220328192520.7.I08598ebf2b427ac25eaf56e05799ac8d2dc42947@changeid> From: Patrice CHOTARD In-Reply-To: <20220328192520.7.I08598ebf2b427ac25eaf56e05799ac8d2dc42947@changeid> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-22_02,2022-04-21_01,2022-02-23_01 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 Hi Patrick On 3/28/22 19:25, Patrick Delaunay wrote: > Update the stm32prog command to allow the reception of U-Boot script in > the FlashLayout alternate during the first USB enumeration. > > This patch is aligned with the last TF-A behavior: the Flashlayout > is now loaded by U-Boot; it is no more present at STM32_DDR_BASE when > the stm32prog is launched after a serial boot, on UART or on USB. > > The received script must be a U-Boot legacy image, no more need to add > a stm32image header. > > Signed-off-by: Patrick Delaunay > --- > > arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c | 9 ++------- > arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c | 9 +++++++++ > arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h | 2 ++ > 3 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c > index 3957e06e5d..f59414e716 100644 > --- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c > +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c > @@ -76,13 +76,6 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, > stm32prog_header_check(addr, &header); > if (header.type == HEADER_STM32IMAGE) { > size = header.image_length + header.length; > - > -#if defined(CONFIG_LEGACY_IMAGE_FORMAT) > - /* uImage detected in STM32IMAGE, execute the script */ > - if (IMAGE_FORMAT_LEGACY == > - genimg_get_format((void *)(addr + header.length))) > - return image_source_script(addr + header.length, "script@1"); > -#endif > } > } > > @@ -160,6 +153,8 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc, > else if (CONFIG_IS_ENABLED(CMD_BOOTZ)) > do_bootz(cmdtp, 0, 4, bootm_argv); > } > + if (data->script) > + image_source_script(data->script, "script@stm32prog"); > > if (reset) { > puts("Reset...\n"); > diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c > index d3b3e1ed72..65655e25ca 100644 > --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c > +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1697,6 +1698,14 @@ error: > static void stm32prog_end_phase(struct stm32prog_data *data, u64 offset) > { > if (data->phase == PHASE_FLASHLAYOUT) { > +#if defined(CONFIG_LEGACY_IMAGE_FORMAT) > + if (genimg_get_format((void *)STM32_DDR_BASE) == IMAGE_FORMAT_LEGACY) { > + data->script = STM32_DDR_BASE; > + data->phase = PHASE_END; > + log_notice("U-Boot script received\n"); > + return; > + } > +#endif > if (parse_flash_layout(data, STM32_DDR_BASE, 0)) > stm32prog_err("Layout: invalid FlashLayout"); > return; > diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h > index b3e5c74810..ac300768ca 100644 > --- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h > +++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.h > @@ -170,6 +170,8 @@ struct stm32prog_data { > u32 initrd; > u32 initrd_size; > > + u32 script; > + > /* OPTEE PTA NVMEM */ > struct udevice *tee; > u32 tee_session; Reviewed-by: Patrice Chotard Thanks Patrice