[U-Boot] [PATCH] dfu: mmc: return data from raw partition reads

Stephen Warren swarren at wwwdotorg.org
Sat May 17 01:23:00 CEST 2014


From: Stephen Warren <swarren at nvidia.com>

Nothing in dfu_mmc.c ever sets dfu->r_left. Consequently, reads from
MMC DFU altsettings would return 0 bytes.

Fix this by modifying dfu_read_medium_mmc() to set *len in the same way
that dfu_nand.c's dfu_read_medium_nand() does.

Signed-off-by: Stephen Warren <swarren at nvidia.com>
---
Even though this mirrors how dfu_nand.c works, it feels odd to do this
every time a HW read is performed, since I believe this can happen
multiple times in a single DFU read transaction. Surely *len (and hence
dfu->r_left) should be set up once when the altsetting is initialized,
likely by calling a separate function in struct dfu_entity?

P.S. Could you please add a "dfu" entry into doc/git-mailrc?
---
 drivers/dfu/dfu_mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 63cc876612c9..3addcef68bde 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -203,6 +203,7 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
 
 	switch (dfu->layout) {
 	case DFU_RAW_ADDR:
+		*len = dfu->data.mmc.lba_size * dfu->data.mmc.lba_blk_size;
 		ret = mmc_block_op(DFU_OP_READ, dfu, offset, buf, len);
 		break;
 	case DFU_FS_FAT:
-- 
1.8.1.5



More information about the U-Boot mailing list