aboutsummaryrefslogtreecommitdiff
path: root/drivers/dfu
diff options
context:
space:
mode:
authorAKASHI Takahiro2020-10-29 13:47:41 +0900
committerHeinrich Schuchardt2020-10-30 14:20:27 +0100
commit045fd8b13dc7b08a309043c28fc764c8fd2fde14 (patch)
tree3fe5fad33b5adfacd8b694659290631f3b18f029 /drivers/dfu
parent31393564462ac706c080fbd9625382540a41d27c (diff)
dfu: rename dfu_tftp_write() to dfu_write_by_name()
This function is essentially independent from tftp, 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_WRITE_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 <takahiro.akashi@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/dfu')
-rw-r--r--drivers/dfu/Kconfig5
-rw-r--r--drivers/dfu/Makefile2
-rw-r--r--drivers/dfu/dfu_alt.c (renamed from drivers/dfu/dfu_tftp.c)19
3 files changed, 22 insertions, 4 deletions
diff --git a/drivers/dfu/Kconfig b/drivers/dfu/Kconfig
index 0eec00ba734..10196f390fc 100644
--- a/drivers/dfu/Kconfig
+++ b/drivers/dfu/Kconfig
@@ -14,8 +14,13 @@ config DFU_OVER_TFTP
depends on NET
if DFU
+config DFU_WRITE_ALT
+ bool
+ default n
+
config DFU_TFTP
bool "DFU via TFTP"
+ select DFU_WRITE_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 0d7925c083e..dfbf64da667 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_WRITE_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
index ffae4bb54f8..8870967f4a6 100644
--- a/drivers/dfu/dfu_tftp.c
+++ b/drivers/dfu/dfu_alt.c
@@ -10,8 +10,21 @@
#include <errno.h>
#include <dfu.h>
-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;
@@ -44,7 +57,7 @@ int dfu_tftp_write(char *dfu_entity_name, unsigned int addr, unsigned int len,
free(sb);
if (alt_setting_num < 0) {
pr_err("Alt setting [%d] to write not found!",
- alt_setting_num);
+ alt_setting_num);
ret = -ENODEV;
goto done;
}