On 11/05/2015 11:34 PM, Bin Liu wrote:
Here are a few changes in musb_h_tx_flush_fifo().
- Refering to 2ccc6d30a (usb: musb: fix bit mask for CSR in
musb_h_tx_flush_fifo()), the datasheet says that
MUSB_TXCSR_FLUSHFIFO
is only valid when MUSB_TXCSR_TXPKTRDY is set as well. It means
MUSB_TXCSR_TXPKTRDY should be checked, not set.
Hum, my copy of the MUSBHDRC programmer's guide says about
TXCSR.FlushFIFO in host mode:
<<
The CPU writes a 1 to this bit to flush the latest packet from the
endpoint Tx FIFO. The FIFO pointer is reset, the TxPktRdy bit (below) is
cleared and an interrupt is generated. May be set simultaneously with
TxPktRdy to abort the packet that is currently being loaded into the
FIFO. Note: FlushFIFO should only be used when TxPktRdy is set. At other
times, it may cause data to be corrupted. Also note that, if the FIFO is
double-buffered, FlushFIFO may need to be set twice to completely clear
the FIFO.
>>
So how to interpret this message? FLUSHFIFO and TXPKTRDY should be set
at the
same time? If so, I will drop this change in V3.
Yes, I think it's rather clear in this respect.
In either case, musb is unable to flush the tx fifo in urb dequque for
device
disconnect, but harmless, so the next two changes are important to
give better
user experience.
Hm, looks like some errata... and hiding this from users while
there's no workaround doesn't seem a good policy.
Well, based on the programmer's guide, the driver should set the flushFIFO
bit, and wait for the interrupt.
That's oversimplified, consider the double-buffered FIFO. ;-)
However, the driver does 1000-times retry loop to probe the FIFONOTEMPTY bit.
This is there in the very first version of the driver back in 2008. So I would
think musb just behaves like that, rather than an errata. Also the WARN() was
not there in the early version of the driver.
Yes, but added shortly after, in 2008.
Please guide what we will do with this patch? Should I send V3 with the first
change removed, or just drop this patch completely?
I'll let Felipe decide, it's his domain.
Thanks,
-Bin.
[...]
MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html