From ab2f5c12f7ca27b0191ebae90664182510330cd6 Mon Sep 17 00:00:00 2001 From: Heiko Schocher Date: Thu, 10 Apr 2014 07:08:05 +0200 Subject: musb-new, dfu: first send request answer then call completions comment in ep0_txstate() states: "report completions as soon as the fifo's loaded; there's no win in waiting till this last packet gets acked". This is wrong for using dfu. In the dfu usecase we must send a PollTimeout to the host, so the host can wait until the U-Boot Code is ready for answering new usb requests. So the answer which contains the PollTimeout must send *before* U-Boot calls req->complete. The req->complete is used in the dfu case for flushing the medium, when entering DFU_STATE_dfuMANIFEST_SYNC state. Change-Id: Ib2941119c72761e48e15fedbdad1ecce07ae0b3d Signed-off-by: Heiko Schocher Cc: Kyungmin Park Cc: Marek Vasut Cc: Pantelis Antoniou Acked-by: Marek Vasut Acked-by: Lukasz Majewski --- drivers/usb/musb-new/musb_gadget_ep0.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/usb/musb-new/musb_gadget_ep0.c') diff --git a/drivers/usb/musb-new/musb_gadget_ep0.c b/drivers/usb/musb-new/musb_gadget_ep0.c index 6599d386dc..8c3b0a145a 100644 --- a/drivers/usb/musb-new/musb_gadget_ep0.c +++ b/drivers/usb/musb-new/musb_gadget_ep0.c @@ -576,6 +576,10 @@ static void ep0_txstate(struct musb *musb) } else request = NULL; + /* send it out, triggering a "txpktrdy cleared" irq */ + musb_ep_select(musb->mregs, 0); + musb_writew(regs, MUSB_CSR0, csr); + /* report completions as soon as the fifo's loaded; there's no * win in waiting till this last packet gets acked. (other than * very precise fault reporting, needed by USB TMC; possible with @@ -588,10 +592,6 @@ static void ep0_txstate(struct musb *musb) return; musb->ackpend = 0; } - - /* send it out, triggering a "txpktrdy cleared" irq */ - musb_ep_select(musb->mregs, 0); - musb_writew(regs, MUSB_CSR0, csr); } /* -- cgit v1.2.1