* [U-Boot] [PATCH 1/2] dfu:usb: Support for ext4
@ 2012-08-24 9:33 Lukasz Majewski
2012-08-24 9:33 ` [U-Boot] [PATCH 2/2] dfu:usb:fix: Read the "filesize" environment variable only when file read Lukasz Majewski
2012-08-24 14:31 ` [U-Boot] [PATCH 1/2] dfu:usb: Support for ext4 Marek Vasut
0 siblings, 2 replies; 4+ messages in thread
From: Lukasz Majewski @ 2012-08-24 9:33 UTC (permalink / raw)
To: u-boot
Support for ext4 file system handling at DFU.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/dfu/dfu_mmc.c | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 060145b..2270a61 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -63,10 +63,23 @@ static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
char *str_env;
int ret;
- sprintf(cmd_buf, "fat%s mmc %d:%d 0x%x %s %lx",
- op == DFU_OP_READ ? "load" : "write",
- dfu->data.mmc.dev, dfu->data.mmc.part,
- (unsigned int) buf, dfu->name, *len);
+ switch (dfu->layout) {
+ case DFU_FS_FAT:
+ sprintf(cmd_buf, "fat%s mmc %d:%d 0x%x %s %lx",
+ op == DFU_OP_READ ? "load" : "write",
+ dfu->data.mmc.dev, dfu->data.mmc.part,
+ (unsigned int) buf, dfu->name, *len);
+ break;
+ case DFU_FS_EXT4:
+ sprintf(cmd_buf, "ext4%s mmc %d:%d /%s 0x%x %ld",
+ op == DFU_OP_READ ? "load" : "write",
+ dfu->data.mmc.dev, dfu->data.mmc.part,
+ dfu->name, (unsigned int) buf, *len);
+ break;
+ default:
+ printf("%s: Layout (%s) not (yet) supported!\n", __func__,
+ dfu_get_layout(dfu->layout));
+ }
debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
@@ -107,6 +120,7 @@ int dfu_write_medium_mmc(struct dfu_entity *dfu, void *buf, long *len)
ret = mmc_block_write(dfu, buf, len);
break;
case DFU_FS_FAT:
+ case DFU_FS_EXT4:
ret = mmc_file_write(dfu, buf, len);
break;
default:
@@ -126,6 +140,7 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, void *buf, long *len)
ret = mmc_block_read(dfu, buf, len);
break;
case DFU_FS_FAT:
+ case DFU_FS_EXT4:
ret = mmc_file_read(dfu, buf, len);
break;
default:
@@ -149,12 +164,17 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
} else if (!strcmp(st, "fat")) {
dfu->layout = DFU_FS_FAT;
- dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
- dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+ } else if (!strcmp(st, "ext4")) {
+ dfu->layout = DFU_FS_EXT4;
} else {
printf("%s: Memory layout (%s) not supported!\n", __func__, st);
}
+ if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
+ dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
+ dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+ }
+
dfu->read_medium = dfu_read_medium_mmc;
dfu->write_medium = dfu_write_medium_mmc;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 2/2] dfu:usb:fix: Read the "filesize" environment variable only when file read
2012-08-24 9:33 [U-Boot] [PATCH 1/2] dfu:usb: Support for ext4 Lukasz Majewski
@ 2012-08-24 9:33 ` Lukasz Majewski
2012-08-24 14:31 ` Marek Vasut
2012-08-24 14:31 ` [U-Boot] [PATCH 1/2] dfu:usb: Support for ext4 Marek Vasut
1 sibling, 1 reply; 4+ messages in thread
From: Lukasz Majewski @ 2012-08-24 9:33 UTC (permalink / raw)
To: u-boot
The "filesize" environment variable shall be read only when relevant
file is read.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/dfu/dfu_mmc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 2270a61..5d504df 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -89,7 +89,7 @@ static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
return ret;
}
- if (dfu->layout != DFU_RAW_ADDR) {
+ if (dfu->layout != DFU_RAW_ADDR && op == DFU_OP_READ) {
str_env = getenv("filesize");
if (str_env == NULL) {
puts("dfu: Wrong file size!\n");
--
1.7.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 1/2] dfu:usb: Support for ext4
2012-08-24 9:33 [U-Boot] [PATCH 1/2] dfu:usb: Support for ext4 Lukasz Majewski
2012-08-24 9:33 ` [U-Boot] [PATCH 2/2] dfu:usb:fix: Read the "filesize" environment variable only when file read Lukasz Majewski
@ 2012-08-24 14:31 ` Marek Vasut
1 sibling, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2012-08-24 14:31 UTC (permalink / raw)
To: u-boot
Dear Lukasz Majewski,
> Support for ext4 file system handling at DFU.
>
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
[...]
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH 2/2] dfu:usb:fix: Read the "filesize" environment variable only when file read
2012-08-24 9:33 ` [U-Boot] [PATCH 2/2] dfu:usb:fix: Read the "filesize" environment variable only when file read Lukasz Majewski
@ 2012-08-24 14:31 ` Marek Vasut
0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2012-08-24 14:31 UTC (permalink / raw)
To: u-boot
Dear Lukasz Majewski,
> The "filesize" environment variable shall be read only when relevant
> file is read.
>
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
> ---
> drivers/dfu/dfu_mmc.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
> index 2270a61..5d504df 100644
> --- a/drivers/dfu/dfu_mmc.c
> +++ b/drivers/dfu/dfu_mmc.c
> @@ -89,7 +89,7 @@ static int mmc_file_op(enum dfu_mmc_op op, struct
> dfu_entity *dfu, return ret;
> }
>
> - if (dfu->layout != DFU_RAW_ADDR) {
> + if (dfu->layout != DFU_RAW_ADDR && op == DFU_OP_READ) {
> str_env = getenv("filesize");
> if (str_env == NULL) {
> puts("dfu: Wrong file size!\n");
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-08-24 14:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-24 9:33 [U-Boot] [PATCH 1/2] dfu:usb: Support for ext4 Lukasz Majewski
2012-08-24 9:33 ` [U-Boot] [PATCH 2/2] dfu:usb:fix: Read the "filesize" environment variable only when file read Lukasz Majewski
2012-08-24 14:31 ` Marek Vasut
2012-08-24 14:31 ` [U-Boot] [PATCH 1/2] dfu:usb: Support for ext4 Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox