diff options
author | Felipe Balbi <felipe.balbi@linux.intel.com> | 2017-01-31 14:54:45 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-18 19:14:31 +0800 |
commit | 5ce2e4ce4a8a02d1ca9ed0d4aeac7a24cd3a59b9 (patch) | |
tree | 71f5c6c5d5283c03bd3cc72294ab946da58b2e07 | |
parent | 40192c96660f46b9aaaf2b8196856d230f859aca (diff) | |
download | linux-stable-5ce2e4ce4a8a02d1ca9ed0d4aeac7a24cd3a59b9.tar.gz linux-stable-5ce2e4ce4a8a02d1ca9ed0d4aeac7a24cd3a59b9.tar.bz2 linux-stable-5ce2e4ce4a8a02d1ca9ed0d4aeac7a24cd3a59b9.zip |
usb: gadget: function: f_fs: pass companion descriptor along
commit 2bfa0719ac2a9b2f3c91345873d3cdebd0296ba9 upstream.
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.
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 8d412d8b1f29..89081b834615 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1833,11 +1833,14 @@ static int ffs_func_eps_enable(struct ffs_function *func) spin_lock_irqsave(&func->ffs->eps_lock, flags); do { struct usb_endpoint_descriptor *ds; + struct usb_ss_ep_comp_descriptor *comp_desc = NULL; + int needs_comp_desc = false; int desc_idx; - if (ffs->gadget->speed == USB_SPEED_SUPER) + if (ffs->gadget->speed == USB_SPEED_SUPER) { desc_idx = 2; - else if (ffs->gadget->speed == USB_SPEED_HIGH) + needs_comp_desc = true; + } else if (ffs->gadget->speed == USB_SPEED_HIGH) desc_idx = 1; else desc_idx = 0; @@ -1854,6 +1857,14 @@ static int ffs_func_eps_enable(struct ffs_function *func) ep->ep->driver_data = ep; ep->ep->desc = ds; + + comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds + + USB_DT_ENDPOINT_SIZE); + ep->ep->maxburst = comp_desc->bMaxBurst + 1; + + if (needs_comp_desc) + ep->ep->comp_desc = comp_desc; + ret = usb_ep_enable(ep->ep); if (likely(!ret)) { epfile->ep = ep; |