[U-Boot] [PATCH] usb: musb: only write CLRDATATOG when appropriate

Sergei Shtylyov sshtylyov at mvista.com
Fri Aug 13 12:25:05 CEST 2010


Hello.

Remy Bohmer wrote:

>>> Mike Frysinger wrote:
>>>> --- a/drivers/usb/musb/musb_hcd.c
>>>> +++ b/drivers/usb/musb/musb_hcd.c
>>>>        } else {
>>>> -               if (!toggle)
>>>> -                       writew(MUSB_RXCSR_CLRDATATOG, &musbr->rxcsr);
>>>> -               else {
>>>> +               if (!toggle) {
>>>> +                       csr = readw(&musbr->txcsr);
>>>> +                       if (csr & MUSB_TXCSR_MODE)
>>>> +                               csr = MUSB_RXCSR_CLRDATATOG;

>>>   Clearing RXCSR when FIFO is in TX mode?

    I meant to say "clearing RX toggle".

>> unless i missed something, that is what Linux is doing.

> Can Linux be wrong too?

>> musb_host.c:musb_rx_reinit()
>>        csr = musb_readw(ep->regs, MUSB_RXCSR);
>>        if (csr & MUSB_RXCSR_RXPKTRDY)
>>            WARNING("rx%d, packet/%d ready?\n", ep->epnum,
>>                musb_readw(ep->regs, MUSB_RXCOUNT));
>>
>>        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);

>> although i see that i need to also extend the MUSB_TXCSR_MODE define
>> for Blackfin musb ports in u-boot.  but this shouldnt affect
>> non-Blackfin musb ports.  i'll send a sep patch for that.
>> -mike

> Sergei, do you agree that I apply this patch?

    Well, if it's based on the Linux code... although it still does look 
wrong... I don't know. :-)

> Kind regards,

> Remy

WBR, Sergei


More information about the U-Boot mailing list