From: Przemyslaw Marczak
Date: Mon, 12 May 2014 10:05:33 +0000 (+0200)
Subject: drivers:dfu: dfu_flush(): add raw data flush to complete dfu write
X-Git-Tag: v2014.07-rc2~10^2~2
X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1aa4bdc82db1e0393a461e0cd908d88418e1f632;p=u-boot
drivers:dfu: dfu_flush(): add raw data flush to complete dfu write
Before dfu write and flush operations separation,
dfu write data was flushed by host download request
with len of zero size.
Since above change manually calling dfu write with zero
size has non sense (e.g. in THOR). This should be done by
flush operation.
So now dfu_write_buffer_drain() is called in dfu_flush().
If there is any raw data to flush (like it can be in thor)
then it will be physically written to medium.
Signed-off-by: Przemyslaw Marczak
Cc: Lukasz Majewski
Cc: Heiko Schocher
Cc: Marek Vasut
---
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 51b10263b8..a93810934a 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -131,6 +131,10 @@ int dfu_flush(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
{
int ret = 0;
+ ret = dfu_write_buffer_drain(dfu);
+ if (ret)
+ return ret;
+
if (dfu->flush_medium)
ret = dfu->flush_medium(dfu);