1. 28 4月, 2016 1 次提交
  2. 18 4月, 2016 1 次提交
  3. 14 4月, 2016 2 次提交
  4. 04 3月, 2016 1 次提交
  5. 17 2月, 2016 1 次提交
    • J
      usb: dwc3: Fix assignment of EP transfer resources · c4509601
      John Youn 提交于
      The assignement of EP transfer resources was not handled properly in the
      dwc3 driver. Commit aebda618 ("usb: dwc3: Reset the transfer
      resource index on SET_INTERFACE") previously fixed one aspect of this
      where resources may be exhausted with multiple calls to SET_INTERFACE.
      However, it introduced an issue where composite devices with multiple
      interfaces can be assigned the same transfer resources for different
      endpoints. This patch solves both issues.
      
      The assignment of transfer resources cannot perfectly follow the data
      book due to the fact that the controller driver does not have all
      knowledge of the configuration in advance. It is given this information
      piecemeal by the composite gadget framework after every
      SET_CONFIGURATION and SET_INTERFACE. Trying to follow the databook
      programming model in this scenario can cause errors. For two reasons:
      
      1) The databook says to do DEPSTARTCFG for every SET_CONFIGURATION and
      SET_INTERFACE (8.1.5). This is incorrect in the scenario of multiple
      interfaces.
      
      2) The databook does not mention doing more DEPXFERCFG for new endpoint
      on alt setting (8.1.6).
      
      The following simplified method is used instead:
      
      All hardware endpoints can be assigned a transfer resource and this
      setting will stay persistent until either a core reset or hibernation.
      So whenever we do a DEPSTARTCFG(0) we can go ahead and do DEPXFERCFG for
      every hardware endpoint as well. We are guaranteed that there are as
      many transfer resources as endpoints.
      
      This patch triggers off of the calling dwc3_gadget_start_config() for
      EP0-out, which always happens first, and which should only happen in one
      of the above conditions.
      
      Fixes: aebda618 ("usb: dwc3: Reset the transfer resource index on SET_INTERFACE")
      Cc: <stable@vger.kernel.org> # v3.2+
      Reported-by: NRavi Babu <ravibabu@ti.com>
      Signed-off-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@kernel.org>
      c4509601
  6. 15 12月, 2015 2 次提交
  7. 31 7月, 2015 6 次提交
  8. 22 7月, 2015 1 次提交
    • J
      usb: dwc3: Reset the transfer resource index on SET_INTERFACE · aebda618
      John Youn 提交于
      This fixes an issue introduced in commit b23c8439 (usb: dwc3:
      gadget: fix DEPSTARTCFG for non-EP0 EPs) that made sure we would
      only use DEPSTARTCFG once per SetConfig.
      
      The trick is that we should use one DEPSTARTCFG per SetConfig *OR*
      SetInterface. SetInterface was completely missed from the original
      patch.
      
      This problem became aparent after commit 76e838c9 (usb: dwc3:
      gadget: return error if command sent to DEPCMD register fails)
      added checking of the return status of device endpoint commands.
      
      'Set Endpoint Transfer Resource' command was caught failing
      occasionally. This is because the Transfer Resource
      Index was not getting reset during a SET_INTERFACE request.
      
      Finally, to fix the issue, was we have to do is make sure that
      our start_config_issued flag gets reset whenever we receive a
      SetInterface request.
      
      To verify the problem (and its fix), all we have to do is run
      test 9 from testusb with 'testusb -t 9 -s 2048 -a -c 5000'.
      Tested-by: NHuang Rui <ray.huang@amd.com>
      Tested-by: NSubbaraya Sundeep Bhatta <subbaraya.sundeep.bhatta@xilinx.com>
      Fixes: b23c8439 (usb: dwc3: gadget: fix DEPSTARTCFG for non-EP0 EPs)
      Cc: <stable@vger.kernel.org> # v3.2+
      Signed-off-by: NJohn Youn <johnyoun@synopsys.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      aebda618
  9. 30 1月, 2015 1 次提交
  10. 11 11月, 2014 1 次提交
    • F
      usb: dwc3: ep0: fix for dead code · 520fe763
      Felipe Balbi 提交于
      commit 6856d30c (usb: dwc3: ep0: return early
      on NULL requests) tried to fix a minor corner
      case where we could dereference a NULL pointer
      but it also ended up introducing some dead code.
      
      Unfortunately, that dead code, if reached, could
      end up starving the endpoint request list because
      a request would never be given back when it should.
      
      Fix this by moving the check for empty request list
      before its first use.
      Reported-by: NDave Jones <davej@redhat.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      520fe763
  11. 06 11月, 2014 1 次提交
  12. 04 11月, 2014 2 次提交
  13. 23 10月, 2014 1 次提交
    • F
      usb: dwc3: ep0: fix Data Phase for transfer sizes aligned to wMaxPacketSize · 36f84ffb
      Felipe Balbi 提交于
      According to Section 8.5.3.2 of the USB 2.0 specification,
      a USB device must terminate a Data Phase with either a
      short packet or a ZLP (if the previous transfer was
      a multiple of wMaxPacketSize).
      
      For reference, here's what the USB 2.0 specification, section
      8.5.3.2 says:
      
      "
      8.5.3.2 Variable-length Data Stage
      
      A control pipe may have a variable-length data phase
      in which the host requests more data than is contained
      in the specified data structure. When all of the data
      structure is returned to the host, the function should
      indicate that the Data stage is ended by returning a
      packet that is shorter than the MaxPacketSize for the
      pipe. If the data structure is an exact multiple of
      wMaxPacketSize for the pipe, the function will return
      a zero-length packet to indicate the end of the Data
      stage.
      "
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      36f84ffb
  14. 21 10月, 2014 3 次提交
  15. 05 9月, 2014 2 次提交
  16. 26 11月, 2013 1 次提交
  17. 12 10月, 2013 1 次提交
  18. 29 7月, 2013 3 次提交
  19. 18 3月, 2013 2 次提交
  20. 08 3月, 2013 1 次提交
  21. 07 9月, 2012 1 次提交
    • P
      usb: dwc3: ep0: correct cache sync issue in case of ep0_bounced · 0416e494
      Pratyush Anand 提交于
      In case of ep0 out, if length is not aligned to maxpacket size then we use
      dwc->ep_bounce_addr for dma transfer and not request->dma. Since, we have
      alreday done memcpy from dwc->ep0_bounce to request->buf, so we do not need to
      issue cache sync function. In fact, cache sync function will bring wrong data
      in request->buf from request->dma in this scenario.
      
      So, cache sync function must not be executed in case of ep0 bounced.
      
      Cc: <stable@vger.kernel.org> # v3.4 v3.5
      Signed-off-by: NPratyush Anand <pratyush.anand@st.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      0416e494
  22. 03 8月, 2012 5 次提交
    • F
      usb: dwc3: ep0: make sure to reinitilize ep1 on STALL · 2dfe37d4
      Felipe Balbi 提交于
      When issuing SetStall on ep0, we must make sure to
      reinitialize all flags on physical ep1 too.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      2dfe37d4
    • F
      usb: dwc3: ep0: fix status phase delayed status direction · 7125d584
      Felipe Balbi 提交于
      commit 68d3e668 (usb: dwc3: ep0: fix for possible early
      delayed_status) added handling for early delayed status,
      but the current code only works because so far delayed
      status will always be on the IN direction.
      
      This patch makes the code more robust by making sure that
      we can handle all directions properly.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      7125d584
    • F
      usb: dwc3: ep0: drop XferNotReady(DATA) support · 2e3db064
      Felipe Balbi 提交于
      Due to the late Silicon limitation found, we are
      now pre-starting DATA phase's TRBs. If, still, we
      get XferNotReady(DATA) we will ignore it unless
      we're getting it for the wrong direction.
      
      In that case we must keep the error case handling
      plus add a ENDTRANSFER command to forcefully end
      the Data TRB we started previously, then continue
      to SetStall and so on.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      2e3db064
    • F
      usb: dwc3: ep0: move DATA phase away from on-demand · fca8892a
      Felipe Balbi 提交于
      We uncovered a limitation of this core WRT to the
      Link Layer Compliance Suite's TD7.06.
      
      On that test, host will start a GetDescriptor(DEVICE)
      standard request, but it will do so only on the
      SETUP phase, meaning there will *NOT* be any DATA or
      STATUS phases.
      
      The idea of the test is to verify robustness of the
      IP WRT framing errors, so the test will send a
      sequence of different SETUP_DPs each with a different
      framing error and the Suite expects us to be able to
      receive all SETUP_DPs with no timeouts.
      
      This core, has the ability to tell us which phase the
      host is expecting before we start it. Whenever we
      receive a TP or DP when no transfers are cached on
      the internal IP's caches, the IP will generate a
      XferNotReady event with status informing us (in case
      of physical ep0/ep1) if it's related to DATA or STATUS
      phases - SETUP phase is expected to be prestarted.
      
      Because we're always waiting for XferNotReady
      events for DATA and STATUS phases, we will never
      be able to know that the Host wants to start another
      SETUP phase instead, which will render us "not
      compliant" with TD7.06.
      
      In order to "fix" the problem we must not rely
      on XferNotReady events for the DATA phase  and try
      to always pre-start DATA transfers on physical
      endpoints 0 and 1. If host goes back to SETUP phase
      from DATA phase we will receive a XferComplete for
      that phase with TRB's status set to SETUP_PENDING,
      which is only useful for printing a debugging log as
      the core expects us to still go through to the STATUS
      phase, initiate a CONTROL_STATUS TRB just so it
      completes right away and, only then, we go back to
      the pending SETUP phase.
      
      SNPS has decided to modify the programming model of
      the core so that on-demand DATA phases will not be
      supported anymore. Note that this limitation does not
      affect 2-stage transfers, meaning that if TD7.06 would
      start a 2-stage transfer instead of a 3-stage transfer,
      we would receive a "fake" XferNotReady(STATUS) which
      would complete right after being initiated with
      SETUP_PENDING status.
      
      Other endpoints are also not affected, so we can still
      use on-demand transfers on Bulk/Isoc/Interrupt endpoints.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      fca8892a
    • F
      usb: dwc3: ep0: ignore XferNotReady(STATUS) when we're not expecting it · 77fa6df8
      Felipe Balbi 提交于
      Databook doesn't say we should stall if we
      get XferNotReady(STATUS) while we're expecting
      something else.
      
      Instead of stalling and restarting, tests have
      proven that ignoring the event is far more
      effective.
      
      This problem has been caught while rewriting
      ep0 handling in order we pass Link Layer TD7.6.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      77fa6df8