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/KZsHf0VOfLkn9DuuedmSgvMpTTd3 OehLZYWFL45c/Y/JtUff1eb/TAEXvyQR/23eOv3dtqlGlfMDiz/c/Ssh0RFety2F2ccld+KO LKGgTZxu1RxK9wLOFui6qLcxv5u6hm1GmOqGNQkTC0/fuPrutcDK39yVujMOFDsn+Ba/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1b82cfd65891d9c11472e22377f8005 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 {