From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: ukl@pengutronix.de
Subject: [PATCH] usb: Fix initial max packet size
Date: Tue, 27 Oct 2020 10:42:42 +0100 [thread overview]
Message-ID: <20201027094242.32582-1-s.hauer@pengutronix.de> (raw)
In case the USB device is a full speed device we have to set
dev->epmaxpacketin[0] and dev->epmaxpacketout[0] before doing a
get_descriptor_len() because otherwise it's unset during that call.
Fixes: 6d1d95a386 ("usb: factor out a usb_setup_descriptor() function")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/usb/core/usb.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index c068c64c6b..ea244d4bcf 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -332,6 +332,8 @@ static int usb_setup_descriptor(struct usb_device *dev, bool do_read)
dev->descriptor->bMaxPacketSize0 = 64;
dev->maxpacketsize = PACKET_SIZE_64;
}
+ dev->epmaxpacketin[0] = dev->descriptor->bMaxPacketSize0;
+ dev->epmaxpacketout[0] = dev->descriptor->bMaxPacketSize0;
if (do_read && dev->speed == USB_SPEED_FULL) {
int err;
@@ -355,10 +357,10 @@ static int usb_setup_descriptor(struct usb_device *dev, bool do_read)
err = get_descriptor_len(dev, 64, 8);
if (err)
return err;
- }
- dev->epmaxpacketin[0] = dev->descriptor->bMaxPacketSize0;
- dev->epmaxpacketout[0] = dev->descriptor->bMaxPacketSize0;
+ dev->epmaxpacketin[0] = dev->descriptor->bMaxPacketSize0;
+ dev->epmaxpacketout[0] = dev->descriptor->bMaxPacketSize0;
+ }
switch (dev->descriptor->bMaxPacketSize0) {
case 8:
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2020-10-27 9:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 9:42 Sascha Hauer [this message]
2020-10-27 12:10 ` Gavin Schenk
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=20201027094242.32582-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=ukl@pengutronix.de \
/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