diff options
author | Michael Grzeschik <m.grzeschik@pengutronix.de> | 2023-05-03 12:19:18 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-05-22 13:29:46 +0200 |
commit | 556150f0a8fc11f0658085dcbd0e9894e12eb188 (patch) | |
tree | b8a630356cff2fc4334e205c1d9e5bed5430a9ef /drivers | |
parent | b176ffd3fc0e935f2fdbfff1ef14bf33bcefdb1f (diff) | |
download | barebox-556150f0a8fc11f0658085dcbd0e9894e12eb188.tar.gz barebox-556150f0a8fc11f0658085dcbd0e9894e12eb188.tar.xz |
usb: dwc2: fix multiplier handling in endpoint setup
If the multiplier is 0 in the descriptor bitfield the multiplier count
is one. For calculating the multiplier count the extra function
usb_endpoint_maxp_mult should be used. Rework the dwc2 driver to use it
and make multi packages work.
While at it, we also remove the USB_EP_MAXP_MULT and
USB_ENDPOINT_MAXP_MASK macros that would stay left unused and are
defined in include/usb/ch9.ch anyway.
Tested-by: Jules Maselbas <jmaselbas@kalray.eu>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Tested-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.barebox.org/20230503101919.1826193-4-o.rempel@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index bb55888abf..00323d2d90 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -14,13 +14,6 @@ #define spin_lock_irqsave(lock, flags) (void)(flags) #define spin_unlock_irqrestore(lock, flags) (void)(flags) -#ifndef USB_ENDPOINT_MAXP_MASK -#define USB_ENDPOINT_MAXP_MASK 0x07ff -#endif -#ifndef USB_EP_MAXP_MULT -#define USB_EP_MAXP_MULT(m) (((m) & 0x1800) >> 11) -#endif - static void kill_all_requests(struct dwc2 *, struct dwc2_ep *, int); static inline struct dwc2_ep *index_to_ep(struct dwc2 *dwc2, @@ -484,7 +477,7 @@ static int dwc2_ep_enable(struct usb_ep *ep, ep_type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; mps = usb_endpoint_maxp(desc) & USB_ENDPOINT_MAXP_MASK; - mc = USB_EP_MAXP_MULT(usb_endpoint_maxp(desc)); + mc = usb_endpoint_maxp_mult(desc); /* note, we handle this here instead of dwc2_set_ep_maxpacket */ epctrl_reg = dir_in ? DIEPCTL(index) : DOEPCTL(index); |