Skip to content

Commit 2bfa071

Browse files
author
Felipe Balbi
committed
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: <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 7369090 commit 2bfa071

File tree

1 file changed

+13
-2
lines changed
  • drivers/usb/gadget/function

1 file changed

+13
-2
lines changed

drivers/usb/gadget/function/f_fs.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,11 +1834,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
18341834
spin_lock_irqsave(&func->ffs->eps_lock, flags);
18351835
while(count--) {
18361836
struct usb_endpoint_descriptor *ds;
1837+
struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
1838+
int needs_comp_desc = false;
18371839
int desc_idx;
18381840

1839-
if (ffs->gadget->speed == USB_SPEED_SUPER)
1841+
if (ffs->gadget->speed == USB_SPEED_SUPER) {
18401842
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)
18421845
desc_idx = 1;
18431846
else
18441847
desc_idx = 0;
@@ -1855,6 +1858,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
18551858

18561859
ep->ep->driver_data = ep;
18571860
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+
18581869
ret = usb_ep_enable(ep->ep);
18591870
if (likely(!ret)) {
18601871
epfile->ep = ep;

0 commit comments

Comments
 (0)