aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBin Liu <b-liu@ti.com>2017-01-03 19:13:46 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-05 13:18:05 -0500
commit6def85a396ce7796bd9f4561c6ae8138833f7a52 (patch)
tree18423397671999746ea8e1cd4d28e8cd99e6da94
parentc8d204b38a558d74fafb6915e2593602b7f4b823 (diff)
usb: musb: core: add clear_ep_rxintr() to musb_platform_ops
During dma teardown for dequque urb, if musb load is high, musb might generate bogus rx ep interrupt even when the rx fifo is flushed. In such case any of the follow log messages could happen. musb_host_rx 1853: BOGUS RX2 ready, csr 0000, count 0 musb_host_rx 1936: RX3 dma busy, csr 2020 As mentioned in the current inline comment, clearing ep interrupt in the teardown path avoids the bogus interrupt. Clearing ep interrupt is platform dependent, so this patch adds a platform callback to allow glue driver to clear the ep interrupt. This bug seems to be existing since the initial driver for musb support, but I only validated the fix back to v4.1, so only cc stable for v4.1+. cc: stable@vger.kernel.org # 4.1+ Signed-off-by: Bin Liu <b-liu@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/musb/musb_core.h7
-rw-r--r--drivers/usb/musb/musb_host.c10
2 files changed, 11 insertions, 6 deletions
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index a611e2f67bdc..ade902ea1221 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -216,6 +216,7 @@ struct musb_platform_ops {
216 void (*pre_root_reset_end)(struct musb *musb); 216 void (*pre_root_reset_end)(struct musb *musb);
217 void (*post_root_reset_end)(struct musb *musb); 217 void (*post_root_reset_end)(struct musb *musb);
218 int (*phy_callback)(enum musb_vbus_id_status status); 218 int (*phy_callback)(enum musb_vbus_id_status status);
219 void (*clear_ep_rxintr)(struct musb *musb, int epnum);
219}; 220};
220 221
221/* 222/*
@@ -626,6 +627,12 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb)
626 musb->ops->post_root_reset_end(musb); 627 musb->ops->post_root_reset_end(musb);
627} 628}
628 629
630static inline void musb_platform_clear_ep_rxintr(struct musb *musb, int epnum)
631{
632 if (musb->ops->clear_ep_rxintr)
633 musb->ops->clear_ep_rxintr(musb, epnum);
634}
635
629/* 636/*
630 * gets the "dr_mode" property from DT and converts it into musb_mode 637 * gets the "dr_mode" property from DT and converts it into musb_mode
631 * if the property is not found or not recognized returns MUSB_OTG 638 * if the property is not found or not recognized returns MUSB_OTG
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index f6cdbad00dac..ac3a4952abb4 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -2374,12 +2374,11 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
2374 int is_in = usb_pipein(urb->pipe); 2374 int is_in = usb_pipein(urb->pipe);
2375 int status = 0; 2375 int status = 0;
2376 u16 csr; 2376 u16 csr;
2377 struct dma_channel *dma = NULL;
2377 2378
2378 musb_ep_select(regs, hw_end); 2379 musb_ep_select(regs, hw_end);
2379 2380
2380 if (is_dma_capable()) { 2381 if (is_dma_capable()) {
2381 struct dma_channel *dma;
2382
2383 dma = is_in ? ep->rx_channel : ep->tx_channel; 2382 dma = is_in ? ep->rx_channel : ep->tx_channel;
2384 if (dma) { 2383 if (dma) {
2385 status = ep->musb->dma_controller->channel_abort(dma); 2384 status = ep->musb->dma_controller->channel_abort(dma);
@@ -2395,10 +2394,9 @@ static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh)
2395 /* giveback saves bulk toggle */ 2394 /* giveback saves bulk toggle */
2396 csr = musb_h_flush_rxfifo(ep, 0); 2395 csr = musb_h_flush_rxfifo(ep, 0);
2397 2396
2398 /* REVISIT we still get an irq; should likely clear the 2397 /* clear the endpoint's irq status here to avoid bogus irqs */
2399 * endpoint's irq status here to avoid bogus irqs. 2398 if (is_dma_capable() && dma)
2400 * clearing that status is platform-specific... 2399 musb_platform_clear_ep_rxintr(musb, ep->epnum);
2401 */
2402 } else if (ep->epnum) { 2400 } else if (ep->epnum) {
2403 musb_h_tx_flush_fifo(ep); 2401 musb_h_tx_flush_fifo(ep);
2404 csr = musb_readw(epio, MUSB_TXCSR); 2402 csr = musb_readw(epio, MUSB_TXCSR);