1. 16 Jul, 2014 15 commits
  2. 10 Jul, 2014 17 commits
  3. 30 Jun, 2014 8 commits
    • Vasily Khoruzhick's avatar
      usb: gadget: s3c2410: Move to clk_prepare_enable/clk_disable_unprepare · 527b570c
      Vasily Khoruzhick authored
      Use clk_prepare_enable/clk_disable_unprepare to make the driver
      work properly with common clock framework.
      Signed-off-by: default avatarVasily Khoruzhick <anarsoul@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      527b570c
    • Daniel Mack's avatar
      usb: musb: cppi41: fire hrtimer according to programmed channel length · 50aea6fc
      Daniel Mack authored
      The musb/cppi41 code installs a hrtimer to work around DMA completion
      interrupts that have fired too early on AM335x hardware. This timer
      is currently programmed to first fire 140 microseconds after the DMA
      completion callback. According to the commit which introduced it
      (a655f481, "usb: musb: musb_cppi41: handle pre-mature TX complete
      interrupt"), that value is is considered a 'rule of thumb' that worked
      well with the test case described in the commit log.
      
      Test show, however, that for USB audio devices and much smaller packet
      sizes, the timer has to fire earlier in order to correctly handle the audio
      stream. The original test case had output transfer sizes of 1514 bytes, and
      a delay of 140 microseconds. For audio devices with 24 bytes channel size, 3
      microseconds seem to work well.
      
      Hence, let's assume that the time it takes to clear the bit correlates with
      the number of bytes transferred. The referenced commit log mentions such a
      suspicion as well. Let the timer fire in cppi41_channel->total_len/10
      microseconds to correctly handle both cases.
      
      Also, shorten the interval in which the timer fires again in case of
      a non-empty early_tx list.
      
      With these changes in place, both FS and HS audio devices appear to work
      well on AM335x hardware.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Reported-by: default avatarSebastian Reimers <sebastian.reimers@googlemail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      50aea6fc
    • Daniel Mack's avatar
      Revert "usb: musb: musb_cppi41: Handle ISOCH differently and not use the hrtimer." · eefae89e
      Daniel Mack authored
      This reverts commit 1af54b7a.
      
      The commit tried to address cases in which isochronous transfers are 'not
      reliable', most probably in the tests conducted, polling for the
      MUSB_TXCSR_TXPKTRDY bit in MUSB_TXCSR is done too late.
      
      Hence, it installs a work struct which basically busy-polls for the bit in a
      rather agressive way by rescheduling the work if the FIFO is not empty. With
      USB audio devices, tests have shown that it takes approximately 100
      iterations of the asynchronous worker until the FIFO signals completion,
      which leads to 100% CPU loads when streaming audio.
      
      The issue the patch tried to address can be handled differently, which is
      what the next patch does.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Reported-by: default avatarSebastian Reimers <sebastian.reimers@googlemail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      eefae89e
    • Daniel Mack's avatar
      usb: musb: fix wrong indentation in musb_host.c · 49a9e885
      Daniel Mack authored
      Just a cosmetic cleanup with no functional change.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      49a9e885
    • Daniel Mack's avatar
      usb: musb/cppi41: call musb_ep_select() before accessing an endpoint's CSR · f50e6785
      Daniel Mack authored
      Before accessing any of an endpoint's CSR registers, make sure the
      correct endpoint is selected. Otherwise, data read from or written to
      the registers is likely to affect the wrong endpoint as long as the
      connected device has more than one endpoint.
      
      This, of course, leads to all sorts of strange effects such as stream
      starvation and driver internal state machine confusion due to spurious
      interrupts.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      f50e6785
    • Daniel Mack's avatar
      usb: musb: introduce dma_channel.rx_packet_done · ff3fcac9
      Daniel Mack authored
      The musb/cppi41 glue layer is capable of handling transactions that span
      over more than one USB packet by reloading the DMA descriptors
      partially. An urb is considered completed when either its transfer
      buffer has been filled entirely (actual_length ==
      transfer_buffer_length) or if a packet in the stream has less bytes than
      the endpoint's wMaxPacketSize.
      
      Once one of the above conditions is met, musb_dma_completion() is called
      from cppi41_trans_done(). However, the final decision whether or not to
      return the urb to its owner is made by the core and its determination of
      the variable 'done' in musb_host_rx(). This code has currently no way of
      knowing what the size of the last packet was, and whether or not to
      give back the urb due to a short read.
      
      Fix this by introducing a new boolean flag in 'struct dma_channel', and
      set it from musb_cppi41.c. If set, it will make the core do what the
      DMA layer decided and complete the urb.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Acked-by: default avatarGeorge Cherian <george.cherian@ti.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      ff3fcac9
    • Daniel Mack's avatar
      usb: musb: fix bit mask for CSR in musb_h_tx_flush_fifo() · 2ccc6d30
      Daniel Mack authored
      The datasheet says that MUSB_TXCSR_FLUSHFIFO is only valid when
      MUSB_TXCSR_TXPKTRDY is set as well.
      
      With this patch applied, the warning in this function does no longer
      kick in when an USB soundcard is unplugged while the stream is active.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      2ccc6d30
    • Daniel Mack's avatar
      usb: musb: use is_host_active() to distinguish between host and gadget mode · c03da38d
      Daniel Mack authored
      On AM33xx platforms, unplugging a device in the middle of an active
      transfer leads to a drop of MUSB_DEVCTL_HM in MUSB_DEVCTL before the
      system is informed about a disconnect. This consequently makes the musb
      core call the gadget code to handle the interrupt request, which then
      crashes the kernel because the relevant pointers haven't been set up
      for gadget mode.
      
      To fix this, use is_host_active() rather than (devctl & MUSB_DEVCTL_HM)
      in musb_interrupt() and musb_dma_completion() to detect whether the
      controller is in host or peripheral mode. This information is provided
      by the driver logic and does not rely on register contents.
      Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      c03da38d