From b5f3405b9d8666bd0ab627c298cea1c927da081a Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Tue, 22 Dec 2020 11:32:21 +0100 Subject: dfu: add 'SKIP' entity 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 --- drivers/dfu/dfu_mmc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/dfu/dfu_mmc.c') 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; -- cgit