From patchwork Thu Nov 25 07:01:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 519358 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp357017imj; Wed, 24 Nov 2021 23:03:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNJuTJ/DRQgskLyAKerStKOuiGS06ekwm+itysg1+8lzMvEzUxowVlKY48q3tZJBYxRPcu X-Received: by 2002:a50:e0c9:: with SMTP id j9mr35987828edl.336.1637823806047; Wed, 24 Nov 2021 23:03:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637823806; cv=none; d=google.com; s=arc-20160816; b=M5Mrry++LLYPCjxKzk02B4b2/hB9K6dWcNtPgQjKVC/kCXCCYO9LIBQY/9XDpGZcsD PKkFm/t/c9H2vpUmlbzu4/HL4IQNhXHtNFORst0cnMnWWmck4EIWTW6jFhJ3II2FwcF8 Jq8/l3K6yDx2hLJsWFm3n0SHIkPkiUgCTl/sprdwBmIZs/Cl0wxB4jF5YpV0flF7JPrG pmwKbggVKVIZuJZVueNGL0hojst2QWeXQfwSclBNP6SZRlpbqWchWL//tGN4o5ssTbKh gPY4BWRD+aTEsiFcJ7f4l1sFqIJI+6ZzBmRbjXXLCxqG/zA049UnNfD71m6pd9ycJAyL G//A== 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=UzVwHKqtbQSl/9CntY4NtBolQk9uQC0G/pcUmfMLLmI=; b=lgghgphfjzvD8WdMYYwNl1gtMLoLu8ltX0Oumc1b6eaG1tbumilPPXLtrNAARVl0lE 94XnbhEkF+t0FPDOQdIojBK6a09H5hgSv0u0mql/kFuA4J4NbJmaaq5WetwXA7OXOGoY rxxxTrBz+A9c29QN0GU3Sc6HHbXnDwZCZAM1ZpfQ+wFiDjGYXujB5fAyyCSKigtKL114 K91lj02GKd8RaNDcLW4kKP5bK2syZloTy9hZXPbCRgyvfkZKIfyW4mgxQKVVVmI+dcFk l+pVEMAbXCLV9rSrF/xa4M88xQ+jmJrd4vKed7Ba1PuiXhStivcA2urJWrbMwHghKtIw 8h4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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. [85.214.62.61]) by mx.google.com with ESMTPS id hq42si7407651ejc.522.2021.11.24.23.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 23:03:26 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 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 B314883468; Thu, 25 Nov 2021 08:03:13 +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 6604F82FDC; Thu, 25 Nov 2021 08:03:08 +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 5F15F82DB4 for ; Thu, 25 Nov 2021 08:03:03 +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 9078611B3; Wed, 24 Nov 2021 23:03:02 -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 C90D93F5A1; Wed, 24 Nov 2021 23:02:58 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Patrick Delaunay , Patrice Chotard , Heinrich Schuchardt , Alexander Graf , Simon Glass , Bin Meng , Peng Fan , AKASHI Takahiro , Ilias Apalodimas , Jose Marinho , Grant Likely , Jason Liu , Sughosh Ganu Subject: [RFC PATCH 02/10] stm32mp: dfu: Move the ram partitions to the end of the dfu_alt_info variable Date: Thu, 25 Nov 2021 12:31:38 +0530 Message-Id: <20211125070146.2389-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211125070146.2389-1-sughosh.ganu@linaro.org> References: <20211125070146.2389-1-sughosh.ganu@linaro.org> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 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 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); + env_set("dfu_alt_info", buf); puts("DFU alt info setting: done\n"); }