mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jules Maselbas <jmaselbas@kalray.eu>
To: Barebox List <barebox@lists.infradead.org>
Cc: Jules Maselbas <jmaselbas@kalray.eu>
Subject: [RFC PATCH 3/9] usb: Update uses of usb_endpoint_maxp
Date: Wed, 22 Jan 2020 16:49:44 +0100	[thread overview]
Message-ID: <20200122154950.22746-4-jmaselbas@kalray.eu> (raw)
In-Reply-To: <20200122154950.22746-1-jmaselbas@kalray.eu>

Now usb_endpoint_maxp only returns the 11 lowest bits, it does no
longer include the mult bits. And such functions that uses the mult
bits must be updated to uses the usb_endpoint_maxp_mult function.

Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
 drivers/usb/gadget/epautoconf.c |  2 +-
 drivers/usb/musb/musb_gadget.c  | 12 ++++--------
 drivers/usb/musb/musb_host.c    |  3 +--
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c
index ced568921..c4c4a5672 100644
--- a/drivers/usb/gadget/epautoconf.c
+++ b/drivers/usb/gadget/epautoconf.c
@@ -132,7 +132,7 @@ ep_matches (
 	 * where it's an output parameter representing the full speed limit.
 	 * the usb spec fixes high speed bulk maxpacket at 512 bytes.
 	 */
-	max = 0x7ff & usb_endpoint_maxp(desc);
+	max = usb_endpoint_maxp(desc);
 	switch (type) {
 	case USB_ENDPOINT_XFER_INT:
 		/* INT:  limit 64 bytes full speed, 1024 high/super speed */
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index fc5cfb13f..c5e46cfe0 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -443,8 +443,10 @@ static int musb_gadget_enable(struct usb_ep *ep,
 		goto fail;
 
 	/* REVISIT this rules out high bandwidth periodic transfers */
-	tmp = usb_endpoint_maxp(desc);
-	if (tmp & ~0x07ff) {
+	musb_ep->packet_sz = usb_endpoint_maxp(desc);
+	musb_ep->hb_mult = usb_endpoint_maxp_mult(desc);
+	tmp = musb_ep->packet_sz * musb_ep->hb_mult;
+	if (musb_ep->hb_mult > 1) {
 		int ok;
 
 		if (usb_endpoint_dir_in(desc))
@@ -456,14 +458,8 @@ static int musb_gadget_enable(struct usb_ep *ep,
 			dev_dbg(musb->controller, "no support for high bandwidth ISO\n");
 			goto fail;
 		}
-		musb_ep->hb_mult = (tmp >> 11) & 3;
-	} else {
-		musb_ep->hb_mult = 0;
 	}
 
-	musb_ep->packet_sz = tmp & 0x7ff;
-	tmp = musb_ep->packet_sz * (musb_ep->hb_mult + 1);
-
 	/* enable the interrupts for the endpoint, set the endpoint
 	 * packet size (or fail), set the mode, clear the fifo
 	 */
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
index 68d819af2..11fde729a 100644
--- a/drivers/usb/musb/musb_host.c
+++ b/drivers/usb/musb/musb_host.c
@@ -1493,7 +1493,7 @@ int musb_urb_enqueue(
 	 * Some musb cores don't support high bandwidth ISO transfers; and
 	 * we don't (yet!) support high bandwidth interrupt transfers.
 	 */
-	qh->hb_mult = 1 + ((qh->maxpacket >> 11) & 0x03);
+	qh->hb_mult = usb_endpoint_maxp_mult(epd);
 	if (qh->hb_mult > 1) {
 		int ok = (qh->type == USB_ENDPOINT_XFER_ISOC);
 
@@ -1504,7 +1504,6 @@ int musb_urb_enqueue(
 			ret = -EMSGSIZE;
 			goto done;
 		}
-		qh->maxpacket &= 0x7ff;
 	}
 
 	qh->epnum = usb_endpoint_num(epd);
-- 
2.21.0.196.g041f5ea


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-01-22 15:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 15:49 [RFC PATCH 0/9] usb: Add dwc2 gadget driver Jules Maselbas
2020-01-22 15:49 ` [RFC PATCH 1/9] BACKPORT: usb: Add helper to extract bits 12:11 of wMaxPacketize Jules Maselbas
2020-01-22 15:49 ` [RFC PATCH 2/9] BACKPORT: usb: ch9: make usb_endpoint_maxp() return only packet size Jules Maselbas
2020-01-22 15:49 ` Jules Maselbas [this message]
2020-01-22 15:49 ` [RFC PATCH 4/9] usb: dwc2: Add otg state Jules Maselbas
2020-01-22 15:49 ` [RFC PATCH 5/9] usb: dwc2: Add function to flush a tx fifo Jules Maselbas
2020-01-22 15:49 ` [RFC PATCH 6/9] usb: dwc2: Add structure for gadget driver Jules Maselbas
2020-01-22 15:49 ` [RFC PATCH 7/9] usb: dwc2: Add getter for gadget fifo hwparams Jules Maselbas
2020-01-22 15:49 ` [RFC PATCH 8/9] usb: dwc2: gadget: Configure fifo size Jules Maselbas
2020-01-22 15:49 ` [RFC PATCH 9/9] usb: dwc2: Add gadget driver Jules Maselbas
2020-01-27 13:40   ` Sascha Hauer
2020-01-27 17:18     ` Jules Maselbas
2020-01-28  8:18       ` 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=20200122154950.22746-4-jmaselbas@kalray.eu \
    --to=jmaselbas@kalray.eu \
    --cc=barebox@lists.infradead.org \
    /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