[U-Boot] [PATCH v4 2/3] usb:gadget:f_thor: fix write to filesystem by add dfu_flush()

Przemyslaw Marczak p.marczak at samsung.com
Mon Apr 28 18:57:28 CEST 2014


Since dfu read/write operations needs to be flushed manually,
writing to filesystem on MMC by thor was broken. MMC raw write
actually is working fine because current dfu_flush() function
writes filesystem only. This commit adds dfu_flush() to f_thor
and now filesystem write is working.

This change was tested on Trats2 board.

Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
Cc: Lukasz Majewski <l.majewski at samsung.com>
Cc: Marek Vasut <marex at denx.de>
Cc: Heiko Schocher <hs at denx.de>
Cc: Tom Rini <trini at ti.com>

---
Changes v2:
- separate fix and cleanup into two commits

Changes v3:
- none

Changes v4:
- download_tail(): remove dfu_write with 0 size
---
 drivers/usb/gadget/f_thor.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index 1190c74..a3ab6b9 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -219,15 +219,15 @@ static int download_tail(long long int left, int cnt)
 	}
 
 	/*
-	 * To store last "packet" DFU storage backend requires dfu_write with
-	 * size parameter equal to 0
+	 * To store last "packet" or write file from buffer to filesystem
+	 * DFU storage backend requires dfu_flush
 	 *
 	 * This also frees memory malloc'ed by dfu_get_buf(), so no explicit
 	 * need fo call dfu_free_buf() is needed.
 	 */
-	ret = dfu_write(dfu_entity, transfer_buffer, 0, cnt);
+	ret = dfu_flush(dfu_entity, transfer_buffer, 0, cnt);
 	if (ret)
-		error("DFU write failed [%d] cnt: %d", ret, cnt);
+		error("DFU flush failed!");
 
 exit:
 	return ret;
-- 
1.9.1



More information about the U-Boot mailing list