Skip to contentSkip to conversation

dfu: add DFU_SKIP layout concept

RFC PATCH New Jaehoon Chung 2 participants 3 messages Nov 2, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20201102062402epcas1p4e4a7e14918f97a3d7989e24e9389f79b@epcas1p4.samsung.com

#1 lore raw

RFC PATCH 1/1 dfu: add DFU_SKIP layout concept

Add DFU_SKIP layout cencept.
If layout is "skip", it will be skipped after nothing to do. It's useful to support multiple board with one tar file.

---
 drivers/dfu/dfu.c     | 2 +-
 drivers/dfu/dfu_mmc.c | 9 +++++++++
 include/dfu.h         | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/dfu/dfu.c +1 -1
index a298c2c43999..f679f1fa5fe5 100644
@@ -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];
 }
 
drivers/dfu/dfu_mmc.c +9 -0
index 691d01c7ebdf..c7c324b0a986 100644
@@ -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;
include/dfu.h +1 -0
index 84abdc79acd1..2e8276c69c9f 100644
@@ -33,6 +33,7 @@ enum dfu_layout {
 	DFU_FS_EXT3,
 	DFU_FS_EXT4,
 	DFU_RAM_ADDR,
+	DFU_SKIP,
 };
 
 enum dfu_op {
Signature · 1 line
2.29.0
#2 lore raw

RFC PATCH 1/1 dfu: add DFU_SKIP layout concept

Hi Jaehoon,

Quoted 72 lines

Add DFU_SKIP layout cencept.
If layout is "skip", it will be skipped after nothing to do. It's useful to support multiple board with one tar file.

---
 drivers/dfu/dfu.c     | 2 +-
 drivers/dfu/dfu_mmc.c | 9 +++++++++
 include/dfu.h         | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/dfu/dfu.c +1 -1
index a298c2c43999..f679f1fa5fe5 100644
@@ -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];

}

drivers/dfu/dfu_mmc.c +0 -0
index 691d01c7ebdf..c7c324b0a986 100644
@@ -108,6 +108,8 @@ static int mmc_file_op(enum dfu_op op, struct

dfu_entity *dfu, case DFU_FS_EXT4:

drivers/dfu/dfu_mmc.c +2 -0
 		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));

drivers/dfu/dfu_mmc.c +7 -0
@@ -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;
include/dfu.h +0 -0
index 84abdc79acd1..2e8276c69c9f 100644

include/dfu.h enum dfu_layout { · line 39

Quoted 7 lines
include/dfu.h +1 -0
@@ -33,6 +33,7 @@ enum dfu_layout {
 	DFU_FS_EXT3,
 	DFU_FS_EXT4,
 	DFU_RAM_ADDR,
+	DFU_SKIP,
 };
 
 enum dfu_op {

Fine for me. Please add a verbose description to doc/DFU.readme with some examples (i.e. which target board and how you plan to use this feature).

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201102/e5473651/attachment.sig>

#3 lore raw

RFC PATCH 1/1 dfu: add DFU_SKIP layout concept

Hi Lukasz,

Quoted 80 lines · Lukasz Majewski

Hi Jaehoon,

Quoted 78 lines

Add DFU_SKIP layout cencept.
If layout is "skip", it will be skipped after nothing to do. It's useful to support multiple board with one tar file.

---
 drivers/dfu/dfu.c     | 2 +-
 drivers/dfu/dfu_mmc.c | 9 +++++++++
 include/dfu.h         | 1 +
 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/dfu/dfu.c +1 -1
index a298c2c43999..f679f1fa5fe5 100644
@@ -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];

}

drivers/dfu/dfu_mmc.c +0 -0
index 691d01c7ebdf..c7c324b0a986 100644
@@ -108,6 +108,8 @@ static int mmc_file_op(enum dfu_op op, struct

dfu_entity *dfu, case DFU_FS_EXT4:

drivers/dfu/dfu_mmc.c +2 -0
 		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));

drivers/dfu/dfu_mmc.c +7 -0
@@ -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;
include/dfu.h +1 -0
index 84abdc79acd1..2e8276c69c9f 100644
@@ -33,6 +33,7 @@ enum dfu_layout {
 	DFU_FS_EXT3,
 	DFU_FS_EXT4,
 	DFU_RAM_ADDR,
+	DFU_SKIP,
 };
 
Quoted 5 lines

include/dfu.h enum dfu_layout { · line 39

Quoted 1 line
include/dfu.h +0 -0
 enum dfu_op {

Fine for me. Please add a verbose description to doc/DFU.readme with some examples (i.e. which target board and how you plan to use this feature).

Thanks for reviewing. I will resend the patch.
I have tested with only thor protocol.

Best Regards,
Jaehoon Chung

Quoted 12 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de