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+MEInljBLLJyxjhWv50vqJHaSKTcBQouttFxuILSIgIfGr/yojiM0s cJFR4vd/YxBbWCBDovXjSbAaFgFViWX39jOB2LwCNhJ/Wv+wQGyTl1i94QDYZk4BW4klS1+C bZYQaOWQWHLtLitEkYvEtuPHoRqEJV4d38IOYctI/N85nwmioZlR4uG5tewQTg+jxOWmGYwQ VdYSd879AjqDA+g8TYn1u/Qhwo4Sl2dPBQtLCPBJ3HgrCPEAn8SkbdOZIcK8Eh1tQhDVahKz jq+DW3vwwiVoaHlIHFiwEBqMExglFp9tYZzAKD8LYdkCRsZVjOKppcW56anFRnmp5XrFibnF pXnpesn5uZsYgcng9L/jX3YwLn/1Ue8QIxMH4yFGCQ5mJRFeM6n78UK8KYmVValF+fFFpTmp xYcYpTlYlMR5k7asiRcSSE8sSc1OTS1ILYLJMnFwSjUwtTdlXFvJmi0z5dqUV6dPhpitFnu8 t11vrdKrd+w6mZUGz4tuf1gvOmteoWLDs2XJAV7ZlSqflVKPP+7kX2T7LnSp7/Qowbc5/N6W az//WHzp8JnbaW6f9uVM5lyRWKr/eOvTc06iJ6SaDBVL1xtwrNMXuxUX+VVxy4a/DByRq8vr /hXwnd/4v7StrHzvsxUL8hQb6y/HRaTJy+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xXWe8YxHq25b5i8WtMpYsKuZM6WLmWGbkw3HsY/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);