From: Bryan Wu <cooloney@xxxxxxxxxx> still need verify before sending out Signed-off-by: Bryan Wu <cooloney@xxxxxxxxxx> Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx> --- drivers/usb/musb/musb_host.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 159aae6..39d7a53 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -589,7 +589,11 @@ musb_rx_reinit(struct musb *musb, struct musb_qh *qh, struct musb_hw_ep *ep) WARNING("rx%d, packet/%d ready?\n", ep->epnum, musb_readw(ep->regs, MUSB_RXCOUNT)); - musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); + csr = musb_readw(ep->regs, MUSB_TXCSR); + if (csr & MUSB_TXCSR_MODE) + musb_h_flush_rxfifo(ep, MUSB_RXCSR_CLRDATATOG); + else + musb_h_flush_rxfifo(ep, 0); } /* target addr and (for multipoint) hub addr/port */ @@ -733,7 +737,8 @@ static void musb_ep_program(struct musb *musb, u8 epnum, /* general endpoint setup */ if (epnum) { /* flush all old state, set default */ - musb_h_tx_flush_fifo(hw_ep); + if (csr & MUSB_TXCSR_MODE) + musb_h_tx_flush_fifo(hw_ep); /* * We must not clear the DMAMODE bit before or in @@ -754,7 +759,8 @@ static void musb_ep_program(struct musb *musb, u8 epnum, csr |= MUSB_TXCSR_H_WR_DATATOGGLE | MUSB_TXCSR_H_DATATOGGLE; else - csr |= MUSB_TXCSR_CLRDATATOG; + if (csr & MUSB_TXCSR_MODE) + csr |= MUSB_TXCSR_CLRDATATOG; musb_writew(epio, MUSB_TXCSR, csr); /* REVISIT may need to clear FLUSHFIFO ... */ -- 1.6.5.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html