[PATCH] usb/gadget/fsl_udc.c: fix data corruption

Eric Bénard eric at eukrea.com
Fri Jul 30 12:35:32 EDT 2010

the attached patch fixes a data corruption on the 8 last bytes of the first
packet received during dfu which are always wrong when dfu is executed for
the first time, thus preventing flashing the right binary on the board.
This was found and is tested on an i.MX27.

Signed-off-by: Eric Bénard <eric at eukrea.com>
 drivers/usb/gadget/fsl_udc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/fsl_udc.c b/drivers/usb/gadget/fsl_udc.c
index 119afcb..77d6541 100644
--- a/drivers/usb/gadget/fsl_udc.c
+++ b/drivers/usb/gadget/fsl_udc.c
@@ -1155,6 +1155,8 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length,
 	dtd->size_ioc_sts = cpu_to_le32(swap_temp);
+	dma_inv_range(req->req.buf, req->req.buf + req->req.length);
 	VDBG("length = %d address= 0x%x", *length, (int)*dma);
 	return dtd;

More information about the barebox mailing list