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 vDW21A7IywT8HLm4HNoDE42vl8u5wrixnseyJyw+KeOwCxkIhk33eexwBcGH9ALEprbDgMmG 21tg5DqoaRKzchBYP80uyUA6g3nShe3vDLmN+RgrC+FSpohNr4Ei44N/Z190dWMsy2AgT7P8 otkIavVVvGzkVfT/WDlCeuROxTMxSorZQlOJvowihomnlb5nYmPq0J9P0L5gnHmMqsenfVsR h0CtCAjMx03o5zEkFwkjFMkplCpWroqPpphWtJLg+rgLmxruyUWkUqGmzlFUHKX663IIvoeG k3/kZXew4UAinVLwfcwapAvBTSGrbFVRh5UNI1/F0ijvO33vqz/jhUmbhwqjPpbkOBrwgPC6 MHAIfau/eO08xtcW+xtMloi6CtGw2DEnkR/WbV3wdj2u3fZG3zOAz7fsnqs7tli2r9cQNpur Tgi0qCdyr4fwR9U61YmHTs2m1IS0R1eb42OLG07lJMl1qUfTLevovtEVa7XeXUfamfK75jki WXfyBjJbswhPo58LVGwID5+WfeEwoVc6Dppv82inC/i3xbbwKg19bMON0noXS95svr+m9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: 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); }