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 57DD6C433F5 for ; Wed, 8 Dec 2021 13:14:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6EBFF83061; Wed, 8 Dec 2021 14:14:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="LrvNQceC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 39ECC8309E; Wed, 8 Dec 2021 14:14:06 +0100 (CET) Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 43A82801E7 for ; Wed, 8 Dec 2021 14:14:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=etienne.carriere@linaro.org Received: by mail-ed1-x52d.google.com with SMTP id e3so8283947edu.4 for ; Wed, 08 Dec 2021 05:14:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iZXb8665SeQeiV5oLWQRqPa5lMkp4pMZWroFcusyB/Q=; b=LrvNQceCgZ1r1UOeJTAQEYhWiy3Y/HzNlL/uMzJlcXYJcBFk0qdAIGPfgGypL62TiD 9ztCcRzhIg5qHoHQFRvfzGIw7PEt4GwalzmrerGfPDmJuThmewEzjvrL6TctkXbYxb0g ax8IrCc4R35iCMM1Rh+3LVbchs9hOv6/XnHMomQ147H+is78YTypVTgCoAIwkBgU4aM7 /5SN+/5nnUWkGEZcRaG3XHrPpQYGE0Q76+flkOTFj1taE/2VAWv+1/7ONXT3u9Hd4oXs 5QzxW1fmM6DgXoQRy8DygIytRKP/TdEYkEK4I5DQFOGdNwf47mks1XxXZ9AGkKsfbRkR +CQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iZXb8665SeQeiV5oLWQRqPa5lMkp4pMZWroFcusyB/Q=; b=nZiPhzbas4QmVzS82dJQzIHXHvdanonUw85Hh/IuT/msiwKhN99AR5fq0HhxRUZnop eqjSjJQyxXfOmxeJy/K36Aow8vr6lRhCwoOCMyCe0b9c6BwYwnM3gaAWHelwfwKGYV1N yd3MTO1RnLuU23VPHoY+ypYnMnOOu0eT06oF++BIqFXVUmRbiA7t3ZBTFsjhMZ2fZZG7 zEsZvJ5uzAOb/3mykLQTPpd9bAhCBWVcImVd7vMvtvk+0K36QKOG3od+czlJqcnD5uHn tmD73upbKpEFmpYngEW9uRpri/4GTV1dSmXJlftKH3NsAvvR8jy5m87ObJe9O8oXFfTY DYiQ== X-Gm-Message-State: AOAM530yWN0Ma6See0YQgM5VZX5D+MrqQQLRukCOA9pExexFk526csRJ 3gzVmRqiMB2s8ziyynnQ9CWE7sEMMJvoksp5IdD8ZA== X-Google-Smtp-Source: ABdhPJyViPmcY3Kfs57+bzRh58EjEiD680J/ew83DOOFImK06/xylA6dGg6TDQyDvgRpDc6k48lr8LUmA+FvLQEt4+w= X-Received: by 2002:aa7:c415:: with SMTP id j21mr18828442edq.289.1638969241571; Wed, 08 Dec 2021 05:14:01 -0800 (PST) MIME-Version: 1.0 References: <20211125070146.2389-1-sughosh.ganu@linaro.org> <20211125070146.2389-3-sughosh.ganu@linaro.org> In-Reply-To: <20211125070146.2389-3-sughosh.ganu@linaro.org> From: Etienne Carriere Date: Wed, 8 Dec 2021 14:13:50 +0100 Message-ID: Subject: Re: [RFC PATCH 02/10] stm32mp: dfu: Move the ram partitions to the end of the dfu_alt_info variable To: Sughosh Ganu Cc: u-boot@lists.denx.de, Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Peng Fan , AKASHI Takahiro , Ilias Apalodimas , Jose Marinho , Grant Likely , Jason Liu Content-Type: text/plain; charset="UTF-8" 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 On Thu, 25 Nov 2021 at 08:03, Sughosh Ganu wrote: > > With the FWU multi bank update feature enabled, the dfu alt no that is > used to identify the partition to be updated is derived at runtime and > should match the partition number on the storage media. Achieve this > by moving the ram partitions to the end of the dfu_alt_info variable. > > Signed-off-by: Sughosh Ganu > --- > board/st/common/stm32mp_dfu.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c > index 00d1fb8f59..394a2704ee 100644 > --- a/board/st/common/stm32mp_dfu.c > +++ b/board/st/common/stm32mp_dfu.c > @@ -102,6 +102,7 @@ static void board_get_alt_info_mtd(struct mtd_info *mtd, char *buf) > > void set_dfu_alt_info(char *interface, char *devstr) > { > + int len; > struct udevice *dev; > struct mtd_info *mtd; > > @@ -112,9 +113,6 @@ void set_dfu_alt_info(char *interface, char *devstr) > > memset(buf, 0, sizeof(buf)); > > - snprintf(buf, DFU_ALT_BUF_LEN, > - "ram 0=%s", CONFIG_DFU_ALT_RAM0); > - > if (CONFIG_IS_ENABLED(MMC)) { > if (!uclass_get_device(UCLASS_MMC, 0, &dev)) > board_get_alt_info_mmc(dev, buf); > @@ -151,6 +149,13 @@ void set_dfu_alt_info(char *interface, char *devstr) > strncat(buf, "&virt 1=PMIC", DFU_ALT_BUF_LEN); > } > > + len = strlen(buf); > + if (buf[0] != '\0') > + len += snprintf(buf + len, DFU_ALT_BUF_LEN - len, "&"); > + > + snprintf(buf + len, DFU_ALT_BUF_LEN, > + "ram 0=%s", CONFIG_DFU_ALT_RAM0); s/DFU_ALT_BUF_LEN/DFU_ALT_BUF_LEN - len/ Should check snprintf() return value. > + > env_set("dfu_alt_info", buf); > puts("DFU alt info setting: done\n"); > } > -- > 2.17.1 >