From patchwork Mon Aug 3 05:43:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 247344 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp931165ilo; Sun, 2 Aug 2020 22:44:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2TRuAsIG3yKuf5snFRttuXKZhE3hrNO9Y/Lmut3sA9vryjURmB7yw2RUsI1ySmZJ9P0me X-Received: by 2002:a17:907:213c:: with SMTP id qo28mr11386765ejb.174.1596433472929; Sun, 02 Aug 2020 22:44:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596433472; cv=none; d=google.com; s=arc-20160816; b=LQtZmPQeWRXEHMD29OcygMGMam37c/xsrnyQ1G0aseydNyZhwc8BIaUe2moXdAdBUB /x3GDBGnje+d1FVk+pw9P0ZXgEG7xm+fdPalfaZA6kAoF+80sdcttC+BExluCDBiRlFY f7DAOvd/Jcr5JdW4C6rHK4RlP1OGzvFxgpblNCqOFLdf5E2r7nobp1gB1YnDAK0zyf9m LrflE6R+OZxbUaPTFEKNR+2NToL15t38Yp1ACjtBZe2nz9FWr40xpaTc/fPcgDodHsHl V2DWBEEm+7FicNO4gq6ouNqJzippd/gQzYhGYTqgJtMGAwpWCQU3+unmQFZB7jgqC3n/ JA7A== 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=q60fj9BnBid7H3mqhf43ePZo9hZiFAbfse0ng/xm9SjluWK3aNbwV9BKNFX4gIc/0U sQmPrstnPZOT0pB6KBIYTk/G/8QSQYMfCWlxCBVgp6HEOI6KV5CShdfkukUd1DkWiEGA US1b4u2szP+xVS4nHcJptSBFqsC2mDE1kDo+Bpi6UDFjLpnwdC2ITypoohA/Mw77sMmM stfAnTVOH8DaNCzIIbizTYt2SosdHMafTYjWvVSVLafgdjb4orfXFgxsdOJfoKrQ9DAw FmFarechbt/cXY/WRRU1LMMI4RsqWnb2vK3nJqYvuVZqLoahaG7hiUAmK0JGMn8vV1V8 ezHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V9Ik+oXA; 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 j8si9532467ejy.610.2020.08.02.22.44.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2020 22:44:32 -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=V9Ik+oXA; 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 33B8381D6D; Mon, 3 Aug 2020 07:44:32 +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="V9Ik+oXA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0267C81D9E; Mon, 3 Aug 2020 07:44:30 +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-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) (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 04CD381E6F for ; Mon, 3 Aug 2020 07:44:26 +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-pj1-x1043.google.com with SMTP id 2so1590780pjx.5 for ; Sun, 02 Aug 2020 22:44:25 -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=V9Ik+oXAcA/RptMuB6JFtH8Fsg75jUigX4WcQbgVpy//gJW5MCzvkQF3/KW12dZYuD /ggkP3KZbV42npN+kg6gBvyuE6qZzwaEUwURg379z2bu3kW7+6mJeqGCrRi7t53GEcAJ DBRTOXJwx361HGyt4XOUfdMdSo9n5LTO5Iu1wQshqKKWRDv+XyJmYsA4gMOGV9QpqlFv psnRDnuS5EtB72/G0HSHbdzDsQzFYefnkgomEmBygcwPiLmdx9c88dNxGl6JymbEcQl3 0BORFT+cKXad87cZkYsOxzUKiokmSlRb26AvUcxc4Ix3rdA32R6GcxWIDPglYRVgKaGO 4gwg== 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=QHbY2NCAAsV7vHRlKviTkROijk4SdHBO1PMwnTF9dR7s4vyg/EoygocaFCApzzMtYn MNpJpHqIz3oAnAtIHZpF6g3yhzvBojUq8pD0y2BvXDkOMPNT0/+emlGgT2HWkcXFZejm YRuyF3GqCqsix2pSe9FKHGicl/efRykKyLnjfGuwjCnAGge59oYgyQZGMJ9B61dSB3rV rvSVChhe45cuABuHgYPpRajCexuzY+7AHeG1rXQ36IZQmwcHi8ToCGGu3MBv6FacQ1gT v0IpxAkf1Ycy1uedEFfWSnykYxiXb5aLUq9UCZ8PHLmjWnbCN2CehI82iUztO2s/3Kc/ vK9A== X-Gm-Message-State: AOAM533ZNENqYCv/pI3f7NrRjgHvH/vlLBt/MGCr/BnukV6An2Y1kquT qv9asgniSYHeJAiDID+OTFRog3HekPkpdg== X-Received: by 2002:a17:90a:ca87:: with SMTP id y7mr15334851pjt.102.1596433464529; Sun, 02 Aug 2020 22:44:24 -0700 (PDT) Received: from localhost.localdomain (p784a66b9.tkyea130.ap.so-net.ne.jp. [120.74.102.185]) by smtp.gmail.com with ESMTPSA id r25sm16952633pgv.88.2020.08.02.22.44.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2020 22:44:23 -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 v5 01/17] dfu: rename dfu_tftp_write() to dfu_write_by_name() Date: Mon, 3 Aug 2020 14:43:39 +0900 Message-Id: <20200803054355.17356-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200803054355.17356-1-takahiro.akashi@linaro.org> References: <20200803054355.17356-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