diff mbox series

[2/5] dfu: add 'SKIP' entity

Message ID 20201217121030.6352-3-m.szyprowski@samsung.com
State New
Headers show
Series DFU: new entity types and minor improvements | expand

Commit Message

Marek Szyprowski Dec. 17, 2020, 12:10 p.m. UTC
From: Jaehoon Chung <jh80.chung@samsung.com>


Define a new 'SKIP' type for DFU entities. The flashed data are simply
ignored without returning any error values.

This allows to have the same board 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.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>

[mszyprow: rephrased commit message and subject]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>

---
 drivers/dfu/dfu.c     | 2 +-
 drivers/dfu/dfu_mmc.c | 9 +++++++++
 include/dfu.h         | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

-- 
2.17.1
diff mbox series

Patch

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 {