From patchwork Tue Dec 22 10:32:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 346628 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp5206482jai; Tue, 22 Dec 2020 02:33:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJx7vnsh5NeKNN9beveKdlfnGIS+63OPMaZkibQ81cu46grLkqPCMO04vFBZvFV9h5PzoBZu X-Received: by 2002:a17:906:234d:: with SMTP id m13mr19350266eja.270.1608633233972; Tue, 22 Dec 2020 02:33:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608633233; cv=none; d=google.com; s=arc-20160816; b=tnvX28KJTiRdIErskpjDXmIqUbl7etz8IcV4biSMGE7axvMZM3O1Y3cwg/LElbM0yg 1soUoCrl/0IO90fS9Ku1qm8xYpHRP9HYEmAu3u5ITTODITvod2EwcNtwie+6ht/7CpSy 9e1lWTQz419wghvnzW+3IqlArS98bfzXljxWi+AVcJPB2e1PCgQzhLEbtFdnMmGE1ytJ UkYuqu2UyW9HRsL97UHAg3lRdCCvum3aWj7Yua/ZfGsBJ2MfPokEWdCloLfu4332OY6V wZAszsjTl98RgSKCoHzgLVgS++W0DCO/9xtD0wIE0Unf/fL9BK7MoNVrG+zJ4qJ7w1ue 28fA== 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:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=MxT3AujAex65msl7ZgW5g5E+GqdY6NnpkjtkNalxiXY=; b=QCA1z+PNOnhjG+tYVvwnEdIKrMMbIHDrVnrznUaiJ4YGY51tVVWOewT2GROjH55P6G 6YTmHh/7abiImv4l7atgitCScD+WwYQCQlhSCGsZu2Tk/KwHpV0yAL0AWpTlAENfRRvJ aEXJG4xh/oPQFBiWGhArLj/97/Zv1T/x3E2+Q/CXVDwf/G1ZRmpttpRaLdR8w2gpMWEE Q1YQDUinsnQb+dFhjD7xYBSTXSqRUVyc+2oLWTimXahw/AG/42ItQdJqVD2gIVmyNJvH SUCg1nBcpc1xHYp/OQhx9DoNeaxaiyBxEb9YsGFUrHiFnHL5W5Rp6DGep69yvky/4X36 utuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lwin7Bl8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com 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 dk28si11277521edb.336.2020.12.22.02.33.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 02:33:53 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=lwin7Bl8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 47F9B82A67; Tue, 22 Dec 2020 11:33:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com 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; unprotected) header.d=samsung.com header.i=@samsung.com header.b="lwin7Bl8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2ED4982A35; Tue, 22 Dec 2020 11:32:45 +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=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DEC1282A36 for ; Tue, 22 Dec 2020 11:32:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201222103235euoutp02bc18d3f3222440f409d1e10809b4b3cd~TA1TpEv6g0281402814euoutp02d for ; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201222103235euoutp02bc18d3f3222440f409d1e10809b4b3cd~TA1TpEv6g0281402814euoutp02d DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608633155; bh=MxT3AujAex65msl7ZgW5g5E+GqdY6NnpkjtkNalxiXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lwin7Bl8yxf82NbonMjPmV3MKLDbHXsWUcEVQsoQ308DghSSz/+hrgzxsyH15mF8v YcHwvPBxRuBoBJjRSvgSMDFKJ4HikqWln839kNCWR9A3A/L5WiM/SpcGWj+oSiNp76 GOAAx7dulm/6FExpUOzplLypHn88eok8DUpngg8M= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201222103234eucas1p23ae2c7597b6a48d863c6ee84ec077bb1~TA1Tb2WGv2802328023eucas1p2P; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id CD.40.44805.24BC1EF5; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201222103234eucas1p208db1186f9c3aa72a600d5b3ebb92f2c~TA1TCcMzD1993019930eucas1p2j; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201222103234eusmtrp2ea23b627de8f1bcec973529875015f86~TA1TB1qkd1881618816eusmtrp2W; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) X-AuditID: cbfec7f4-b4fff7000000af05-a9-5fe1cb422dd2 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C2.EB.21957.24BC1EF5; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201222103234eusmtip209e8325ecf6f8a16858a8de927922a94~TA1SrDZZa3133931339eusmtip2K; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 1/5] dfu: mmc: use the default MMC device if entity specifies it as -1 Date: Tue, 22 Dec 2020 11:32:20 +0100 Message-Id: <20201222103224.9018-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222103224.9018-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIIsWRmVeSWpSXmKPExsWy7djP87pOpx/GG8w4amSxccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBZv93ayO7B5zJt1gsXj7J0djB59W1YxBjBHcdmkpOZklqUW6dsl cGVcvf+UrWAGT8Wzu19ZGhg/cHYxcnJICJhIXOrZzNTFyMUhJLCCUeLh4h5mCOcLo8S25XPY IJzPjBJ/z/UxwrScPjQTqmU5o8SDZV2scC0vlt5jAaliEzCU6HrbxQZiiwhISPzqvwrWzSxw kVHi939jEFtYIFpi5ecjYPUsAqoS+7c/YwWxeQVsJG7fPAm1TV5i9YYDzCA2p4CtxJKlL6Hi nRwSOxeUQtguEvufL2ODsIUlXh3fwg5hy0j83zkf7FIJgWag586tZYdwehglLjfNgJpkLXHn 3C+gbg6g6zQl1u/Shwg7SrQeng0WlhDgk7jxVhDifj6JSdumM0OEeSU62oQgqtUkZh1fB7f2 4IVLzBC2h8TciasYIeEzgVHi0rx77BMY5WchLFvAyLiKUTy1tDg3PbXYKC+1XK84Mbe4NC9d Lzk/dxMjMBWc/nf8yw7G5a8+6h1iZOJgPMQowcGsJMJrJnU/Xog3JbGyKrUoP76oNCe1+BCj NAeLkjhv0pY18UIC6YklqdmpqQWpRTBZJg5OqQamRUbTQrxu2Wn6iCU8bPMsVXR9Fjnr4on8 Sl3XgOATXM3Lt0269SzzhtmyZRzfT8lFVHJpFenEFLYe/DGfpyLI36fRMCXsXWz41/mqzd/M NXOURN77Wbec2PFNRLGqdfLLA8HLToS4WLgn3OlQZhR6JbFKZlu5F4t51meZkpTlipzNLz96 FJx+5cHovumyyez5gVyTDGSYZ7J5LzxjuWXqNNnf5ctfP711d2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OesFLTuW3CPcsPfx5sfBVSe/0FN+vOeUnv twRLlyuxFGckGmoxFxUnAgBqliqK1gIAAA== X-CMS-MailID: 20201222103234eucas1p208db1186f9c3aa72a600d5b3ebb92f2c X-Msg-Generator: CA X-RootMTR: 20201222103234eucas1p208db1186f9c3aa72a600d5b3ebb92f2c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201222103234eucas1p208db1186f9c3aa72a600d5b3ebb92f2c References: <20201222103224.9018-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Use the default MMC device set in the command line if entity specifies it as -1. This allows to use the same dfu_alt_info string for different MMC devices (like embedded eMMC and external SD card if data layout is the same on both devices). Signed-off-by: Marek Szyprowski --- drivers/dfu/dfu_mmc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index 691d01c7eb..784d0ec76b 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -316,7 +316,7 @@ void dfu_free_entity_mmc(struct dfu_entity *dfu) int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) { const char *entity_type; - size_t second_arg; + ssize_t second_arg; size_t third_arg; struct mmc *mmc; @@ -339,7 +339,7 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8, * with default 10. */ - second_arg = simple_strtoul(argv[1], NULL, 0); + second_arg = simple_strtol(argv[1], NULL, 0); third_arg = simple_strtoul(argv[2], NULL, 0); mmc = find_mmc_device(dfu->data.mmc.dev_num); @@ -406,7 +406,8 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) /* if it's NOT a raw write */ if (strcmp(entity_type, "raw")) { - dfu->data.mmc.dev = second_arg; + dfu->data.mmc.dev = (second_arg != -1) ? second_arg : + dfu->data.mmc.dev_num; dfu->data.mmc.part = third_arg; } From patchwork Tue Dec 22 10:32:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 346624 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp5206052jai; Tue, 22 Dec 2020 02:33:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEKxkcg6Vi0FaaE8O7I/VxZKqcVFluP4r69LKyECjtMN5YgYOLJpuCWBs3ZKPmu+81cYzL X-Received: by 2002:a17:906:2798:: with SMTP id j24mr19162338ejc.328.1608633184991; Tue, 22 Dec 2020 02:33:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608633184; cv=none; d=google.com; s=arc-20160816; b=Kd4EiX6WeNl2/9ryC9ZpW5flU7ZQpIP/5zhYvQCkNM/0TNjaW+PcA0IIYoiLlloIjW 707fCnSUs7tkJV37WsRmA6h9MxrdQulU3L/D5FIEXgOwduC4zO22uwg+3G9SvplIxQbL Gy09+tINfXZs/0brClBgjByk27TpLF6+gTKr1MkIKykf8anWi6leLaCPiXBpM5w5iPlQ 5Rt/CEU5wHRweLHg/RGeY14UXmy7yaB+ivcTd443P8E8vUtAP63O3P5c9W085fNPngFE DK0awzCKsnLdyAxIRx2ZWBZVH9KyK+7cj/ILX1hi1xQxo3XUE0w4YAyp9rb6w0awdwf3 tlJg== 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:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=d6kLc6qO4ycBGf/S4XxzJyKb0ZXIKc9BmeYAAawwA5k=; b=G89tRKvIovzp0DEHLWSmezl5WjB+iS9+UPIEbYDl+7erw5YMHbMWB+C4Up3iO5PxyO /GPNCZvf1V9sm+gLBh6xCZ5YCtLVISq07K0AGxZa3WZE57idmvUjj3TYIXEHCjHExXk2 OodWhkq+wdEaP3VnoRrBBCX1JAIbFibqqRsxJ2RyZM+DYAfdQ3C5X9uHtROPoMA5LWHJ NWp6EVQ3eS6NR0HimIFwo1OUuThPNY5sIfUS5ihN59MZI2V1EqsK78Y9Wjnlw3Y57P5N rpZxycndtpGBc0YCbZpfm2Ie5hWqjvCnZlkQvjLSTqbW3Px0gDLO6vL2+b4DnmL4FKI7 kWxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RdzNaOWd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id w4si8838712eju.637.2020.12.22.02.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 02:33:04 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RdzNaOWd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0BA7082A47; Tue, 22 Dec 2020 11:32:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com 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; unprotected) header.d=samsung.com header.i=@samsung.com header.b="RdzNaOWd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0EE2782A4A; Tue, 22 Dec 2020 11:32:41 +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=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C80B582A35 for ; Tue, 22 Dec 2020 11:32:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201222103235euoutp019c7d9bd9f1819184da5d6e08f62c2125~TA1T5-ylI3265332653euoutp01a for ; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201222103235euoutp019c7d9bd9f1819184da5d6e08f62c2125~TA1T5-ylI3265332653euoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608633155; bh=d6kLc6qO4ycBGf/S4XxzJyKb0ZXIKc9BmeYAAawwA5k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RdzNaOWdRE954AJAPXKDCvXmrWenVSjWYgfh1teNMcWTSfXU3R2NdD4wicn672dLR 2JiFj57EED5RkPai3/SidPnUVBXeOdEhR6tuxspKdipZDFLWE6/W4DD4IJEQNWE2a5 XNOynPHhbWB6g+QIQQyHh0Zq1wMfcFDCNlYggD0c= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201222103235eucas1p1a477d36d26953d2f129959e6bceb82c0~TA1TrOIJf1030810308eucas1p1C; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id D0.94.27958.24BC1EF5; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201222103234eucas1p1c1b82cfd65891d9c11472e22377f8005~TA1TVX81W2590625906eucas1p1u; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201222103234eusmtrp21f9e49fc6aeadd7d6907721bca1e0357~TA1TU0u461881618816eusmtrp2Y; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) X-AuditID: cbfec7f2-f15ff70000006d36-52-5fe1cb42ea8c Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 63.EB.21957.24BC1EF5; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201222103234eusmtip21223844c96038e22b2e9b592e3066c60~TA1S_yb3Z3041930419eusmtip2n; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 2/5] dfu: add 'SKIP' entity Date: Tue, 22 Dec 2020 11:32:21 +0100 Message-Id: <20201222103224.9018-3-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222103224.9018-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsWy7djPc7rOpx/GG1yJtNg4Yz2rxY1fbawW z99dZrJYe+Quu8WbtkZGi7d7O9kd2DzmzTrB4nH2zg5Gj74tqxgDmKO4bFJSczLLUov07RK4 Mm6/ns1WcEmtYmvbJbYGxklyXYycHBICJhKTN3xg6WLk4hASWMEocXHGUXYI5wujRPOxBiYI 5zOjxP3ePaxdjBxgLYff80HElzNKrP71lBWuY+277+wgc9kEDCW63naxgdgiAhISv/qvMoLY zAIXGSV+/zcGsYUF9CR+zvjIAmKzCKhKNC44zApi8wrYSOy51c8McZ+8xOoNB8BsTgFbiSVL XzJCxDs5JDY8TYSwXSQ2zDkGFReWeHV8CzuELSPxf+d8sA8kBJoZJR6eW8sO4fQwSlxumgHV YS1x59wvNpDXmAU0Jdbv0ocIO0qsa97MDvExn8SNt4IQ9/NJTNo2nRkizCvR0SYEUa0mMev4 Ori1By9cgjrfQ2Leji4wW0hgAqPExItmExjlZyHsWsDIuIpRPLW0ODc9tdgwL7Vcrzgxt7g0 L10vOT93EyMwCZz+d/zTDsa5rz7qHWJk4mA8xCjBwawkwmsmdT9eiDclsbIqtSg/vqg0J7X4 EKM0B4uSOO+q2WvihQTSE0tSs1NTC1KLYLJMHJxSDUzNmxWE2UTiV5k8XLspVLo1unVPh8Ck lGL1nY/mG5rbCm7XlPhZs9Wzl+Pypemauzdyq74IfMzFe9b/SctqiZPPLB/vL1q7J38Rxxr3 hQv4Vy8uenDOLHP5g6/hsXEdV5iCb7vGzLjzfe+OgiR/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ufxZ6Z87YyLTfWOV6cF/26tk5t887XbVZptemZc7RlGXh zsGc8/H8v4TeZSfeZVx08nJrtIt7unDunAdTcwW/LFhyflu/zZrb+utk+N+xnfmet3IWN6uB 1M39/p0rlViKMxINtZiLihMBR9VketUCAAA= X-CMS-MailID: 20201222103234eucas1p1c1b82cfd65891d9c11472e22377f8005 X-Msg-Generator: CA X-RootMTR: 20201222103234eucas1p1c1b82cfd65891d9c11472e22377f8005 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201222103234eucas1p1c1b82cfd65891d9c11472e22377f8005 References: <20201222103224.9018-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean From: Jaehoon Chung Define a new 'SKIP' type for the DFU entities. The flashed data for that entity is simply ignored without returning any error values. This allows to have one flashing procedure and images for the different board types or variants, where each board uses only the images relevant to it and skips the rest. This is especially usefull for the THOR protocol, which usually transfers more than one file in a single session. Signed-off-by: Jaehoon Chung Reviewed-by: Minkyu Kang [mszyprow: rephrased commit message and docs for easier reading, changed subject to "dfu: add 'SKIP' entity"] Signed-off-by: Marek Szyprowski --- Original version of this patch is available here: https://patchwork.ozlabs.org/project/uboot/patch/20201109115757.24601-1-jh80.chung@samsung.com/ --- doc/README.dfu | 15 ++++++++++++++- drivers/dfu/dfu.c | 2 +- drivers/dfu/dfu_mmc.c | 9 +++++++++ include/dfu.h | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/doc/README.dfu b/doc/README.dfu index be53b5b393..6cb1cba9d7 100644 --- a/doc/README.dfu +++ b/doc/README.dfu @@ -17,7 +17,7 @@ Overview: - The access to mediums is done in DFU backends (driver/dfu) Today the supported DFU backends are: - - MMC (RAW or FAT / EXT2 / EXT3 / EXT4 file system) + - MMC (RAW or FAT / EXT2 / EXT3 / EXT4 file system / SKIP) - NAND - RAM - SF (serial flash) @@ -91,6 +91,7 @@ Commands: part [mmcpart ] raw access to partition fat [mmcpart ] file in FAT partition ext4 [mmcpart ] file in EXT4 partition + skip 0 0 ignore flashed data with being the GPT or DOS partition index, with being the eMMC hardware partition number. @@ -103,6 +104,18 @@ Commands: "u-boot raw 0x80 0x800;uImage ext4 0 2" + If don't want to flash given image file to storage, use "skip" type + entity. + - It can be used to protect flashing wrong image for the specific board. + - Especailly, this layout will be useful when thor protocol is used, + which performs flashing in batch mode, where more than one file is + processed. + For example, if one makes a single tar file with support for the two + boards with u-boot-.bin and u-boot-.bin files, one + can use it to flash a proper u-boot image on both without a failure: + + "u-boot-.bin raw 0x80 0x800; u-boot-.bin skip 0 0" + "nand" (raw slc nand device) cmd: dfu 0 nand each element in "dfu_alt_info" = diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index 501a60b344..fc32a53323 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -614,7 +614,7 @@ const char *dfu_get_dev_type(enum dfu_device_type t) const char *dfu_get_layout(enum dfu_layout l) { const char *const dfu_layout[] = {NULL, "RAW_ADDR", "FAT", "EXT2", - "EXT3", "EXT4", "RAM_ADDR" }; + "EXT3", "EXT4", "RAM_ADDR", "SKIP" }; return dfu_layout[l]; } diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index 784d0ec76b..d1af11d94c 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -108,6 +108,8 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu, case DFU_FS_EXT4: fstype = FS_TYPE_EXT; break; + case DFU_SKIP: + return 0; default: printf("%s: Layout (%s) not (yet) supported!\n", __func__, dfu_get_layout(dfu->layout)); @@ -204,6 +206,9 @@ int dfu_write_medium_mmc(struct dfu_entity *dfu, case DFU_FS_EXT4: ret = mmc_file_buf_write(dfu, offset, buf, len); break; + case DFU_SKIP: + ret = 0; + break; default: printf("%s: Layout (%s) not (yet) supported!\n", __func__, dfu_get_layout(dfu->layout)); @@ -238,6 +243,8 @@ int dfu_get_medium_size_mmc(struct dfu_entity *dfu, u64 *size) if (ret < 0) return ret; return 0; + case DFU_SKIP: + return 0; default: printf("%s: Layout (%s) not (yet) supported!\n", __func__, dfu_get_layout(dfu->layout)); @@ -399,6 +406,8 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) dfu->layout = DFU_FS_FAT; } else if (!strcmp(entity_type, "ext4")) { dfu->layout = DFU_FS_EXT4; + } else if (!strcmp(entity_type, "skip")) { + dfu->layout = DFU_SKIP; } else { pr_err("Memory layout (%s) not supported!\n", entity_type); return -ENODEV; diff --git a/include/dfu.h b/include/dfu.h index a767adee41..0b1dae0b3b 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -33,6 +33,7 @@ enum dfu_layout { DFU_FS_EXT3, DFU_FS_EXT4, DFU_RAM_ADDR, + DFU_SKIP, }; enum dfu_op { From patchwork Tue Dec 22 10:32:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 346627 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp5206376jai; Tue, 22 Dec 2020 02:33:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwDWn/ikjG5/cbUndNM3H8NN3TTNj3suYs0ho64mi5ODw4EzuLxy7t97boW9mxyvteB5Dr/ X-Received: by 2002:a05:6402:2074:: with SMTP id bd20mr19401095edb.326.1608633221964; Tue, 22 Dec 2020 02:33:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608633221; cv=none; d=google.com; s=arc-20160816; b=MAAX8CbXCU5soB+ein1dEpnIG0Mcij9kRpjPsrD4qdrn789Aoj+AnU1Yo5eQtgcygN n+apFGlcPrfqv3Hjg9zeyuPJzXVdOuWLB7kx+0vJGxwjvtJlX49rHUXU7PYCNWKj0LBi SQ7381TaKqXJyZCz/AO7KgvcwJrw8PaBAy+TFercFG1FOoJ0/WY67hPSsxHwIB6hAmXY ZRw6YAr0ymqUT0sPSn1XYIunR4xtDbv586PimcABLicIycXyrdKnJLd6u/yHpg2h1Tsy M8o6N/fqcq8sOK1wzbxetocSWekW2/l3Zk/rbRcubSE1SKnlmdieyyPcN14qm+SBc2jk 3l5g== 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:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=Y/waDwXRIxPI3QFJoSNfogvymee7lJaGnjDAGLn1kfw=; b=rzFmMMSvPTfqOyjZYrxkawGGeBYqwWcGxUIJgPUcRHIFtN7VsZZG+19TgeG2KTvSJ7 7uaWstiHVXp7be/hTueTGEH/1TNYkGKM2Vt05F1LEQah96gwL+M9JjHspLjO/LSwU7Fn V9xWCO8Rmx1GA/RzFKPA0uzXHa2G9P+9HTZX/dwgkpacKSY4l1IQkJF6FsV2RLH8fD4z nJC7bjNHQ5vCmZmu8Oq+QgvPbeRm7AhauVu1O+BmquulvySfPfRsDcQq5yCo2bSn7/ax SXtdgUt5zC3nacJ5eGgZtAoxnT+xv7amkKd3tr5Xp8Wr8h/DORUkbBSbEfY/xTAGkpd6 vOAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=JVsZl4Qd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com 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 r2si11842944edv.308.2020.12.22.02.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 02:33:41 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=JVsZl4Qd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 966AF82A63; Tue, 22 Dec 2020 11:33:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com 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; unprotected) header.d=samsung.com header.i=@samsung.com header.b="JVsZl4Qd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CD0CE82A48; Tue, 22 Dec 2020 11:32:46 +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=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5486582A47 for ; Tue, 22 Dec 2020 11:32:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201222103235euoutp0213d3202208d1b3097ae53c9a94a4b41e~TA1UZDhpZ0348103481euoutp02k for ; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201222103235euoutp0213d3202208d1b3097ae53c9a94a4b41e~TA1UZDhpZ0348103481euoutp02k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608633155; bh=Y/waDwXRIxPI3QFJoSNfogvymee7lJaGnjDAGLn1kfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JVsZl4QdRE9DjVdTwGzUDkXtRwo8evx2bda59d0YXfFDrASyAu/dSQhP3JQTiBt88 uGUmlISkj5QiYbmVnKc5HSu7x3NKyIjEshGLQelx7wudv1zkL3cLyM0sLp5/PHH5kN +ylcblrpTvcszMGuhUyewCAjiH56g9Vvg6+p3dGU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201222103235eucas1p203a5a1e46f940b54bd68ca50e2efe731~TA1UFpF-u2800528005eucas1p2W; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 6E.40.44805.34BC1EF5; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201222103235eucas1p2ce87ebed371fc7279c57f4e368282b2d~TA1TpJEbR1994519945eucas1p2l; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201222103235eusmtrp2166230d24bdc1fb745a9e6620a8c4731~TA1TokwEf1881618816eusmtrp2a; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) X-AuditID: cbfec7f4-b4fff7000000af05-ab-5fe1cb43db2a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D3.EB.21957.34BC1EF5; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201222103234eusmtip24d88711b6da556af0b07a7d768493ef4~TA1TSZ6EJ3106731067eusmtip2L; Tue, 22 Dec 2020 10:32:34 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 3/5] dfu: add 'SCRIPT' entity Date: Tue, 22 Dec 2020 11:32:22 +0100 Message-Id: <20201222103224.9018-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222103224.9018-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe0iTYRTGfb/L9mlNvlbhyYRqVNBNy6wWWRYFSTcWRIQR6zNfnHll09Su 2sVslZpR2bCSMjLLayZLkulcbTqdXaaVpqYNypWmVEIztpxf1n+/85zncJ7z8jKkuI/yZaLi ErEyjouRCLyo6ue/WpdsNPfKl7Y0zpRW5JXR0reODFr6afA1IS0xdAmlXzPSkXSg9pxwvSD0 psZEhba816LQrKpiJCPDvIIjcEzUIawMWLffS+FM19IJZxan9KV9odNQjkSNPBlgg6Cj4hVS Iy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XCFpb4c62LDaLoE6PElD2L2EES bAKGEl1vQRKcHCICEhK/+q8yghQxC1xmlNh8/hRYQljAQOJe72NGEJtFQFXixIIdYFN5BWwk Xjb+h9ogL7F6wwGwzZwCthJLlr4EqxcCqjn4+Sf7BEa+BYwMqxhFUkuLc9Nziw31ihNzi0vz 0vWS83M3MQJDc9uxn5t3MM579VHvECMTB+MhRgkOZiURXjOp+/FCvCmJlVWpRfnxRaU5qcWH GE2B7pjILCWanA+MjrySeEMzA1NDEzNLA1NLM2Mlcd6tc9fECwmkJ5akZqemFqQWwfQxcXBK NTAde+HWGSdwSkxrSWen5qUIrsp5Lec7JXXZ916a9bJKaM+jh2JPjj/WaV245tM3RaX4hnzG rX2LJgRbrmJ6NWnrxJiNL38/dnu9OK7x8eNpa+cURT5Z8GzrIZ6Eaf9VDyT6rzwdUvIuvUVr gdOxQKdr4svr1/Ju/XZqmttpc1fW6Zfnmhnd2vnw7YJNx1SmzNYL2fzmm+Lxin9GEcHlt1y+ iKdMKlzD5efceNe23WjX6tI67qxdB0sDSr4ub/hlaP78suRmw7m8L1695979zTok7s9HAZao BdvOixYdqTq0R+Syx9oS+eh1P1cKrbZ/8lFabEFd2ravJ6wFe8O+HTVouvLUYNE3+XCzgmfH Wg742iuxFGckGmoxFxUnAgCsLAvm1gIAAA== X-CMS-MailID: 20201222103235eucas1p2ce87ebed371fc7279c57f4e368282b2d X-Msg-Generator: CA X-RootMTR: 20201222103235eucas1p2ce87ebed371fc7279c57f4e368282b2d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201222103235eucas1p2ce87ebed371fc7279c57f4e368282b2d References: <20201222103224.9018-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Define a new 'SCRIPT' type for DFU entities. The downloaded data are treated as simple u-boot's scripts and executed with run_command_list() function. Flashing the 'SCRIPT' entity might result in changing the 'dfu_alt_info' environment variable from the flashed script, so add a global variable for tracking the potential need to reinitialize the dfu_alt_info related structures. Signed-off-by: Marek Szyprowski --- doc/README.dfu | 17 ++++++++++++++++- drivers/dfu/dfu.c | 7 ++++++- drivers/dfu/dfu_mmc.c | 23 +++++++++++++++++++++-- include/dfu.h | 3 +++ 4 files changed, 46 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/doc/README.dfu b/doc/README.dfu index 6cb1cba9d7..eacd5bbfb4 100644 --- a/doc/README.dfu +++ b/doc/README.dfu @@ -17,7 +17,7 @@ Overview: - The access to mediums is done in DFU backends (driver/dfu) Today the supported DFU backends are: - - MMC (RAW or FAT / EXT2 / EXT3 / EXT4 file system / SKIP) + - MMC (RAW or FAT / EXT2 / EXT3 / EXT4 file system / SKIP / SCRIPT) - NAND - RAM - SF (serial flash) @@ -92,6 +92,7 @@ Commands: fat [mmcpart ] file in FAT partition ext4 [mmcpart ] file in EXT4 partition skip 0 0 ignore flashed data + script 0 0 execute commands in shell with being the GPT or DOS partition index, with being the eMMC hardware partition number. @@ -116,6 +117,20 @@ Commands: "u-boot-.bin raw 0x80 0x800; u-boot-.bin skip 0 0" + When flashing new system image requires do some more complex things + than just writing data to the storage medium, one can use 'script' + type. Data written to such entity will be executed as a command list + in the u-boot's shell. This for example allows to re-create partition + layout and even set new dfu_alt_info for the newly created paritions. + Such script would look like: + --->8--- + setenv dfu_alt_info ... + setenv mbr_parts ... + mbr write ... + --->8--- + Please note that this means that user will be able to execute any + arbitrary commands just like in the u-boot's shell. + "nand" (raw slc nand device) cmd: dfu 0 nand each element in "dfu_alt_info" = diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index fc32a53323..213a20e7bc 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -26,6 +26,8 @@ static struct hash_algo *dfu_hash_algo; static unsigned long dfu_timeout = 0; #endif +bool dfu_reinit_needed = false; + /* * The purpose of the dfu_flush_callback() function is to * provide callback for dfu user @@ -139,6 +141,8 @@ int dfu_init_env_entities(char *interface, char *devstr) char *env_bkp; int ret = 0; + dfu_reinit_needed = false; + #ifdef CONFIG_SET_DFU_ALT_INFO set_dfu_alt_info(interface, devstr); #endif @@ -614,7 +618,8 @@ const char *dfu_get_dev_type(enum dfu_device_type t) const char *dfu_get_layout(enum dfu_layout l) { const char *const dfu_layout[] = {NULL, "RAW_ADDR", "FAT", "EXT2", - "EXT3", "EXT4", "RAM_ADDR", "SKIP" }; + "EXT3", "EXT4", "RAM_ADDR", "SKIP", + "SCRIPT" }; return dfu_layout[l]; } diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c index d1af11d94c..e63fa84ce4 100644 --- a/drivers/dfu/dfu_mmc.c +++ b/drivers/dfu/dfu_mmc.c @@ -16,6 +16,7 @@ #include #include #include +#include static unsigned char *dfu_file_buf; static u64 dfu_file_buf_len; @@ -206,6 +207,9 @@ int dfu_write_medium_mmc(struct dfu_entity *dfu, case DFU_FS_EXT4: ret = mmc_file_buf_write(dfu, offset, buf, len); break; + case DFU_SCRIPT: + ret = run_command_list(buf, *len, 0); + break; case DFU_SKIP: ret = 0; break; @@ -221,9 +225,21 @@ int dfu_flush_medium_mmc(struct dfu_entity *dfu) { int ret = 0; - if (dfu->layout != DFU_RAW_ADDR) { - /* Do stuff here. */ + switch (dfu->layout) { + case DFU_FS_FAT: + case DFU_FS_EXT4: ret = mmc_file_buf_write_finish(dfu); + break; + case DFU_SCRIPT: + /* script may have changed the dfu_alt_info */ + dfu_reinit_needed = true; + break; + case DFU_RAW_ADDR: + case DFU_SKIP: + break; + default: + printf("%s: Layout (%s) not (yet) supported!\n", __func__, + dfu_get_layout(dfu->layout)); } return ret; @@ -243,6 +259,7 @@ int dfu_get_medium_size_mmc(struct dfu_entity *dfu, u64 *size) if (ret < 0) return ret; return 0; + case DFU_SCRIPT: case DFU_SKIP: return 0; default: @@ -408,6 +425,8 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s) dfu->layout = DFU_FS_EXT4; } else if (!strcmp(entity_type, "skip")) { dfu->layout = DFU_SKIP; + } else if (!strcmp(entity_type, "script")) { + dfu->layout = DFU_SCRIPT; } else { pr_err("Memory layout (%s) not supported!\n", entity_type); return -ENODEV; diff --git a/include/dfu.h b/include/dfu.h index 0b1dae0b3b..d18b701728 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -34,6 +34,7 @@ enum dfu_layout { DFU_FS_EXT4, DFU_RAM_ADDR, DFU_SKIP, + DFU_SCRIPT, }; enum dfu_op { @@ -497,6 +498,8 @@ static inline int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, } #endif +extern bool dfu_reinit_needed; + #if CONFIG_IS_ENABLED(DFU_WRITE_ALT) /** * dfu_write_by_name() - write data to DFU medium From patchwork Tue Dec 22 10:32:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 346626 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp5206276jai; Tue, 22 Dec 2020 02:33:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzULI4lLhmYFD7wye20IHZmZmUlH9gKDPvO19iNLbMafvtYPWEjSC8ZvWTHTqOfU+CTHh0f X-Received: by 2002:a17:906:edb2:: with SMTP id sa18mr18330218ejb.264.1608633210027; Tue, 22 Dec 2020 02:33:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608633210; cv=none; d=google.com; s=arc-20160816; b=Eyi2CN+2HTU/NeTb6ZACAmZazwu9K6/qs8HIV/+nrP5v6/Obf12/ArVpzF10tuuPZJ um1g5q5t96NnJUrWiaful+uZ0Q81JC3Qy/vgwGn2vjPY4J2B5jBG6tlByLbRb6xsZjil kzMQR+zLJGdd4yISjJIOSvbbIbN0oAegc6MmJzcfn7cBSx9Bl/bQJghEL33Zlb38VCNN Iif38ooUFDmsJxY+PHRc1aUYnerY8PlZOTrPtPWL4hU62AVdWqcRiqxxSKP5UD0lSkik WMWUij+ligHC2dlVmyu2kR9IE+qaAxCgaIN9bpOb1mX63kGZxYDpk4NOBRMq/dpFHD/t AtyQ== 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:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=sshgK0Im2ELhFhRgA4dQqQnUo1OEKg3KPZMl3NeTvhI=; b=DmzYwCj5+R5Ub/f7Ih88ZOw/3wUi+VbiPa1csADqVZfvwFvGCV1SWoDsHa4ayYmiEy T+diMPd9Rolq7OxgB4JjgKU7gFhvqo2cg50dBFg0LJ3tYQZC0J5l1scqa25jJwnuaMD9 m79iU/iv4i0BuPDvWoMF7fcquim9b1Jkb0DQlr0CRE/zSwpa42LHNoU647P+vHrw5Ziw oQtoJjftR8uZdGwYQ6EgXSeBRfX3oEgq1RAB07gFaUdK11MgbEutvcXmI9TYHYkdjS1c fQ3o63R28kArFv9HH1B2boHYKHvK6AeUQ8qvhc3/34+ESn63wfMNXTDDyKMghK3Zx0zd kEXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Pz5UCf0K; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id qp24si11078243ejb.323.2020.12.22.02.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 02:33:30 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=Pz5UCf0K; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 75B4782A5A; Tue, 22 Dec 2020 11:32:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com 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; unprotected) header.d=samsung.com header.i=@samsung.com header.b="Pz5UCf0K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9F4D682A36; Tue, 22 Dec 2020 11:32:45 +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=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BF1DD82A48 for ; Tue, 22 Dec 2020 11:32:36 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201222103236euoutp02789e188e9cce4a03d1d7fc5a3d0f3e8c~TA1UyQtcJ0286102861euoutp02N for ; Tue, 22 Dec 2020 10:32:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201222103236euoutp02789e188e9cce4a03d1d7fc5a3d0f3e8c~TA1UyQtcJ0286102861euoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608633156; bh=sshgK0Im2ELhFhRgA4dQqQnUo1OEKg3KPZMl3NeTvhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pz5UCf0KVr7aqpqGqZOTEMLC14KezPs91+ipHpMCSutsA7S0Qu13GDp7D+tKwuiIJ OAZllxUvgTUDFlrTJ9RrS9AUP3sonlCSlxvMD5w02ztVa4O8yC6z37X8UmWqsy3moH NYFuj2g036K00jIRxXCUFL6YBCRFPobpxUzEUDQs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201222103235eucas1p16007173605a8dcafc8e58c286209c6d6~TA1UYSa471028710287eucas1p1D; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 69.4C.45488.34BC1EF5; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201222103235eucas1p27ca61d4db903ce9ad0c184fa487ec954~TA1UA4gKA2801728017eucas1p2U; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201222103235eusmtrp223fbe934b6c1ff695d5d53b166c9e32d~TA1UASwfn1881618816eusmtrp2e; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) X-AuditID: cbfec7f5-c77ff7000000b1b0-cf-5fe1cb43008c Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AC.C8.16282.34BC1EF5; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201222103235eusmtip25cc20ec113a503d9f8ba1a3468936af6~TA1TmOD-i3134031340eusmtip2N; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 4/5] dfu: add support for the dfu_alt_info reintialization from the flashed script Date: Tue, 22 Dec 2020 11:32:23 +0100 Message-Id: <20201222103224.9018-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222103224.9018-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA0WSe0hTYRjG+Xbm2dl0cpySLyZoQlFRrlXYoDTtAisLMiO6KGvlYWZ6tJ15 JWRqSI1mapk3vGCWti6aqZS1NLtMUpeZ6SSdmX+IppY0NRdozWP13+99nuflffj4CEz0metB nKXVlIpWRPvgAm7jm3nTxt3tw/JN1iGx9GFBjYPUbMt0kI5OfeBI778a5EknMtOQdNJwmReI y0qL2riyzoHHSJZVr0eHsBOCHRFU9NkESiUOOCWInDT2o7gup6ScJgOmQXkCLeITQG6F8cpe rhYJCBFZjWCquQSxgxWBrjBj2fmB4F1rG/fvSsszG8YaVQgqLR1LxtLKzKCrnXFSAtpJLW5n NxLAdvUjsjNGvkfwa3GLnV1JJcw9fcrRIoLgkqvhXX+wXRaSO6C65zmHveUFd2tbMDvzSX+o vDW21A7IywT8HLm4HNoDE42vl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y07GFe++qh3iJGJg/EQowQHs5IIr5nU/Xgh3pTEyqrUovz4otKc 1OJDjKZAZ0xklhJNzgdGRl5JvKGZgamhiZmlgamlmbGSOK/JkTXxQgLpiSWp2ampBalFMH1M HJxSDUxyelGc5Wc7RHyZJda/8pfqzNz4eL7h77PrwxI3bdieyadc92/TN8trL+b/+m43zX5L fuLZFIFbyi52/4Lnlc9i+XhDdta8Lef3XXq4TzDpuzf3DKt6Pv9tGyvO/pgSpbf13yT/N0xf I6ztDnVFFkVY7K70mDdJ4J/Z3aTVXQmMMYeylrA+mSsgsKvYiN19VtoCw4uHRZYeePdJfUJ2 4aRgqUY/915x1ivz/dqeWLgIcpgdm7lbR3rWi98+/Zoli95nyIdnGmy8e0SaL7m3wjc1Mv7E keB7pnYvDUx2K+6a7v8mm+ns84qoyU/y3Ay3GN45/C2kulF/n3NK17wcDbnAuUK395yLDVtt +GBPxi4lluKMREMt5qLiRADMeosB1AIAAA== X-CMS-MailID: 20201222103235eucas1p27ca61d4db903ce9ad0c184fa487ec954 X-Msg-Generator: CA X-RootMTR: 20201222103235eucas1p27ca61d4db903ce9ad0c184fa487ec954 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201222103235eucas1p27ca61d4db903ce9ad0c184fa487ec954 References: <20201222103224.9018-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Reinitialize DFU USB gadget after flashing the 'SCRIPT' entity to ensure that the potential changes to the 'dfu_alt_info' environment variable are applied. Signed-off-by: Marek Szyprowski --- cmd/dfu.c | 14 +++++++++++++- common/dfu.c | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/cmd/dfu.c b/cmd/dfu.c index 7310595a02..89b1b2268e 100644 --- a/cmd/dfu.c +++ b/cmd/dfu.c @@ -34,6 +34,7 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) #if defined(CONFIG_DFU_TIMEOUT) || defined(CONFIG_DFU_OVER_TFTP) unsigned long value = 0; #endif + bool retry = false; if (argc >= 4) { interface = argv[2]; @@ -68,7 +69,18 @@ static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) int controller_index = simple_strtoul(usb_controller, NULL, 0); - run_usb_dnl_gadget(controller_index, "usb_dnl_dfu"); + do { + retry = false; + run_usb_dnl_gadget(controller_index, "usb_dnl_dfu"); + + if (dfu_reinit_needed) { + dfu_free_entities(); + ret = dfu_init_env_entities(interface, devstring); + if (ret) + goto done; + retry = true; + } + } while (retry); done: dfu_free_entities(); diff --git a/common/dfu.c b/common/dfu.c index d23cf67f19..16bd1ba588 100644 --- a/common/dfu.c +++ b/common/dfu.c @@ -98,6 +98,9 @@ int run_usb_dnl_gadget(int usbctrl_index, char *usb_dnl_gadget) } #endif + if (dfu_reinit_needed) + goto exit; + WATCHDOG_RESET(); usb_gadget_handle_interrupts(usbctrl_index); } From patchwork Tue Dec 22 10:32:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 346625 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp5206166jai; Tue, 22 Dec 2020 02:33:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcaUY4NOYS9SMwlsUEqlhf1YxoI0wN4ROwvMIsnZ5DTd+w/WgmmfVmQGfsZI1t23g8cc5F X-Received: by 2002:a50:becf:: with SMTP id e15mr20259410edk.138.1608633197053; Tue, 22 Dec 2020 02:33:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608633197; cv=none; d=google.com; s=arc-20160816; b=aCR+L1EJj+TLc9GhMtRYpdmv2uqtbyF9XcX8lGscshLkYX0cmZaxUhq4Gd9xHm1LFx ltsxWfvMRqGkbOhOaIc1hW2LrNnyO4DrE/tW0IZS5eCDq4mcKWXuOoAA3xdhmPCXkytM unfaav4BtqLs4khUAemIFYrc6zsl2cKM3JZj9XqC7jj/GF1Ukw5cBn/va1rOLoGYI/QG NwMHPYe18K1Lc9kCmrP/lxaAiHjyKZIPgG/TYJ38FeqsujsMqToXUnhaEKhyt0UaMy+Z exow9K4E3LMMZmsho1/M/V4QQFnMLAUzXwL8zUM+MELTLLX6aIpz9cMfNkbxWhHN9FNG n2zA== 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:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=1PYK7TSVsqRjuQ1A27tL/wEb5LrsmvWrTbGiH0z4Pfc=; b=b6f569kLh2Alnsm6l3epxIj3aTgeROLtssCHtvioRmFSlxUBHnDS0fMST6K2e8C+bi sUlyAFN67eeQalo2BSegskNJZY0YzFLaB5TeGi/i87f+h9NEtXHdMVI7Ix0+gwMJSAAe w6/X34AMgNmoSPiuiNLdkW3An0qLT0vS+oNbNDASdWtB5FxJOKdkpXvxflVpEhCWrr97 /olrOZODtAgV/F6mJc6FjyTVs75golRtmi7yH+QmLozPsTn9w3L2l0P1q4xZsGsWvhgm 5KA5im1O5+NJ8jn00+p85fK3Y6eyAQWyphBObc1hKwBgqFAD6bY65NuK2mbzloj6zWTV sRlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=O7R5deqg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com 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 z21si10431580ejj.256.2020.12.22.02.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Dec 2020 02:33:17 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=O7R5deqg; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7F38082A50; Tue, 22 Dec 2020 11:32:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com 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; unprotected) header.d=samsung.com header.i=@samsung.com header.b="O7R5deqg"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B550082A49; Tue, 22 Dec 2020 11:32:44 +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=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0C7A182A49 for ; Tue, 22 Dec 2020 11:32:37 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=m.szyprowski@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201222103236euoutp01190c765d60b44dc47b2d410bebfc5b3f~TA1VDGE_w3266232662euoutp01b for ; Tue, 22 Dec 2020 10:32:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201222103236euoutp01190c765d60b44dc47b2d410bebfc5b3f~TA1VDGE_w3266232662euoutp01b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608633156; bh=1PYK7TSVsqRjuQ1A27tL/wEb5LrsmvWrTbGiH0z4Pfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O7R5deqg3Ek5fDEcD9v/fTg+Yj1HS6QtmajuhX0gTEYj9P3KmC4t8srBCxk2JNyyU ewPzVp6GMYMjV6oSPGHfIVtzuyBnjacfEkKaJ3VAZ5XW7FRJzbyBAwuidGnp53YoGX 6N/17ZYT8GhaKUhTBMkkHvHY3mdYtmSYXuBbFbWo= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201222103236eucas1p2234cbf29d85c37cfad1042f811748972~TA1UxeJat2801128011eucas1p2L; Tue, 22 Dec 2020 10:32:36 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 2F.40.44805.44BC1EF5; Tue, 22 Dec 2020 10:32:36 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20201222103235eucas1p29d7ec775220b40f4ed1056be60465818~TA1UUGgKe1218112181eucas1p2C; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201222103235eusmtrp2dca77b139d02bb7c8ed6c33174059bda~TA1UTiTT51881618816eusmtrp2h; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) X-AuditID: cbfec7f4-b37ff7000000af05-b0-5fe1cb44b7e0 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1E.C8.16282.34BC1EF5; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20201222103235eusmtip2587e922341fc7c4a21e4ed82b09c1146~TA1T59y-v3107031070eusmtip2N; Tue, 22 Dec 2020 10:32:35 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 5/5] thor: add support for the dfu_alt_info reintialization from the flashed script Date: Tue, 22 Dec 2020 11:32:24 +0100 Message-Id: <20201222103224.9018-6-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201222103224.9018-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsWy7djPc7oupx/GG1xYJmixccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBZv93ayO7B5zJt1gsXj7J0djB59W1YxBjBHcdmkpOZklqUW6dsl cGVc3TeJpeAKf8XZe0eZGhgP8nQxcnJICJhIPF9ykL2LkYtDSGAFo8T5ZZdYIJwvjBJrrt6C ynxmlPjwqZcZpmX76t+MEInljBLLJyxjhWv50vqJ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F/9m7GLkYtDSGApo0TjjzfMEAkZiZPTGlghbGGJP9e62CCKPjFKnJ+xiQ0k wSZgKNH1tgvMFhGQkPjVfxVsErPAZUaJzedPASU4OIQF0iT2/qwEqWERUJVYdm8/E4jNK2Aj 8af1DwvEAnmJ1RsOgC3mFLCVWLL0JSOILQRUc/DzT/YJjHwLGBlWMYqklhbnpucWG+kVJ+YW l+al6yXn525iBAbmtmM/t+xgXPnqo94hRiYOxkOMEhzMSiK8ZlL344V4UxIrq1KL8uOLSnNS iw8xmgLdMZFZSjQ5HxgbeSXxhmYGpoYmZpYGppZmxkrivCZH1sQLCaQnlqRmp6YWpBbB9DFx cEo1MClt2W5jmKo97WljzvTfzDWfD1cclPn+x5P7bxPHwnu/5I/tvcnzZhfn0Qm6f88wr64S k1xz3SK76lJofkRriQ9L2JSPNkncyglnZleHzb425/PDtaEbRVZv1mN9EnN4UnXv4U8sT/a+ nMu2J+xCfCjDps1HDevTQxU2XPjiGPqN5aNmToaNsuVzb/93Ctr2Z965iSqL21vnNDnnXgha 25Jf/rA4XE6Y++6MkyVPuPd+v3oh9n++yumnapvqI0x9vloW/PF7ulKnhU+nbafEr/duS6pD IoXiBc9u3Wa6xXWe8YxHq25b5i8WtMpYsKuZM6WLmWGbkw3HsY/51e/LZZ61X1+846WAter1 321W9kosxRmJhlrMRcWJAMAmEbrVAgAA X-CMS-MailID: 20201222103235eucas1p29d7ec775220b40f4ed1056be60465818 X-Msg-Generator: CA X-RootMTR: 20201222103235eucas1p29d7ec775220b40f4ed1056be60465818 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201222103235eucas1p29d7ec775220b40f4ed1056be60465818 References: <20201222103224.9018-1-m.szyprowski@samsung.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Reinitialize dfu_env_entities after flashing the 'SCRIPT' entity to ensure that the potential changes to the 'dfu_alt_info' environment variable are applied. Signed-off-by: Marek Szyprowski --- cmd/thordown.c | 19 ++++++++++++------- drivers/usb/gadget/f_thor.c | 3 +++ include/thor.h | 2 ++ 3 files changed, 17 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/cmd/thordown.c b/cmd/thordown.c index ae20dddfdd..838764ccef 100644 --- a/cmd/thordown.c +++ b/cmd/thordown.c @@ -52,13 +52,18 @@ int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) goto exit; } - ret = thor_handle(); - if (ret) { - pr_err("THOR failed: %d\n", ret); - ret = CMD_RET_FAILURE; - goto exit; - } - + do { + ret = thor_handle(); + if (ret == THOR_DFU_REINIT_NEEDED) { + dfu_free_entities(); + ret = dfu_init_env_entities(interface, devstring); + } + if (ret) { + pr_err("THOR failed: %d\n", ret); + ret = CMD_RET_FAILURE; + goto exit; + } + } while (ret == 0); exit: g_dnl_unregister(); usb_gadget_release(controller_index); diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c index 88fc87f2e9..3e69746ee6 100644 --- a/drivers/usb/gadget/f_thor.c +++ b/drivers/usb/gadget/f_thor.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "f_thor.h" @@ -735,6 +736,8 @@ int thor_handle(void) printf("%s: No data received!\n", __func__); break; } + if (dfu_reinit_needed) + return THOR_DFU_REINIT_NEEDED; } return 0; diff --git a/include/thor.h b/include/thor.h index 62501bda17..ee67ab0a27 100644 --- a/include/thor.h +++ b/include/thor.h @@ -12,6 +12,8 @@ #include +#define THOR_DFU_REINIT_NEEDED 0xFFFFFFFE + int thor_handle(void); int thor_init(void); int thor_add(struct usb_configuration *c);