浏览代码

USB: musb: fix for crash in DM646x USB when (CPPI)DMA is enabled

Race condition exists between the cppi_interrupt handler and
davinci_interrupt handler w.r.t completing a TX IO.  Since DM646x
has seperate DMA and USB endpoint interrupts cppi_interrupt handler
needs to hold the lock while operating on the endpoint.

Update over previous patch to avoid taking the lock if already
taken.  Tested on DM644x, DM355 and DM646x platforms.

Signed-off-by: Swaminathan S <swami.iyer@ti.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Acked-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Swaminathan S 15 年之前
父节点
当前提交
93aa3dab00
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      drivers/usb/musb/cppi_dma.c

+ 6 - 0
drivers/usb/musb/cppi_dma.c

@@ -1154,8 +1154,11 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id)
 	struct musb_hw_ep	*hw_ep = NULL;
 	struct musb_hw_ep	*hw_ep = NULL;
 	u32			rx, tx;
 	u32			rx, tx;
 	int			i, index;
 	int			i, index;
+	unsigned long		flags;
 
 
 	cppi = container_of(musb->dma_controller, struct cppi, controller);
 	cppi = container_of(musb->dma_controller, struct cppi, controller);
+	if (cppi->irq)
+		spin_lock_irqsave(&musb->lock, flags);
 
 
 	tibase = musb->ctrl_base;
 	tibase = musb->ctrl_base;
 
 
@@ -1285,6 +1288,9 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id)
 	/* write to CPPI EOI register to re-enable interrupts */
 	/* write to CPPI EOI register to re-enable interrupts */
 	musb_writel(tibase, DAVINCI_CPPI_EOI_REG, 0);
 	musb_writel(tibase, DAVINCI_CPPI_EOI_REG, 0);
 
 
+	if (cppi->irq)
+		spin_unlock_irqrestore(&musb->lock, flags);
+
 	return IRQ_HANDLED;
 	return IRQ_HANDLED;
 }
 }