1. 31 5月, 2016 1 次提交
    • W
      usb: gadget: composite: don't queue OS desc req if length is invalid · 7e14f47a
      William Wu 提交于
      In OS descriptors handling, if ctrl->bRequestType is
      USB_RECIP_DEVICE and w_index != 0x4 or (w_value >> 8)
      is true, it will not assign a valid value to req->length,
      but use the default value(-EOPNOTSUPP), and queue an
      OS desc request with the invalid req->length. It always
      happens on the platforms which use os_desc (for example:
      rk3366, rk3399), and cause kernel panic as follows
      (use dwc3 driver):
      
      Unable to handle kernel paging request at virtual address ffffffc0f7e00000
      Internal error: Oops: 96000146 [#1] PREEMPT SMP
      PC is at __dma_clean_range+0x18/0x30
      LR is at __swiotlb_map_page+0x50/0x64
      Call trace:
      [<ffffffc0000930f8>] __dma_clean_range+0x18/0x30
      [<ffffffc00062214c>] usb_gadget_map_request+0x134/0x1b0
      [<ffffffc0005c289c>] __dwc3_ep0_do_control_data+0x110/0x14c
      [<ffffffc0005c2d38>] __dwc3_gadget_ep0_queue+0x198/0x1b8
      [<ffffffc0005c2e18>] dwc3_gadget_ep0_queue+0xc0/0xe8
      [<ffffffc00061cfec>] composite_ep0_queue.constprop.14+0x34/0x98
      [<ffffffc00061dfb0>] composite_setup+0xf60/0x100c
      [<ffffffc0006204dc>] android_setup+0xd8/0x138
      [<ffffffc0005c29a4>] dwc3_ep0_delegate_req+0x34/0x50
      [<ffffffc0005c3534>] dwc3_ep0_interrupt+0x5dc/0xb58
      [<ffffffc0005c0c3c>] dwc3_thread_interrupt+0x15c/0xa24
      
      With this patch, the gadget driver will not queue
      a request and return immediately if req->length is
      invalid. And the usb controller driver can handle
      the unsupport request correctly.
      Signed-off-by: NWilliam Wu <william.wu@rock-chips.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      7e14f47a
  2. 28 4月, 2016 1 次提交
  3. 18 4月, 2016 1 次提交
  4. 29 3月, 2016 1 次提交
  5. 04 3月, 2016 9 次提交
  6. 10 10月, 2015 1 次提交
    • I
      usb: gadget: composite: fill bcdUSB for any gadget max speed · 5527e733
      Igor Kotrasinski 提交于
      When handling device GET_DESCRIPTOR, composite gadget driver fills
      the bcdUSB field only if the gadget supports USB 3.0. Otherwise
      the field is left unfilled.
      
      For consistency, set bcdUSB to 0x0200 for gadgets that don't
      support superspeed.
      
      It's correct to use 0x0200 for any setting that doesn't use
      superspeed, since USB 2.0 devices can restrict themselves to
      full speed only. It is NOT correct to use 0x0210, since BOS
      descriptors are handled only if gadget_is_superspeed() is
      satisfied, otherwise it results in a stall.
      Signed-off-by: NIgor Kotrasinski <i.kotrasinsk@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      5527e733
  7. 27 9月, 2015 1 次提交
  8. 07 8月, 2015 1 次提交
  9. 29 7月, 2015 4 次提交
  10. 07 7月, 2015 1 次提交
  11. 11 3月, 2015 3 次提交
  12. 27 1月, 2015 1 次提交
  13. 04 11月, 2014 3 次提交
    • A
      usb: gadget: configfs: add suspend/resume · 3a571870
      Andrzej Pietrasiewicz 提交于
      USB gadgets composed with configfs lack suspend and resume
      methods. This patch uses composite_suspend()/composite_resume()
      the same way e.g. composite_setup() or composite_disconnect()
      are used in a configfs-based gadget.
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      3a571870
    • F
      usb: gadget: composite: conditionally dequeue os_desc and setup requests · a7c12eaf
      Felipe Balbi 提交于
      In case we unload a gadget driver while any of
      os_desc_req or req are still pending, we need
      to make sure to dequeue them.
      
      By using our setup_pending and os_desc_pending
      flags we achieve that in a way that doesn't
      cause any regressions because we won't dequeue
      a request which was already completed.
      
      The original idea came from Li Jun's commit
      f2267089
      (usb: gadget: composite: dequeue cdev->req
      before free it in composite_dev_cleanup) which,
      unfortunately, caused two regressions (kfree()
      being called before usb_ep_dequeue() and calling
      usb_ep_dequeue() when the request was already
      completed). That commit also didn't take care
      of os_desc_req which can fall into the same
      situation so we must care for that one too.
      
      Note that in order to make code slightly easier
      to read, we introduce composite_ep_queue() which
      hides details about how to fiddle with our pending
      flags.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      a7c12eaf
    • F
      usb: gadget: composite: set our req->context to cdev · 57943716
      Felipe Balbi 提交于
      by doing that we will be able to match our
      requests against req and os_desc_req and also
      clear our pending flags from complete callback.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      57943716
  14. 23 10月, 2014 1 次提交
  15. 23 9月, 2014 1 次提交
  16. 18 9月, 2014 1 次提交
  17. 09 9月, 2014 1 次提交
  18. 02 9月, 2014 1 次提交
    • L
      usb: gadget: composite: dequeue cdev->req before free its buffer · be0a8887
      Li Jun 提交于
      commit f2267089(usb: gadget: composite: dequeue cdev->req before free it in
      composite_dev_cleanup) fixed a bug: free the usb request(i.e. cdev->req) but
      does not dequeue it beforehand. This fix is not proper enough because it
      dequeues the request after free its data buffer, considering the hardware can
      access the buffer's memory anytime before the request's complettion rountine
      runs, and usb_ep_dequeue always call the complettion rountine before it returns,
      so the best way is to dequeue the request before free its buffer.
      Suggested-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NLi Jun <b47624@freescale.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      be0a8887
  19. 16 7月, 2014 1 次提交
  20. 28 5月, 2014 1 次提交
  21. 14 5月, 2014 2 次提交
    • A
      usb: gadget: OS Feature Descriptors support · 37a3a533
      Andrzej Pietrasiewicz 提交于
      There is a custom (non-USB IF) extension to the USB standard:
      
      http://msdn.microsoft.com/library/windows/hardware/gg463182
      
      They grant permission to use the specification - there is
      "Microsoft OS Descriptor Specification License Agreement"
      under the link mentioned above, and its Section 2 "Grant
      of License", letter (b) reads:
      
      "Patent license. Microsoft hereby grants to You a nonexclusive,
      royalty-free, nontransferable, worldwide license under Microsoft’s
      patents embodied solely within the Specification and that are owned
      or licensable by Microsoft to make, use, import, offer to sell,
      sell and distribute directly or indirectly to Your Licensees Your
      Implementation. You may sublicense this patent license to Your
      Licensees under the same terms and conditions."
      
      The said extension is maintained by Microsoft for Microsoft.
      
      Yet it is fairly common for various devices to use it, and a
      popular proprietary operating system expects devices to provide
      "OS descriptors", so Linux-based USB gadgets whishing to be able
      to talk to a variety of operating systems should be able to provide
      the "OS descriptors".
      
      This patch adds optional support for gadgets whishing to expose
      the so called "OS Feature Descriptors", that is "Extended Compatibility ID"
      and "Extended Properties".
      
      Hosts which do request "OS descriptors" from gadgets do so during
      the enumeration phase and before the configuration is set with
      SET_CONFIGURATION. What is more, those hosts never ask for configurations
      at indices other than 0. Therefore, gadgets whishing to provide
      "OS descriptors" must designate one configuration to be used with
      this kind of hosts - this is what os_desc_config is added for in
      struct usb_composite_dev. There is an additional advantage to it:
      if a gadget provides "OS descriptors" and designates one configuration
      to be used with such non-USB-compliant hosts it can invoke
      "usb_add_config" in any order because the designated configuration
      will be reported to be at index 0 anyway.
      
      This patch also adds handling vendor-specific requests addressed
      at device or interface and related to handling "OS descriptors".
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      37a3a533
    • A
      usb: gadget: OS String support · 19824d5e
      Andrzej Pietrasiewicz 提交于
      There is a custom (non-USB IF) extension to the USB standard:
      
      http://msdn.microsoft.com/library/windows/hardware/gg463182
      
      They grant permission to use the specification - there is
      "Microsoft OS Descriptor Specification License Agreement"
      under the link mentioned above, and its Section 2 "Grant
      of License", letter (b) reads:
      
      "Patent license. Microsoft hereby grants to You a nonexclusive,
      royalty-free, nontransferable, worldwide license under Microsoft’s
      patents embodied solely within the Specification and that are owned
      or licensable by Microsoft to make, use, import, offer to sell,
      sell and distribute directly or indirectly to Your Licensees Your
      Implementation. You may sublicense this patent license to Your
      Licensees under the same terms and conditions."
      
      The said extension is maintained by Microsoft for Microsoft.
      
      Yet it is fairly common for various devices to use it, and a
      popular proprietary operating system expects devices to provide
      "OS descriptors", so Linux-based USB gadgets whishing to be able
      to talk to a variety of operating systems should be able to provide
      the "OS descriptors".
      
      This patch adds optional support for gadgets whishing to expose
      the so called "OS String" under index 0xEE of language 0.
      The contents of the string is generated based on the qw_sign
      array and b_vendor_code.
      
      Interested gadgets need to set the cdev->use_os_string flag,
      fill cdev->qw_sign with appropriate values and fill cdev->b_vendor_code
      with a value of their choice.
      
      This patch does not however implement responding to any vendor-specific
      USB requests.
      Signed-off-by: NAndrzej Pietrasiewicz <andrzej.p@samsung.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      19824d5e
  22. 13 5月, 2014 1 次提交
  23. 18 3月, 2014 1 次提交
  24. 19 12月, 2013 1 次提交