Skip to content
  • Bin Liu's avatar
    usb: musb: fix tx fifo flush handling · 68fe05e2
    Bin Liu authored
    
    
    Here are a few changes in musb_h_tx_flush_fifo().
    
    - It has been observed that sometimes (if not always) musb is unable
      to flush tx fifo during urb dequeue when disconnect a device. But
      it seems to be harmless, since the tx fifo flush is done again in
      musb_ep_program() when re-use the hw_ep.
    
      But the WARN() floods the console in the case when multiple tx urbs
      are queued, so change it to dev_WARN_ONCE().
    
    - applications could queue up many tx urbs, then the 1ms delay could
      causes minutes of delay in device disconnect. So remove it to get
      better user experience. The 1ms delay does not help the flushing
      anyway.
    
    - cleanup the debug code - related to lastcsr.
    
    ----
    Note: The tx fifo flush issue has been observed during device disconnect
    on AM335x.
    
    To reproduce the issue, ensure tx urb(s) are queued when unplug the usb
    device which is connected to AM335x usb host port.
    
    I found using a usb-ethernet device and running iperf (client on AM335x)
    has very high chance to trigger the problem.
    
    Better to turn on dev_dbg() in musb_cleanup_urb() with CPPI enabled to
    see the issue when aborting the tx channel.
    
    Signed-off-by: default avatarBin Liu <b-liu@ti.com>
    Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
    68fe05e2