From patchwork Thu Nov 25 07:12:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 519369 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp368204imj; Wed, 24 Nov 2021 23:14:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuEyWmTErT1EP7YRFyitn3Asjf211+L1ejqlhI9gDDYMd7p81HLac11Dt9kNXTGEei9PdL X-Received: by 2002:a05:6402:2152:: with SMTP id bq18mr15986107edb.105.1637824444449; Wed, 24 Nov 2021 23:14:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637824444; cv=none; d=google.com; s=arc-20160816; b=nuuTYxKfNBAwKxS7BrOq8mkOaoyKFb9/MwdUuqSr9G8dLoDisW/pPGiRu5MR9SlU9u ujLE9jmkI+MifLWbfdUuEOJpkLOpbwndebpecHJEwOOACtpK8nCQU+SgA4unQy8dpQWU V6hHgSPOsE/whUTX2sDODuOa3U0Zkmdc3bgIL3HXYcYBbyfevZBNKv35L6795Z1eQWOt o2biQ3ge+yMWLG6rMgvnp1a2ZSiBOb6Ih0euZBUHLUupViFncQ8o/Y9dJMgWFhz17xy7 3eplCHFT+lSMB4LwPRa7MnQvK5+/JLCCANVwukZvCqTV6Kg0KMk513TNh58qoqwss5Ui V1Kw== 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=sD++ghYtvjYL6SxlK4wCBig28M8AeyGij9iOSGV/32o2XMZDye9F214tdF/jLZV1sr kGEi6cgRbM77PrhPdHg5gkyTqm0I/236LG4NQcF2wRNQ2bHhg8uXr2E+Z3wkYU43K51q w4PpjIUAWMs3UFbGtDqow5UIkDCW71bFJskfXDOZznhmdt2WeSRCu2Fse4DBU3gogKCl Hkcwbu9bMqkRZZdAYIsJag4FkWX8J/nkRpLIHjKMY3QSu+pSdOKMfAni+v0cavZY1kWb mC9SgPaHCCga1ddfeAQAnxJ7bWU+X+F1NUFYv+XIM1+SibqfUzrkzoe+dp+Zea5yySCx nJAw== 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 yc28si4379324ejb.200.2021.11.24.23.14.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 23:14:04 -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 B404883468; Thu, 25 Nov 2021 08:13:53 +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 D1E13836C9; Thu, 25 Nov 2021 08:13:40 +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 B99D38128B for ; Thu, 25 Nov 2021 08:13:36 +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 3782511B3; Wed, 24 Nov 2021 23:13:36 -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 6FF883F5A1; Wed, 24 Nov 2021 23:13:32 -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: [RESEND 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:42:54 +0530 Message-Id: <20211125071302.3644-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211125071302.3644-1-sughosh.ganu@linaro.org> References: <20211125071302.3644-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"); }