From patchwork Wed Jul 22 06:05:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 246948 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp253175ilg; Tue, 21 Jul 2020 23:06:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmck2Tf9yLKbLKJ6PECi//ghSOWCOkf9QdeCBy6MgaPJt8Vr5HPGsjVDzYUoAd4K7dQW9F X-Received: by 2002:a17:906:f2d6:: with SMTP id gz22mr27903731ejb.407.1595397985327; Tue, 21 Jul 2020 23:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595397985; cv=none; d=google.com; s=arc-20160816; b=Bc1r3oCT7JewJ4i0Uo/iXeTKmkMl7Jw/3ooo8QNMXhCZ9LJ4XQd8aeNyBHNymiOgfJ fdbeL8e5slduQcEd+O6FS6xdwq36YDr42i6jcYc+BUDu6HzqGOrIzsOxO4NacDG+Dk/c evPr5W7UwQH2LP5ItGkiLIbwf7UrGxZr538aldK/GSa3g1/nOd2gx6WdsopVlvltnVSC FMExBm9lqSLimyO7uLWj7IrxAnzQhSkWo1xlRNxvZQ+rlecgXUgUQKug+nlQu0HVJJGs dlbluOnLwUj2Xj+Mw04GannWeELSi6Tuk/vf8ci8XpSmxNO/DBEK7DlBQgs6AiixrCj8 bZSg== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S1O37NJAJbjY9kiplTV6qePz3AhErtoUE66DHdw37Sc=; b=fwePq2ikWeFtlKyrSnpTNxlrk1uz7orIHcsBW2z0JUM2vO2xOHzWDIVVZyTDq/zv0j jn3gHV+izh2IhP142rvuTMmFdW30WZf4//Cwkgq3eKV9VPhh0nBPNYdOizUmaxAGXxys ihc1S0MpJQZFxclt786PrdBnE+fKOKjmeRI5poKuGxVt5qmY0WElxxOkl0DSmSxYBiOD Xqw8DiUHtBC4ZwPbNdo++FkQjDSgt0HlgOtG5rPmipwkTAe5HnTqIeYvCZuBB4RcFs95 3DivvG3OYciiFRxl0upH1DMBgUu4+Tzwd+g1DyeOr7E+3h/lNxITxsarM0ySemosrmUE AoRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ejkVDDN8; 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=linaro.org 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 p7si14546118ejy.206.2020.07.21.23.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 23:06:25 -0700 (PDT) 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=@linaro.org header.s=google header.b=ejkVDDN8; 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=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5185481C1A; Wed, 22 Jul 2020 08:06:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ejkVDDN8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B2B781BA5; Wed, 22 Jul 2020 08:06:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1D9C381C1A for ; Wed, 22 Jul 2020 08:06:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x443.google.com with SMTP id 207so624046pfu.3 for ; Tue, 21 Jul 2020 23:06:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S1O37NJAJbjY9kiplTV6qePz3AhErtoUE66DHdw37Sc=; b=ejkVDDN826pYKUJe8OIxOFyGxQ3fRjLoSKY+j8sTNPpJa+DfGKyI0rhRBnCfbfig+Q RmT61EaTdX3MHXTP8BIzmjCr84T2iQGklvcJEBmBCQU7KAXlo7cye6B1UF7W5fAZfGN0 ktr2Yqk95HwZUanmyjncaGAtjx85gXNPsjBcOmZXJEhWoaBxKunDXtDLOTdRzdbCoT+6 vEZQ3n6LBXpmtqldghmmBzoZ/KOzxkVttKep6B6hnJB8IXbPI9WhN0GFvf587H85cVmW 0LcHsi5VsITvTSKf9ZHXLT/mdKQGBvctVzdGTfahR3HH1ZxWdu0Xm7KRYJqfKsFDrmZP ayww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S1O37NJAJbjY9kiplTV6qePz3AhErtoUE66DHdw37Sc=; b=CKCvPYha9Ucn5pvB002wi61IDv3g/eEEEcX+J8m6wLBrN03DJx9/shs2Uk4MVT9HgR HR6fYp/H1bwk//ds6vRz92ysJbsCHE7fOB7JqB7STlINe6DWs684faNpETy8KpufJv8P E26wnoryPxVf5+1QrbsdJiVzThtdGIYfZUPpFlvQaTyD7W8Yq2yrcrmq/wVPIv+ZW9ab I2KVIKdjCwnvMRb5MKbZpqaiNBCiA2w5lcdIQjdwiqFuXx60beYQi7XlfzHEootRXzoa ue6sNLP5ZgGepR1gS+6BV44Ovgjr+mh5QkrvPCg/SSFSx63n459M8m8EjtQ1y4v9FoK9 knmA== X-Gm-Message-State: AOAM533xY59kVOem1zwNxp6OOaNvqogXCC1+aoDM63DfwN2J2WnGXRt7 GyodsW0nvFBmDuv8jo89F23Qng== X-Received: by 2002:a62:1acc:: with SMTP id a195mr6161142pfa.32.1595397976596; Tue, 21 Jul 2020 23:06:16 -0700 (PDT) Received: from localhost.localdomain (p6e424d9a.tkyea130.ap.so-net.ne.jp. [110.66.77.154]) by smtp.gmail.com with ESMTPSA id p10sm19578759pgn.6.2020.07.21.23.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 23:06:16 -0700 (PDT) From: AKASHI Takahiro To: lukma@denx.de, trini@konsulko.com, xypron.glpk@gmx.de, agraf@csgraf.de Cc: sughosh.ganu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v4 01/16] dfu: rename dfu_tftp_write() to dfu_write_by_name() Date: Wed, 22 Jul 2020 15:05:24 +0900 Message-Id: <20200722060539.15168-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200722060539.15168-1-takahiro.akashi@linaro.org> References: <20200722060539.15168-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 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 This function is essentially independent from tffp, and will also be utilised in implementing UEFI capsule update in a later commit. So just give it a more generic name. In addition, a new configuration option, CONFIG_DFU_ALT, was introduced so that the file will be compiled with different options, particularly one added in a later commit. Signed-off-by: AKASHI Takahiro --- common/update.c | 5 +++-- drivers/dfu/Kconfig | 5 +++++ drivers/dfu/Makefile | 2 +- drivers/dfu/{dfu_tftp.c => dfu_alt.c} | 17 ++++++++++++-- include/dfu.h | 32 +++++++++++++-------------- 5 files changed, 40 insertions(+), 21 deletions(-) rename drivers/dfu/{dfu_tftp.c => dfu_alt.c} (67%) -- 2.27.0 diff --git a/common/update.c b/common/update.c index caf74e63dbbf..7f73c6372da0 100644 --- a/common/update.c +++ b/common/update.c @@ -181,8 +181,9 @@ got_update_file: } if (fit_image_check_type(fit, noffset, IH_TYPE_FIRMWARE)) { - ret = dfu_tftp_write(fit_image_name, update_addr, - update_size, interface, devstring); + ret = dfu_write_by_name(fit_image_name, update_addr, + update_size, interface, + devstring); if (ret) return ret; } diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig index 5d45d7d7c2d7..d680b28ecf51 100644 --- a/drivers/dfu/Kconfig +++ b/drivers/dfu/Kconfig @@ -14,8 +14,13 @@ config DFU_OVER_TFTP depends on NET if DFU +config DFU_ALT + bool + default n + config DFU_TFTP bool "DFU via TFTP" + select DFU_ALT select DFU_OVER_TFTP help This option allows performing update of DFU-managed medium with data diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile index 0d7925c083ef..cc7de1d3ed9b 100644 --- a/drivers/dfu/Makefile +++ b/drivers/dfu/Makefile @@ -9,5 +9,5 @@ obj-$(CONFIG_$(SPL_)DFU_MTD) += dfu_mtd.o obj-$(CONFIG_$(SPL_)DFU_NAND) += dfu_nand.o obj-$(CONFIG_$(SPL_)DFU_RAM) += dfu_ram.o obj-$(CONFIG_$(SPL_)DFU_SF) += dfu_sf.o -obj-$(CONFIG_$(SPL_)DFU_TFTP) += dfu_tftp.o +obj-$(CONFIG_$(SPL_)DFU_ALT) += dfu_alt.o obj-$(CONFIG_$(SPL_)DFU_VIRT) += dfu_virt.o diff --git a/drivers/dfu/dfu_tftp.c b/drivers/dfu/dfu_alt.c similarity index 67% rename from drivers/dfu/dfu_tftp.c rename to drivers/dfu/dfu_alt.c index ffae4bb54f80..5b1b13d7170d 100644 --- a/drivers/dfu/dfu_tftp.c +++ b/drivers/dfu/dfu_alt.c @@ -10,8 +10,21 @@ #include #include -int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len, - char *interface, char *devstring) +/** + * dfu_write_by_name() - write data to DFU medium + * @dfu_entity_name: Name of DFU entity to write + * @addr: Address of data buffer to write + * @len: Number of bytes + * @interface: Destination DFU medium (e.g. "mmc") + * @devstring: Instance number of destination DFU medium (e.g. "1") + * + * This function is storing data received on DFU supported medium which + * is specified by @dfu_entity_name. + * + * Return: 0 - on success, error code - otherwise + */ +int dfu_write_by_name(char *dfu_entity_name, unsigned int addr, + unsigned int len, char *interface, char *devstring) { char *s, *sb; int alt_setting_num, ret; diff --git a/include/dfu.h b/include/dfu.h index 6fa450593605..94b0a9e68317 100644 --- a/include/dfu.h +++ b/include/dfu.h @@ -494,27 +494,27 @@ static inline int dfu_fill_entity_virt(struct dfu_entity *dfu, char *devstr, #endif /** - * dfu_tftp_write() - write TFTP data to DFU medium + * dfu_write_by_name() - write data to DFU medium + * @dfu_entity_name: Name of DFU entity to write + * @addr: Address of data buffer to write + * @len: Number of bytes + * @interface: Destination DFU medium (e.g. "mmc") + * @devstring: Instance number of destination DFU medium (e.g. "1") * - * This function is storing data received via TFTP on DFU supported medium. + * This function is storing data received on DFU supported medium which + * is specified by @dfu_entity_name. * - * @dfu_entity_name: name of DFU entity to write - * @addr: address of data buffer to write - * @len: number of bytes - * @interface: destination DFU medium (e.g. "mmc") - * @devstring: instance number of destination DFU medium (e.g. "1") - * - * Return: 0 on success, otherwise error code + * Return: 0 - on success, error code - otherwise */ -#if CONFIG_IS_ENABLED(DFU_TFTP) -int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len, - char *interface, char *devstring); +#if CONFIG_IS_ENABLED(DFU_ALT) +int dfu_write_by_name(char *dfu_entity_name, unsigned int addr, + unsigned int len, char *interface, char *devstring); #else -static inline int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, - unsigned int len, char *interface, - char *devstring) +static inline int dfu_write_by_name(char *dfu_entity_name, unsigned int addr, + unsigned int len, char *interface, + char *devstring) { - puts("TFTP write support for DFU not available!\n"); + puts("write support for DFU not available!\n"); return -ENOSYS; } #endif