Skip to content

Commit

Permalink
MUSB: Fix index register corruption seen with g_ether and Windows host
Browse files Browse the repository at this point in the history
If Indexed Mode register accesses are enabled, the ep0_rxstate()
function calls musb_g_ep0_giveback() before writing to the CSR
register. When control returns to this ep0_rxstate, the index
register contents are over-written. This causes the CSR register
write to fail.

Fixed by writing the correct value into the index register before
writing to the CSR.

This was observed only in ep0_rxstate() with g_ether loaded and
the device connected to a MS Windows host PC. Anticipatively fixed
ep0_txstate() as well.

Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Anand Gadiyar authored and Greg Kroah-Hartman committed Aug 21, 2008
1 parent e8164f6 commit fb85d99
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/musb/musb_gadget_ep0.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ static void ep0_rxstate(struct musb *musb)
return;
musb->ackpend = 0;
}
musb_ep_select(musb->mregs, 0);
musb_writew(regs, MUSB_CSR0, tmp);
}

Expand Down Expand Up @@ -528,6 +529,7 @@ static void ep0_txstate(struct musb *musb)
}

/* send it out, triggering a "txpktrdy cleared" irq */
musb_ep_select(musb->mregs, 0);
musb_writew(regs, MUSB_CSR0, csr);
}

Expand Down

0 comments on commit fb85d99

Please sign in to comment.