From patchwork Thu Dec 17 12:10:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344929 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1109697jai; Thu, 17 Dec 2020 04:11:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwR1/XlmIeXLmtRGQNDO88qcQ/qbwU8UD7SGdnN8YeCWTzvNvvBy/iekbmCv0fu/VA7O8Ui X-Received: by 2002:aa7:c652:: with SMTP id z18mr10762684edr.60.1608207094493; Thu, 17 Dec 2020 04:11:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608207094; cv=none; d=google.com; s=arc-20160816; b=FXiyHdaUGMbKDBSeT87jQSzFOgShSGwPjn9vhNKlS7eK1GyTwXglWYMMFKNlR7uEeY ZhZUavzkr3qN45MBDRGiXp91p9TEKjLVMcRfF6KaRcp6s7nVu+wRkrLOIs55M6sPQX+O Xy8Rr5QVHsn18t6+UmVSaAKKKupwhaEe0FdJpe2FoY/F6OqsLxTZuZ6RiP17aRf94Rfi mvnRN0KEVsCvbfIWWnyucsp9SpDRqORrISpSEwvp1xwV/Qn+steIUgWSPFJv5+S4ijp6 /vG6jDWNw3yxF8iIHM2YItDuz6xMI5OQ5WYs9fum1HAeERn/knIBYDJyYagPOzWjKJGD i1Cw== 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=ya16jB+Z+kwCN7U8YkHyf1lh+PLxOPYukIaSaAn728UboEmQvVgZJKHD8v4hXW+qB5 A6dHRymkypuPQi3bKIyCk74hPOpK4Mu34tURB1W5QlIRzJypC7LqQMa0nNBdZwsVK9NY +6Zx3xqTTvZJJ6s7bXohvFogzI/RtL4Za8e3ijLd1BTZs+giUHH2ftaUhrwqHc1muFZp hN7QkkhL75r1SyQGbAeJNh/LQsChg8JH8yMYMNajNWayhMoETBm8jmweBkctQWvej7c6 Z4nqc2FMVWFMxQQwty8LUXvtg/rdD8Ntu30DkkCeoTs9fAGedI9CX31qNerrmxf+EJ66 mNQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QttREYQf; 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 z5si2847855ejj.425.2020.12.17.04.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 04:11:34 -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=QttREYQf; 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 C966E82BB0; Thu, 17 Dec 2020 13:11:12 +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="QttREYQf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3A2BA82BC2; Thu, 17 Dec 2020 13:11:03 +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 2E9FC82BAA for ; Thu, 17 Dec 2020 13:10:54 +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 20201217121043euoutp0184ebfa6f5c149fdc6c836346c2f79f25~Rf8kOiuh41776017760euoutp01L for ; Thu, 17 Dec 2020 12:10:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201217121043euoutp0184ebfa6f5c149fdc6c836346c2f79f25~Rf8kOiuh41776017760euoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608207043; bh=1PYK7TSVsqRjuQ1A27tL/wEb5LrsmvWrTbGiH0z4Pfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QttREYQfPHT04IcXNfdQujwqpSXoAgk1v6tErHbWTt7sU6isUh/3Klnez34QF1OO1 fumkLbVgG5IOWDaah0iiAf/eQD2Wg/eWZm7w6Y4eEhJ6KJVaw+48l1NABWGGIy9TMl uXSAsMPtRSR1OHrmWNZLxPKaPFwRbV5z4Hbw6ZzM= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20201217121043eucas1p2bf15c194a956812f2a575d8fc4e162b5~Rf8j76YmB3092730927eucas1p2G; Thu, 17 Dec 2020 12:10:43 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 06.72.44805.2CA4BDF5; Thu, 17 Dec 2020 12:10:43 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201217121042eucas1p1a384f731b720e78f8e41270c627fb97b~Rf8jmT6Ta0442704427eucas1p14; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201217121042eusmtrp24e2ca62b6dc35da581def0986fabcb05~Rf8jltJaz1817818178eusmtrp2U; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) X-AuditID: cbfec7f4-b4fff7000000af05-db-5fdb4ac2c85c Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id D6.08.16282.2CA4BDF5; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201217121042eusmtip1f7d9f762f4f65c5561fa98f9d444d64a~Rf8jLVMN60935009350eusmtip1G; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH 5/5] thor: add support for the dfu_alt_info reintialization from the flashed script Date: Thu, 17 Dec 2020 13:10:30 +0100 Message-Id: <20201217121030.6352-6-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201217121030.6352-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPIsWRmVeSWpSXmKPExsWy7djPc7qHvW7HG2zZw2SxccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBZv93ayO7B5zJt1gsXj7J0djB59W1YxBjBHcdmkpOZklqUW6dsl cGVc3TeJpeAKf8XZe0eZGhgP8nQxcnJICJhIHDz3nrmLkYtDSGAFo8ShNw0sEM4XRolJb+4y QTifGSW+rt/ICtNy/ccjRojEckaJC3ensYEkwFrO9yiD2GwChhJdb7vA4iICEhK/+q8ygtjM AhcZJX7/NwaxhQVSJabPb2YHsVkEVCXet+0CWs3BwStgI3FsswvELnmJ1RsOMIPYnAK2Eh0n 37GB7JUQ6OSQmHy7hQWiyEXi2a8HbBC2sMSr41vYIWwZif875zNBNDQzSjw8t5YdwulhlLjc NIMRospa4s65X2wgm5kFNCXW79KHCDtKdK0+wAgSlhDgk7jxVhDifj6JSdumM0OEeSU62oQg qtUkZh1fB7f24IVLzBC2h8TFu9eYIMEzgVGiZ1vVBEb5WQi7FjAyrmIUTy0tzk1PLTbKSy3X K07MLS7NS9dLzs/dxAhMA6f/Hf+yg3H5q496hxiZOBgPMUpwMCuJ8CYcuBkvxJuSWFmVWpQf X1Sak1p8iFGag0VJnDdpy5p4IYH0xJLU7NTUgtQimCwTB6dUA5PVrHTpLV9nca+/fPz45AUz r17puquzjW157KvpxkULHhzOSf/WtjTOYW/Ti90+GwKkG9a8NUlTPqNVs0FaYfHO4IjY1zo5 nS7qR4o+tYe/+bCisFg/gNFg6sEzOczOVzeeubCu0e7IXskDftsCA4ODDhrNPanZ/cvlOWuE 6WOnRZN2pjwIiH9lftj3JmfZ4z0J3+12HZmYMKtOxGbNfvctb9eH9EpmV2peUjeTNT/1QcDu b/jt34d0vqlfbFetsz4bcHni2hmLXnx8mLbk5so7+o9Nz0ev/CIpP+3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: 20201217121042eucas1p1a384f731b720e78f8e41270c627fb97b X-Msg-Generator: CA X-RootMTR: 20201217121042eucas1p1a384f731b720e78f8e41270c627fb97b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201217121042eucas1p1a384f731b720e78f8e41270c627fb97b References: <20201217121030.6352-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);