diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-01-31 07:54:45 -0500 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-03-06 03:09:37 -0500 |
commit | 2bfa0719ac2a9b2f3c91345873d3cdebd0296ba9 (patch) | |
tree | c2127339c9008b629a6da691a3f77ff57f12126b | |
parent | 7369090a9fb57c3fc705ce355d2e4523a5a24716 (diff) |
usb: gadget: function: f_fs: pass companion descriptor along
If we're dealing with SuperSpeed endpoints, we need
to make sure to pass along the companion descriptor
and initialize fields needed by the Gadget
API. Eventually, f_fs.c should be converted to use
config_ep_by_speed() like all other functions,
though.
Cc: <stable@vger.kernel.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
-rw-r--r-- | drivers/usb/gadget/function/f_fs.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index a5b7cd615698..7e976f00cb02 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -1834,11 +1834,14 @@ static int ffs_func_eps_enable(struct ffs_function *func) | |||
1834 | spin_lock_irqsave(&func->ffs->eps_lock, flags); | 1834 | spin_lock_irqsave(&func->ffs->eps_lock, flags); |
1835 | while(count--) { | 1835 | while(count--) { |
1836 | struct usb_endpoint_descriptor *ds; | 1836 | struct usb_endpoint_descriptor *ds; |
1837 | struct usb_ss_ep_comp_descriptor *comp_desc = NULL; | ||
1838 | int needs_comp_desc = false; | ||
1837 | int desc_idx; | 1839 | int desc_idx; |
1838 | 1840 | ||
1839 | if (ffs->gadget->speed == USB_SPEED_SUPER) | 1841 | if (ffs->gadget->speed == USB_SPEED_SUPER) { |
1840 | desc_idx = 2; | 1842 | desc_idx = 2; |
1841 | else if (ffs->gadget->speed == USB_SPEED_HIGH) | 1843 | needs_comp_desc = true; |
1844 | } else if (ffs->gadget->speed == USB_SPEED_HIGH) | ||
1842 | desc_idx = 1; | 1845 | desc_idx = 1; |
1843 | else | 1846 | else |
1844 | desc_idx = 0; | 1847 | desc_idx = 0; |
@@ -1855,6 +1858,14 @@ static int ffs_func_eps_enable(struct ffs_function *func) | |||
1855 | 1858 | ||
1856 | ep->ep->driver_data = ep; | 1859 | ep->ep->driver_data = ep; |
1857 | ep->ep->desc = ds; | 1860 | ep->ep->desc = ds; |
1861 | |||
1862 | comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds + | ||
1863 | USB_DT_ENDPOINT_SIZE); | ||
1864 | ep->ep->maxburst = comp_desc->bMaxBurst + 1; | ||
1865 | |||
1866 | if (needs_comp_desc) | ||
1867 | ep->ep->comp_desc = comp_desc; | ||
1868 | |||
1858 | ret = usb_ep_enable(ep->ep); | 1869 | ret = usb_ep_enable(ep->ep); |
1859 | if (likely(!ret)) { | 1870 | if (likely(!ret)) { |
1860 | epfile->ep = ep; | 1871 | epfile->ep = ep; |