1. 21 5月, 2018 2 次提交
  2. 15 5月, 2018 3 次提交
    • A
      usb: dwc2: Change reading of current frame number flow. · c7c24e7a
      Artur Petrosyan 提交于
      The current frame_number is read from core for both
      device and host modes. Reading of the current frame
      number needs to be performed ASAP due to IRQ latency's.
      This is why, it is moved to common interrupt handler.
      
      Accordingly updated dwc2_gadget_target_frame_elapsed()
      function which uses stored frame_number instead of
      reading frame number.
      
      In cases when target frame value is incremented
      the frame_number is required to read again.
      Signed-off-by: NArtur Petrosyan <arturp@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      c7c24e7a
    • G
      usb: dwc2: Add Interpacket Gap(IPG) feature support · b43ebc96
      Grigor Tovmasyan 提交于
      Added GHWCFG4_IPG_ISOC_SUPPORTED and DCFG_IPG_ISOC_SUPPORDED
      bits definitions to enable/disable IPG feature.
      
      Added ipg_isoc_en core parameter which will indicate IPG support
      enable/disable and initialize it.
      Signed-off-by: NGrigor Tovmasyan <tovmasya@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      b43ebc96
    • M
      usb: dwc2: Change ISOC DDMA flow · 729cac69
      Minas Harutyunyan 提交于
      Changed existing two descriptor-chain flow to one chain.
      
      In two-chain implementation BNA interrupt used for switching between
      two chains. BNA interrupt asserted because of returning to
      beginning of the chain based on L-bit of last descriptor.
      
      Because of that we lose packets. This issue resolved by using one
      desc-chain.
      
      Removed all staff related to two desc-chain flow from
      DDMA ISOC related functions.
      
      Removed request length checking from dwc2_gadget_fill_isoc_desc()
      function. Request length checking added to dwc2_hsotg_ep_queue()
      function. If request length greater than descriptor limits then
      request not added to queue. Additional checking done for High
      Bandwidth ISOC OUT's which not supported by driver. In
      dwc2_gadget_fill_isoc_desc() function also checked desc-chain
      status (full or not) to avoid of reusing not yet processed
      descriptors.
      
      In dwc2_gadget_start_isoc_ddma() function creation of desc-chain
      always started from descriptor 0. Before filling descriptors, they
      were initialized by HOST BUSY status.
      
      In dwc2_gadget_complete_isoc_request_ddma() added checking for
      desc-chain rollover. Also added checking completion status.
      Request completed successfully if DEV_DMA_STS is DEV_DMA_STS_SUCC,
      otherwise complete with actual=0. For systems with high IRQ latency
      added pointer compl_desc to next descriptor to be completed by
      XferCompl interrupt. This pointer replace descriptor index calculation
      based on DxEPDMA register. On descriptor completion interrupt
      processing all descriptors starting from compl_desc till descriptor
      which Buffer Status field not equal DMA_DONE status.
      
      Actually removed dwc2_gadget_start_next_isoc_ddma() function because
      now driver use only one desc-chain and instead that function added
      dwc2_gadget_handle_isoc_bna() function for handling BNA interrupts.
      
      Handling BNA interrupt done by flushing TxFIFOs for OUT EPs,
      completing request with actual=0 and resetting desc-chain number and
      target frame to initial values for restarting transfers.
      
      On handling NAK request completed with actual=0. Incremented target
      frame to allow fill desc chain and start transfers.
      In DDMA mode avoided of frame number incrementing, because tracking
      of frame number performed in dwc2_gadget_fill_isoc_desc() function.
      
      When core assert XferCompl along with BNA, we should ignore XferCompl
      in dwc2_hsotg_epint() function.
      
      On BNA interrupt replaced dwc2_gadget_start_next_isoc_ddma() by above
      mentioned BNA handler.
      
      In dwc2_hsotg_ep_enable() function added sanity check of bInterval
      for ISOC IN in DDMA mode, because HW doesn't supported EP's with
      bInterval more than 10 and check for mc for ISOC OUT transfers,
      because core doesn't support high bandwidth transfers.
      Signed-off-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      729cac69
  3. 25 4月, 2018 1 次提交
  4. 13 3月, 2018 22 次提交
  5. 08 3月, 2018 1 次提交
  6. 13 12月, 2017 1 次提交
    • D
      usb: dwc2: host: Don't retry NAKed transactions right away · 38d2b5fb
      Douglas Anderson 提交于
      On rk3288-veyron devices on Chrome OS it was found that plugging in an
      Arduino-based USB device could cause the system to lockup, especially
      if the CPU Frequency was at one of the slower operating points (like
      100 MHz / 200 MHz).
      
      Upon tracing, I found that the following was happening:
      * The USB device (full speed) was connected to a high speed hub and
        then to the rk3288.  Thus, we were dealing with split transactions,
        which is all handled in software on dwc2.
      * Userspace was initiating a BULK IN transfer
      * When we sent the SSPLIT (to start the split transaction), we got an
        ACK.  Good.  Then we issued the CSPLIT.
      * When we sent the CSPLIT, we got back a NAK.  We immediately (from
        the interrupt handler) started to retry and sent another SSPLIT.
      * The device kept NAKing our CSPLIT, so we kept ping-ponging between
        sending a SSPLIT and a CSPLIT, each time sending from the interrupt
        handler.
      * The handling of the interrupts was (because of the low CPU speed and
        the inefficiency of the dwc2 interrupt handler) was actually taking
        _longer_ than it took the other side to send the ACK/NAK.  Thus we
        were _always_ in the USB interrupt routine.
      * The fact that USB interrupts were always going off was preventing
        other things from happening in the system.  This included preventing
        the system from being able to transition to a higher CPU frequency.
      
      As I understand it, there is no requirement to retry super quickly
      after a NAK, we just have to retry sometime in the future.  Thus one
      solution to the above is to just add a delay between getting a NAK and
      retrying the transmission.  If this delay is sufficiently long to get
      out of the interrupt routine then the rest of the system will be able
      to make forward progress.  Even a 25 us delay would probably be
      enough, but we'll be extra conservative and try to delay 1 ms (the
      exact amount depends on HZ and the accuracy of the jiffy and how close
      the current jiffy is to ticking, but could be as much as 20 ms or as
      little as 1 ms).
      
      Presumably adding a delay like this could impact the USB throughput,
      so we only add the delay with repeated NAKs.
      
      NOTE: Upon further testing of a pl2303 serial adapter, I found that
      this fix may help with problems there.  Specifically I found that the
      pl2303 serial adapters tend to respond with a NAK when they have
      nothing to say and thus we end with this same sequence.
      Signed-off-by: NDouglas Anderson <dianders@chromium.org>
      Reviewed-by: NJulius Werner <jwerner@chromium.org>
      Tested-by: NStefan Wahren <stefan.wahren@i2se.com>
      Acked-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      38d2b5fb
  7. 12 12月, 2017 1 次提交
  8. 11 12月, 2017 1 次提交
    • M
      usb: dwc2: Fix TxFIFOn sizes and total TxFIFO size issues · 9273083a
      Minas Harutyunyan 提交于
      In host mode reading from DPTXSIZn returning invalid value in
      dwc2_check_param_tx_fifo_sizes function.
      
      In total TxFIFO size calculations unnecessarily reducing by ep_info.
      hw->total_fifo_size can be fully allocated for FIFO's.
      
      Added num_dev_in_eps member in dwc2_hw_params structure to save number
      of IN EPs.
      
      Added g_tx_fifo_size array in dwc2_hw_params structure to store power
      on reset values of DPTXSIZn registers in forced device mode.
      
      Updated dwc2_hsotg_tx_fifo_count() function to get TxFIFO count from
      num_dev_in_eps.
      
      Updated dwc2_get_dev_hwparams() function to store DPTXFSIZn in
      g_tx_fifo_size array.
      
      dwc2_get_host/dev_hwparams() functions call moved after num_dev_in_eps
      set from hwcfg4.
      
      Modified dwc2_check_param_tx_fifo_sizes() function to check TxFIFOn
      sizes based on g_tx_fifo_size array.
      
      Removed ep_info subtraction during calculation of tx_addr_max in
      dwc2_hsotg_tx_fifo_total_depth() function. Also removed
      dwc2_hsotg_ep_info_size() function as no more need.
      Acked-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NGevorg Sahakyan <sahakyan@synopsys.com>
      Signed-off-by: NMinas Harutyunyan <hminas@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      9273083a
  9. 04 11月, 2017 1 次提交
  10. 19 10月, 2017 1 次提交
  11. 11 4月, 2017 1 次提交
  12. 26 1月, 2017 1 次提交
  13. 24 1月, 2017 4 次提交
    • S
      usb: dwc2: gadget: Set TX FIFO depths to calculated defaults · c138ecfa
      Sevak Arakelyan 提交于
      Remove legacy DWC2_G_P_LEGACY_TX_FIFO_SIZE array for TX FIFOs.
      Update dwc2_set_param_tx_fifo_sizes function to calculate
      and assign default average FIFO depth to each member of
      g_tx_fifo_size array. Total FIFO size, EP Info block's size,
      FIFO operation mode and device operation mode are taken into
      consideration during the calculation.
      
      Cc: Stefan Wahren <stefan.wahren@i2se.com>
      Signed-off-by: NSevak Arakelyan <sevaka@synopsys.com>
      Signed-off-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      c138ecfa
    • S
      usb: dwc2: host: Correct snpsid checking for GDFIFOCFG · e1f411d1
      Sevak Arakelyan 提交于
      GDFIFOCFG is available from IP version 2.91a. Fix the code to reflect
      this.
      Signed-off-by: NSevak Arakelyan <sevaka@synopsys.com>
      Signed-off-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      e1f411d1
    • C
      usb: dwc2: Add a quirk to allow speed negotiation for Hisilicon Hi6220 · ca8b0332
      Chen Yu 提交于
      The Hi6220's usb controller is limited in that it does not
      support "Split Transactions", so it does not support communicating
      with low-speed and full-speed devices behind a high-speed hub.
      
      Thus it requires a quirk so that we can manually drop the usb
      speed when low/full-speed are attached, and bump back to high
      speed when they are removed.
      
      Cc: Wei Xu <xuwei5@hisilicon.com>
      Cc: Guodong Xu <guodong.xu@linaro.org>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: John Youn <johnyoun@synopsys.com>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Chen Yu <chenyu56@huawei.com>
      Cc: Vardan Mikayelyan <mvardan@synopsys.com>
      Cc: Kishon Vijay Abraham I <kishon@ti.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-usb@vger.kernel.org
      Signed-off-by: NChen Yu <chenyu56@huawei.com>
      [jstultz: Reworked to simplify the patch, and made
       commit log to be more specific about the issue]
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      ca8b0332
    • J
      usb: dwc2: Avoid sleeping while holding hsotg->lock · 6e6360b6
      John Stultz 提交于
      Basically when plugging in various cables in different orders, I'm
      occasionally seeing the following BUG splat:
      
      [   86.215403] BUG: scheduling while atomic: kworker/u16:2/53/0x00000002
      [   86.219164] usb 1-1: USB disconnect, device number 9
      [   86.226845] Preemption disabled at:[   86.230218]
      [<ffffff8008673558>] dwc2_conn_id_status_change+0x120/0x250
      [   86.236894] CPU: 0 PID: 53 Comm: kworker/u16:2 Tainted: G        W
           4.9.0-rc8-00051-gd5a7979-dirty #1702
      [   86.246836] Hardware name: HiKey Development Board (DT)
      [   86.252100] Workqueue: dwc2 dwc2_conn_id_status_change
      [   86.257279] Call trace:
      [   86.259771] [<ffffff8008087c28>] dump_backtrace+0x0/0x1a0
      [   86.265210] [<ffffff8008087ddc>] show_stack+0x14/0x20
      [   86.270308] [<ffffff80084343f0>] dump_stack+0x90/0xb0
      [   86.275401] [<ffffff80080d8d94>] __schedule_bug+0x6c/0xb8
      [   86.280841] [<ffffff8008a07220>] __schedule+0x4f8/0x5b0
      [   86.286099] [<ffffff8008a073e8>] schedule+0x38/0xa0
      [   86.291017] [<ffffff8008a0a6cc>] schedule_hrtimeout_range_clock+0x8c/0xf0
      [   86.297846] [<ffffff8008a0a740>] schedule_hrtimeout_range+0x10/0x18
      [   86.304150] [<ffffff8008a0a4a0>] usleep_range+0x50/0x58
      [   86.309418] [<ffffff800866d8dc>] dwc2_wait_for_mode.isra.4+0x54/0xd0
      [   86.315815] [<ffffff800866f058>] dwc2_core_reset+0xe0/0x168
      [   86.321431] [<ffffff800867e364>] dwc2_hsotg_core_init_disconnected+0x2c/0x310
      [   86.328602] [<ffffff8008673568>] dwc2_conn_id_status_change+0x130/0x250
      [   86.335254] [<ffffff80080ccd48>] process_one_work+0x118/0x370
      [   86.341035] [<ffffff80080ccfe8>] worker_thread+0x48/0x498
      [   86.346473] [<ffffff80080d2eb0>] kthread+0xd0/0xe8
      [   86.351299] [<ffffff8008082e80>] ret_from_fork+0x10/0x50
      
      This seems to be caused by the dwc2_wait_for_mode() calling
      usleep_range() while the hstog->lock spinlock is held, since
      we take that before calling dwc2_hsotg_core_init_disconnected().
      
      This patch avoids the issue by adding an extra argument to
      dwc2_core_reset(), as suggested by John Youn, which allows us to
      skip the waiting, which should be unnecessary when calling from
      dwc2_hsotg_core_init_disconnected().
      
      Cc: Wei Xu <xuwei5@hisilicon.com>
      Cc: Guodong Xu <guodong.xu@linaro.org>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: John Youn <johnyoun@synopsys.com>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Chen Yu <chenyu56@huawei.com>
      Cc: Vardan Mikayelyan <mvardan@synopsys.com>
      Cc: Kishon Vijay Abraham I <kishon@ti.com>
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-usb@vger.kernel.org
      Signed-off-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      6e6360b6