Commit 37151b14 authored by Tony Lindgren's avatar Tony Lindgren

MUSB: Additional checks for TUSB DMA

Additional checks for TUSB DMA. Fixes MSC ErrorRecoveryTest.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
parent 34b6750a
......@@ -99,6 +99,7 @@ static int tusb_omap_dma_stop(struct dma_controller *c)
static inline int tusb_omap_use_shared_dmareq(struct tusb_omap_dma_ch *chdat)
{
u32 reg = musb_readl(chdat->tusb_base, TUSB_DMA_EP_MAP);
if (reg != 0) {
DBG(3, "ep%i dmareq0 is busy for ep%i\n",
chdat->epnum, reg & 0xf);
......@@ -232,6 +233,9 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
else
transfer_len = len;
if (len < packet_sz)
packet_sz = transfer_len;
if (dmareq_works()) {
ch = chdat->ch;
dmareq = chdat->dmareq;
......@@ -241,6 +245,14 @@ static int tusb_omap_dma_program(struct dma_channel *channel, u16 packet_sz,
DBG(3, "could not get dma for ep%i\n", chdat->epnum);
return FALSE;
}
if (tusb_dma->ch < 0) {
/* REVISIT: This should get blocked earlier, happens
* with MSC ErrorRecoveryTest
*/
WARN_ON(1);
return FALSE;
}
ch = tusb_dma->ch;
dmareq = tusb_dma->dmareq;
sync_dev = tusb_dma->sync_dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment