From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@kalray.eu>,
Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1 3/4] usb: dwc2: fix multiplier handling in endpoint setup
Date: Wed, 3 May 2023 12:19:18 +0200 [thread overview]
Message-ID: <20230503101919.1826193-4-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20230503101919.1826193-1-o.rempel@pengutronix.de>
From: Michael Grzeschik <m.grzeschik@pengutronix.de>
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>
---
drivers/usb/dwc2/gadget.c | 9 +--------
1 file changed, 1 insertion(+), 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);
--
2.39.2
next prev parent reply other threads:[~2023-05-03 10:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-03 10:19 [PATCH v1 0/4] Improve USB FIFO handling and enable UMS mode on PRTT1L boards Oleksij Rempel
2023-05-03 10:19 ` [PATCH v1 1/4] usb: dwc2: Port support for USB FIFO devicetree properties from Linux v6.3 Oleksij Rempel
2023-05-03 10:19 ` [PATCH v1 2/4] usb: dwc2: Port FIFO configuration sync " Oleksij Rempel
2023-05-03 10:19 ` Oleksij Rempel [this message]
2023-05-03 10:19 ` [PATCH v1 4/4] arm: dts: stm32mp151-prtt1l: Configure USB gadget FIFOs for multiple gadgets support Oleksij Rempel
2023-05-03 10:25 ` Ahmad Fatoum
2023-05-03 11:01 ` Oleksij Rempel
2023-05-05 6:39 ` [PATCH v1 0/4] Improve USB FIFO handling and enable UMS mode on PRTT1L boards Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230503101919.1826193-4-o.rempel@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=jmaselbas@kalray.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox