From patchwork Thu Dec 17 12:10:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344930 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1109875jai; Thu, 17 Dec 2020 04:11:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8U9KuwXDJh+QwtHetNI2NCHZkVFwocMT/DQoZGF9Q+4thof8BVwN44TAxGlCoIeFXKHGK X-Received: by 2002:aa7:dd05:: with SMTP id i5mr16643769edv.223.1608207105822; Thu, 17 Dec 2020 04:11:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608207105; cv=none; d=google.com; s=arc-20160816; b=DrM6isEV6ro6hTkaXE2wSKXJdKl/HtIH5cZpxl7BJexhvSMon7Ow/IqyznqNND6pMK w6q/sCxJAIBB/3dwNzJgC/svwGn57h6ufZCnNpC1ZqBc24B4xCu2lyF19pF8Tjepx7CC MM8oN7jGmvvhEvwpIgs7IRH/BLhW3zGYpmVDurpGqkto6VgDKNGDJuZdFGF0k5Qwr7jh AE0JSSFzT3QKGgDssDSuOPv/LgTfWu44WkH02vt801PSGRT+TdeRU2K00ITJFFS8OA9z Fg0TvWE5IiQlID22D7Zl5uDjYIGgq0/uTa7oClTOEnusfWLqgBUqXaOZuClTU61LJ7ya 0HXQ== 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=FmGO8ysNnQ+HtsLwTLhrXEqqQWYsqd/6TkRQCcSS+eCOlv7LhzUjLxFT8tDBKB20WI T/TdYzv/S7MD4ZnOrFMAicTlT/big37HrPosOnCOE5Yc/OfFLSYQ1lVkkjj4YeGyBI7G vKu2twE1XrkzTQ1dhY5GCWKqToQOXI45Ppa4W9OHAoqA0KLo0NMeMHQWiIJifUHG526b DYKq824BMXM7ehpE0aixMmo5DNTxiGA21mLwKuUntvjaBZQ3azAai/u7OK3jIT0GtSC1 N2J4+nNG2sXYDSruwH4xWiekJuQAlCHSKpj/KX7l2FH6Od6LRzln1eWf5keg5XwwuKKU frgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=HY+9ou92; 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 t17si2958883ejs.93.2020.12.17.04.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 04:11:45 -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=HY+9ou92; 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 5F72F82BCE; Thu, 17 Dec 2020 13:11:17 +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="HY+9ou92"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0C6F682BBD; Thu, 17 Dec 2020 13:11:05 +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 C496D82BAD for ; Thu, 17 Dec 2020 13:10: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=m.szyprowski@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20201217121047euoutp01fe25239a6ab0c3f5ea8f010c89992910~Rf8n6zt4G1778717787euoutp01H for ; Thu, 17 Dec 2020 12:10:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20201217121047euoutp01fe25239a6ab0c3f5ea8f010c89992910~Rf8n6zt4G1778717787euoutp01H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608207047; bh=MxT3AujAex65msl7ZgW5g5E+GqdY6NnpkjtkNalxiXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HY+9ou92W5zNifpflG6dLazs0Si8JAEar+4hwdzt/b5DL+5UIa91viEqBFGFe6nyN +RJ3hv2duoqZdA7WgiYR2EVMeLpYD6ubuvXuJHUwHjurhlfg245V0AgqCJucx92HpG qkBEYKhJHbWsrpJZbRKwCqsqD5sxaPKtyzW0JPIw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201217121041eucas1p1a374472df1a0d7e316ccaa9d081879a8~Rf8i1UzOx1918619186eucas1p1M; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 29.C8.27958.1CA4BDF5; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201217121041eucas1p144db67da9823c5ff83eb7b9eb1a8ff6a~Rf8iX0d1W1507615076eucas1p1m; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20201217121041eusmtrp247ed029d5bb02f447fc615c677fe54a9~Rf8iXK79-1810618106eusmtrp2i; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) X-AuditID: cbfec7f2-f15ff70000006d36-23-5fdb4ac11a87 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 94.08.16282.1CA4BDF5; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201217121040eusmtip102ccc212240b49b3c00d31fe8786e2dc~Rf8h8A3Pz0407904079eusmtip1n; Thu, 17 Dec 2020 12:10:40 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH 1/5] dfu: mmc: use the default MMC device if entity specifies it as -1 Date: Thu, 17 Dec 2020 13:10:26 +0100 Message-Id: <20201217121030.6352-2-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+NgFnrEIsWRmVeSWpSXmKPExsWy7djPc7oHvW7HG0yaYmqxccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBZv93ayO7B5zJt1gsXj7J0djB59W1YxBjBHcdmkpOZklqUW6dsl cGVcvf+UrWAGT8Wzu19ZGhg/cHYxcnJICJhILL6xlLWLkYtDSGAFo8SvWd1sEM4XRomT828x QjifGSW6u/czwbQcWn0bKrGcUeLQzvcscC0Tt7UzglSxCRhKdL3tYgOxRQQkJH71XwWLMwtc ZJT4/d8YxBYWiJCY/KudFcRmEVCV6Jy+DKyGV8BGYv/fnSwQ2+QlVm84wAxicwrYSnScfAd2 n4RAK4fE9UnvWSGKXCS23HrNDGELS7w6voUdwpaR+L9zPhNEQzOjxMNza9khnB5GictNMxgh qqwl7pz7BTSWA+g8TYn1u/Qhwo4SZ47NYAcJSwjwSdx4KwjxAJ/EpG3TmSHCvBIdbUIQ1WoS s46vg1t78MIlqHM8JCZ+XgwN0wmMEl0vGpkmMMrPQli2gJFxFaN4amlxbnpqsWFearlecWJu cWleul5yfu4mRmAyOP3v+KcdjHNffdQ7xMjEwXiIUYKDWUmEN+HAzXgh3pTEyqrUovz4otKc 1OJDjNIcLErivKtmr4kXEkhPLEnNTk0tSC2CyTJxcEo1MGm4lHC3HO9YJDB598/Tuf/fpt5q e65QU+54r61uly7notluT+MXletbtXT8/3/C9sSagsTnc7Q2NP23u9Gzp1FirdKLoEL7/5tV lf5tuNfhe1ec89R5v+TGB+s+LNLZ8nnt7Ixoj5onopJqO+0ulu/YubYkUfJW1ncuFd8Vn7we byjyvyhZorjTMPmzts9h5o0LHOMFc28mm1cvO6aX/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vgLPp88Vn0p4cJuA+lARb2wD1ul0xlmtyq1x5Zxr3gskLL5joRj /HRdJZbijERDLeai4kQAWKCGONYCAAA= X-CMS-MailID: 20201217121041eucas1p144db67da9823c5ff83eb7b9eb1a8ff6a X-Msg-Generator: CA X-RootMTR: 20201217121041eucas1p144db67da9823c5ff83eb7b9eb1a8ff6a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201217121041eucas1p144db67da9823c5ff83eb7b9eb1a8ff6a 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 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 Thu Dec 17 12:10:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344928 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1109520jai; Thu, 17 Dec 2020 04:11:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTWz9RVToLUjFuFXpooGWIys4ci1ZiVUrfOeR1ucapKTwwzC6Rg2PKCoGEArjikm7Dsttr X-Received: by 2002:a50:d5d5:: with SMTP id g21mr39449409edj.41.1608207082074; Thu, 17 Dec 2020 04:11:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608207082; cv=none; d=google.com; s=arc-20160816; b=vFOOdc2nC7sYNBN0hvUayvKAdx0atToHzI4G4VYvsv+QurjhUrQp5nx8Va4iP0wS7X pL5M1Idd++VTSwn70q50qQJiw/edxcDXd5qhiVPXxfkzt2KuIMW/UcsxsaN9ZbDXYnM+ nf5x3HSQGQiCnknt/EGv11gxLVS5IXGKnBVMDtYKdBzr/hiinNMy9gybFDztvb3odCVR 4yGuB3cSHDV8m0QQcDBL6+/WWEtYStiyvrohxaebpbuJvgXOAruNeuc30Z4F87hrPVix 2ne2qITaCPEIqiyBuWYPPKCxp5HIPhMumCkv8PLfa93hhyUIGDqpV9qxzQCrLwMM7xQX urVA== 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=086M726nyAb2MrF5+TGEfb2tViW2CvpY0SX5xYjAzk8=; b=xMId6SLhmVhmo/wBB3gTlbGM+mCWwpSkfEM/I9Q0klJ9TWkY2omYqmAeGfQEcZh/Bq xFLpsqYa4ZWoHB/0Hv1ZuLitOL3btMM5xGhLKjCWfqL6zEWMKj4Mfep366/Op2JxBzqb s0i1pmfcD8DBRE5y+n5P8usbJNpjtNF+SMxXh20JLQAIKNhqC3lx4BA9VwViVJjLBQMo Xxxk4NLSHMNZWxI9K4BSrISxBFlCsJuyXWs/6pfVnRjOhWbkv3AaPu+YgmKGneXpvwit WOwtqLqoqI/YsNUMM6D5oHF+HGinG3nryP6dtQN9YTt+6QHmq5nftLEHEFg0Z2hRgcRP pbRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RwydQCd6; 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 gw24si2346367ejb.715.2020.12.17.04.11.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 04:11:22 -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=RwydQCd6; 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 7FA6D82BC7; Thu, 17 Dec 2020 13:11:02 +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="RwydQCd6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CD85B82BAE; Thu, 17 Dec 2020 13:10:56 +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 56E9C82BA0 for ; Thu, 17 Dec 2020 13:10: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=m.szyprowski@samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201217121042euoutp02cf1460a6fd5804a9519a1d19ffd5971a~Rf8jbpKsw2038020380euoutp02L for ; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201217121042euoutp02cf1460a6fd5804a9519a1d19ffd5971a~Rf8jbpKsw2038020380euoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608207042; bh=086M726nyAb2MrF5+TGEfb2tViW2CvpY0SX5xYjAzk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RwydQCd6v2fsuBHe6JPtRoKYWv3odzROdaAWFhTwhvzMkjTrP4Vi9Zyd+FKfBrpiA yt0bpguqM1acHK2HrnjNYwvF84eNklapYkrdxJlOCLGTHHDkRLt8XbdZ1av7AuJMTK 0H2o7zTxcKgYm65o+Ch5csMJ6X6qwaLNMXMe+uuk= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201217121042eucas1p13dcc9b9e156dff9029d9f761774de32c~Rf8i_7NIT1918619186eucas1p1O; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 29.A0.45488.2CA4BDF5; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201217121041eucas1p19f05a4303a79c69b2f5fc3d12245bdb3~Rf8ipb3qe1507615076eucas1p1n; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20201217121041eusmtrp1bfb598d6c9a88d80c23b11f2164a8ea1~Rf8io2uQa3076830768eusmtrp12; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) X-AuditID: cbfec7f5-c5fff7000000b1b0-39-5fdb4ac23762 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AF.6A.21957.1CA4BDF5; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201217121041eusmtip1c1c269dd9815967df2f2b6b463f4c662~Rf8iQkO2w3274832748eusmtip1E; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH 2/5] dfu: add 'SKIP' entity Date: Thu, 17 Dec 2020 13:10:27 +0100 Message-Id: <20201217121030.6352-3-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+NgFnrEIsWRmVeSWpSXmKPExsWy7djPc7qHvG7HG2yczmyxccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBZv93ayO7B5zJt1gsXj7J0djB59W1YxBjBHcdmkpOZklqUW6dsl cGVcWHqfveCNaMX/R/1MDYz7BbsYOTkkBEwk1s94yNTFyMUhJLCCUeLgxVlsEM4XIOfeeWYI 5zOjxKKH/5lhWha/mccCkVjOKHF1Qi9Cy55N21hAqtgEDCW63naxgdgiAhISv/qvMoLYzAIX GSV+/zcGsYUFtCV+XvkMNpVFQFVi/tQzYL28AjYSfecOM0Jsk5dYveEAWA2ngK1Ex8l3YMsk BFo5JFZ/O84GUeQiMWn7aajzhCVeHd/CDmHLSJye3MMC0dDMKPHw3Fp2CKeHUeJy0wyoFdYS d879AprEAXSepsT6XfoQYUeJZ5/ngoUlBPgkbrwVhHiAT2LStunMEGFeiY42IYhqNYlZx9fB rT144RLUOR4SP1a/gQbjBEaJRxtOsUxglJ+FsGwBI+MqRvHU0uLc9NRi47zUcr3ixNzi0rx0 veT83E2MwGRw+t/xrzsYV7z6qHeIkYmD8RCjBAezkghvwoGb8UK8KYmVValF+fFFpTmpxYcY pTlYlMR5d21dEy8kkJ5YkpqdmlqQWgSTZeLglGpgiuS4/n1Ri7i8s8PqEE42o+zqlGSuqvIL p+6fk1G1sbi2iDnukmd8bk/n/12u3941mQhZP+Rj2Vj5/2vu7jDF2Yyznm+QjhB++uWoppvQ rDmNnGIVwt/l+v7PP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6aeZzZmEf Np9zNpi5spC5b0alkdTUyU2TT7Qd0hQPmO2YnD9xkdurhbVad2etan1R4at7/P7WDUVLTn3c +Liv8l7Nj9VXRM/dEnoobG9oeHDqufKtta9qf16uF1wRF8SdUrz0xkT7hOsuW80/y9evau5L kTSar8RSnJFoqMVcVJwIAKshBjrVAgAA X-CMS-MailID: 20201217121041eucas1p19f05a4303a79c69b2f5fc3d12245bdb3 X-Msg-Generator: CA X-RootMTR: 20201217121041eucas1p19f05a4303a79c69b2f5fc3d12245bdb3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201217121041eucas1p19f05a4303a79c69b2f5fc3d12245bdb3 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 From: Jaehoon Chung Define a new 'SKIP' type for DFU entities. The flashed data are simply ignored without returning any error values. This allows to have the same board 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. Signed-off-by: Jaehoon Chung [mszyprow: rephrased commit message and subject] Signed-off-by: Marek Szyprowski --- drivers/dfu/dfu.c | 2 +- drivers/dfu/dfu_mmc.c | 9 +++++++++ include/dfu.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) -- 2.17.1 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 Thu Dec 17 12:10:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344927 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1109244jai; Thu, 17 Dec 2020 04:11:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDuwEXQBYLU+pzMfJAXwCC0v65IBNX6sPnVCzx9hqClkyxsTe31ubPpp3c5wyNOED+qp5T X-Received: by 2002:a50:f604:: with SMTP id c4mr26737169edn.307.1608207065365; Thu, 17 Dec 2020 04:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608207065; cv=none; d=google.com; s=arc-20160816; b=LAg2NYegiGrjJ/4USvD4ir04nBSa9MZl1y125I8NDF7ck4cJXmgbZc/aXu9L83zBpN 5+6ns3hQCvwTMs+/mJcyTrMrxMKOHU9+Fs0OIKajzIk0i9HRkdbntmzARjpaQvKYZnHV wU3FvmmdhBtniF0579sM6IJqfwLQwk7tpIKQPwnlMEEjQnghB/KsTm4bkoJjT8d6PxN1 G0W7qZgbJsY4JP3GQ05GGvzVxOY7cSQQuq79suvY5EdESnHZTvBoNhIZp/VTBW1I1/+v xgQJAQD/g/9Wl6NF1BXhceH2/fM52tPWlJ9r3HJzzlidy8WSUIZPgq8ee2b9YRYjdS5R yR8g== 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=lvoJiVIOAxL1HGagwyZsenifsZq8AjD8aiOR8AcClf8=; b=s6l/yfGeJL4AgXkM8vkoHLCjxrZsF+vCAJucSFGc3QX/tlvqb7rO/YUh2Dc5pQQfSl HckSpQ2l040r5HS6g3AuWO2e12KeVe7UL7ii9G8EUo83OhYL5tRGNLviy+rYNqb5/eUq q1HvSxhwi6pESZsk2tDbmSOvaNMHb6fRagY0Rqy279u2fYhQPaLvpxbKQf/ORXiXrZuj IdSM540r5NDjBhGvXfkqTfops6dJLw9NaRUp2V8yaoJBsgPj0UooV7/ptQocP5jqM6i8 suZsNYCXmXHUPpb7XH2sQJueunV4dQVP88z8nSa8dqclrhgUUgusC35VAZDDR9+8y3cC OBuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ig0SqoM9; 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 i3si4384176edj.120.2020.12.17.04.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 04:11:05 -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=ig0SqoM9; 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 707E582BAE; Thu, 17 Dec 2020 13:10:58 +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="ig0SqoM9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8588E82BB2; Thu, 17 Dec 2020 13:10:56 +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 5D7BA82BA1 for ; Thu, 17 Dec 2020 13:10: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=m.szyprowski@samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20201217121042euoutp0243a21977c7131bcddc338091b6c969ce~Rf8jx6AUi2104421044euoutp02R for ; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201217121042euoutp0243a21977c7131bcddc338091b6c969ce~Rf8jx6AUi2104421044euoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608207043; bh=lvoJiVIOAxL1HGagwyZsenifsZq8AjD8aiOR8AcClf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ig0SqoM9LbAUgamTeJXma9iDRkrKZM/7DFub509Gu7mxDKQMF+rU+CuwgvVhX4gow w2MAdzhVby1U4p/9rjFGk6FYhkn9TZ7caCwzNY6jrFLd8wDhOwJGkzZPV/b4LNlolc YGtRA0CLBf/Pt/lfxiV29KDZ3mVodDevedTLvci4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201217121042eucas1p14f79ae91beeb3b2ee08cc4442a1777c8~Rf8jho0b_1504015040eucas1p1w; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id AA.A0.45488.2CA4BDF5; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201217121042eucas1p117e69fd3f2c47558a0be7211c3fe5f2c~Rf8jBGlow0442304423eucas1p1f; 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 20201217121042eusmtrp284c35080179a618400aa5aa7024121d2~Rf8i7ASfz1817818178eusmtrp2R; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) X-AuditID: cbfec7f5-c77ff7000000b1b0-3c-5fdb4ac2dbd0 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 35.08.16282.1CA4BDF5; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20201217121041eusmtip19550587b7af0d246e38d180769a4ad71~Rf8ikPMJS0781407814eusmtip16; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH 3/5] dfu: add 'SCRIPT' entity Date: Thu, 17 Dec 2020 13:10:28 +0100 Message-Id: <20201217121030.6352-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201217121030.6352-1-m.szyprowski@samsung.com> X-Brightmail-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BW45h0 AwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMLMWRmVeSWpSXmKPExsVy+t/xu7oHvW7HG0ycbWOxccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBZv93ayO7B5zJt1gsXj7J0djB59W1YxBjBH6dkU5ZeWpCpk5BeX 2CpFG1oY6RlaWugZmVjqGRqbx1oZmSrp29mkpOZklqUW6dsl6GXc3/qeueC7bMWNvy+YGxi/ i3cxcnJICJhIPNjzgLmLkYtDSGApo8TGVTvYIBIyEienNbBC2MISf651sUEUfWKUOLpxGTNI gk3AUKLrbRdYg4iAhMSv/quMIEXMApcZJTafPwWWEBbQlTh26z8TiM0ioCqxdMknMJtXwEbi 7r2vzBAb5CVWbzgAZnMK2Ep0nHwH1isEVNO89ijLBEa+BYwMqxhFUkuLc9Nzi430ihNzi0vz 0vWS83M3MQJDc9uxn1t2MK589VHvECMTB+MhRgkOZiUR3oQDN+OFeFMSK6tSi/Lji0pzUosP MZoC3TGRWUo0OR8YHXkl8YZmBqaGJmaWBqaWZsZK4rwmR9bECwmkJ5akZqemFqQWwfQxcXBK NTCxKh+MiQvYMNc64iLLs8oIjZfclyZ95WHx9jKq3CJy2J792sNV8ocy/H47N/o928s9S9it 9uqbgiI+rROf1HWcLddMz/TUWZoybybbGwl+nRWLWUyj+57pKTELPHqixtIaO+9puMBjz1SX 9Tt/myh+qYn96Vi5V3rrseN7XDb8t3m22JZj84JT75JbXa4fWTWb4XJLQtqly2YiznXMia3N kRMyKvYt+KI51080KsPh0pUzj//vKDnqwHBtDd+/O242E19c+bz+vfb8vRvS+P9MaS9ebrYk 8XiSzLxGlkstMR+8y5jfKr/4EFKSxyExecHS45OfaOrcl3nxrrzA4eTWBvZik5c1xxZ9ufJ+ 3hdFJZbijERDLeai4kQAWrmYctYCAAA= X-CMS-MailID: 20201217121042eucas1p117e69fd3f2c47558a0be7211c3fe5f2c X-Msg-Generator: CA X-RootMTR: 20201217121042eucas1p117e69fd3f2c47558a0be7211c3fe5f2c X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201217121042eucas1p117e69fd3f2c47558a0be7211c3fe5f2c 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 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 --- drivers/dfu/dfu.c | 6 +++++- drivers/dfu/dfu_mmc.c | 23 +++++++++++++++++++++-- include/dfu.h | 3 +++ 3 files changed, 29 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index fc32a53323..eccfb4c745 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,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", "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 Thu Dec 17 12:10:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 344932 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp1110290jai; Thu, 17 Dec 2020 04:12:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJylKzS+DMUnGrKY3Epn1icXHDIpic/k9IJ3GEnayIyqBMs+kfnfaxOI3gdqDEySwH8+o9+n X-Received: by 2002:a17:906:8152:: with SMTP id z18mr35883786ejw.317.1608207134453; Thu, 17 Dec 2020 04:12:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608207134; cv=none; d=google.com; s=arc-20160816; b=aKaB/M1yUOAwhX947eHmDoMpinGOWitP/TtmDZmbex7PITiLatzdHXOJyvFQ3Is37I Tk3MV7dzBZGGsOBtyBWLb0+Zh5Kh7t/QPc4bw4vM5WE3fUiGODaJKhEhv5si8rKKR8uK aXdiQ0Seq5x4Un0Z5taqAH4cEpqtP4wMg3P6d+ZQ67IQhMRi8JVCp95GH27LAYacn4BI vlFVKuIgnS0RFkBowt+PybaDZzkntfqBCfV2jnjjNkn674a2k5tuMyIzuAcRvewzUuVz wyhfRhmsI9vTtj2Axilm5pJMfPJf0eoJgtqx7ScBBNk0BQhUnQpwsc2PBSJtymoYjVRp Lyeg== 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=GIvAx8ousvSjUTlPYS1MqLcj2KlqYxVWsJNhVsbvyX9d1MFQ712AgzR7923JidzWVu JeZ1LG1f3kdP/1OjYb7vCm2tdh/ZAo4K4tcNbs+oSfm8mgkSxbXYxDTDSykopEzapzzw LXaC+XQqrFp8SdJJuVQdYQto87yuoFPgPVxeDiYUNB4nkPmE6TUognEYA1cQz+dNrkwH 79c4CVI+1aCw0mnipBEmibfHOoqLClxcfTvTgyq5p6p1VijfTqjeH9oxqXlocvw9bQfi jfY4FKPtq8jIgoohpjlJG+5NMN3Z/4l41I4bcU0BtJRshFAAwnC0xQ8InFbojNP8aGkI B6pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=CMgt4+z1; 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 c9si4244338edr.4.2020.12.17.04.12.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 04:12:14 -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=CMgt4+z1; 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 7CD6F82BCC; Thu, 17 Dec 2020 13:11:23 +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="CMgt4+z1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B38D82BAD; Thu, 17 Dec 2020 13:11:07 +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 7B7FE82BB0 for ; Thu, 17 Dec 2020 13:10:58 +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 20201217121048euoutp02200692b082beca50fddbc5d50295396f~Rf8omRuJ92104421044euoutp02W for ; Thu, 17 Dec 2020 12:10:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20201217121048euoutp02200692b082beca50fddbc5d50295396f~Rf8omRuJ92104421044euoutp02W DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1608207048; bh=sshgK0Im2ELhFhRgA4dQqQnUo1OEKg3KPZMl3NeTvhI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMgt4+z1rFfeOjspQtz6iCIQRWTdmRhBWlbNgWrsiOy/dDRNgi9kjs8GGslSB6GGb K7148lKuMcPNHD8eIFUvSg2AzI4Z3xFszR8P7SLy3CVm6p2sVMX1hgBvC1vM+Qo8m6 wNdqtDVLJ7LvnAB0DGpog73Cjaor8wx1RbNxvE/w= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20201217121042eucas1p1de909daab8ff29f1d00999e5888036b7~Rf8jpSSEj1299512995eucas1p15; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id BA.A0.45488.2CA4BDF5; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20201217121042eucas1p1b388f34fd6e3ead2bfb3bef71eedd06f~Rf8jS40gF0436004360eucas1p1v; 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 20201217121042eusmtrp2a343f12684ff7c621ac144e5cb3ab0d7~Rf8jSP30J1817818178eusmtrp2S; Thu, 17 Dec 2020 12:10:42 +0000 (GMT) X-AuditID: cbfec7f5-1f69da800000b1b0-3d-5fdb4ac2fd6b Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 46.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 20201217121042eusmtip1c8547efe315cc59a146e17f4ab66ea44~Rf8i3wriK0407904079eusmtip1o; Thu, 17 Dec 2020 12:10:41 +0000 (GMT) From: Marek Szyprowski To: u-boot@lists.denx.de Cc: Marek Szyprowski , Lukasz Majewski , Marek Vasut , Jaehoon Chung , Bartlomiej Zolnierkiewicz Subject: [PATCH 4/5] dfu: add support for the dfu_alt_info reintialization from the flashed script Date: Thu, 17 Dec 2020 13:10:29 +0100 Message-Id: <20201217121030.6352-5-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+NgFnrAIsWRmVeSWpSXmKPExsWy7djP87qHvG7HG0ycrm2xccZ6Vosbv9pY LZ6/u8xksfbIXXaLN22NjBZv93ayO7B5zJt1gsXj7J0djB59W1YxBjBHcdmkpOZklqUW6dsl cGW8PX6TseACT8XEXXuZGxincnUxcnBICJhIXF+U1sXIxSEksIJR4viK9+wQzhdGid6m52wQ zmdGiZMbJrJ2MXKCdUxduJARxBYSWM4oMfV9NlxH57OvYAk2AUOJrrddbCC2iICExK/+q2Bx ZoGLjBK//xuD2MICKRJf5u9kAbFZBFQlZs44BbaAV8BG4tiBCYwQy+QlVm84wAxicwrYSnSc fAd2kYRAI4fE5+tzoYpcJL6fh7GFJV4d38IOYctI/N85nwmioZlR4uG5tewQTg+jxOWmGVAd 1hJ3zv1iA4UGs4CmxPpd+hBhR4mp+yezQQKJT+LGW0GIB/gkJm2bzgwR5pXoaBOCqFaTmHV8 HdzagxcuMUPYHhJPT92BhuIERomeJU2MExjlZyEsW8DIuIpRPLW0ODc9tdg4L7Vcrzgxt7g0 L10vOT93EyMwEZz+d/zrDsYVrz7qHWJk4mA8xCjBwawkwptw4Ga8EG9KYmVValF+fFFpTmrx IUZpDhYlcd5dW9fECwmkJ5akZqemFqQWwWSZODilGpgs5wrbKH9bsW95fsrB9lql7sz2LaVL /Q3/TmvZn7a0+dfTxCtp8yun8FSd4bOZnO91zf7ItuKKtxsL/ywKXsMWaL46IkkscfGGJpHT zrvEjs80yMtfOVd+ZlvkmyTOux0P82U+8X7fbL/smNHGR8yxr8+wJwWGdabJLWu61pd5REWW 26qYdcYEbontJ/4kmNuv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8782R55O/XfF0yVoZdN83c7oNLXLyZcF0m1/TT/HNWHSj9Z9CdpX5j2Y0mH+KUDmRrUS S3FGoqEWc1FxIgB6ubNn1gIAAA== X-CMS-MailID: 20201217121042eucas1p1b388f34fd6e3ead2bfb3bef71eedd06f X-Msg-Generator: CA X-RootMTR: 20201217121042eucas1p1b388f34fd6e3ead2bfb3bef71eedd06f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20201217121042eucas1p1b388f34fd6e3ead2bfb3bef71eedd06f 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 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 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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AX29dz7nNWjKJcz+mnwwoPX/Ahm/WbLumDRte/p0Wur1qQdYnNTO2 OWIz316pnfTy/a/v+qb7F+pNZHa6qCC064vkM+btqe/+fV3pxtL+LDvVTCV01ZPeDxeXnGGL m9gfMEVZrvHBh57eCSt2l6TeauLODdP+x33lndyDJae/v7At/3y17L581Fr1iRL3Ti4xMlbm D7vQLqbEUpyRaKjFXFScCACn5gy81QIAAA== X-CMS-MailID: 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);