Skip to contentSkip to conversation

usb: gadget: dwc2_udc_otg: modified the check condition for max packet size of ep_in in high speed

PATCH New Steve Rae 3 participants 5 messages Jan 27, 2016 – Jan 29, 2016 USB

lore
Share & tools
lore

Steve Rae

author
#0 lore raw

PATCH 1/1 usb: gadget: dwc2_udc_otg: modified the check condition for max packet size of ep_in in high speed

From: Frank Wang <[email protected]>

In current high speed fastboot, fs_ep_in.wMaxPacketSize is configured 64 bytes as default, as a result, it failed to match the size at initialization stage in usb controller.
Actually, hardware can support less than or equal to 512 bytes in high speed mode, so I changed the condition from '!=' to '>' to fix this issue.

---

 drivers/usb/gadget/dwc2_udc_otg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/dwc2_udc_otg.c +2 -2
index 90ed5ff..19d6dcd 100644
@@ -565,8 +565,8 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
 	}
 
 	/* hardware _could_ do smaller, but driver doesn't */
-	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
-	     && le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) !=
+	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK &&
+	     le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) >
 	     ep_maxpacket(ep)) || !get_unaligned(&desc->wMaxPacketSize)) {
 
 		debug("%s: bad %s maxpacket\n", __func__, _ep->name);
Signature · 1 line
1.8.5
Applied
#1 lore raw

PATCH 1/1 usb: gadget: dwc2_udc_otg: modified the check condition for max packet size of ep_in in high speed

Quoted 9 lines · Steve Rae

From: Frank Wang <[email protected]>

In current high speed fastboot, fs_ep_in.wMaxPacketSize is configured 64 bytes as default, as a result, it failed to match the size at initialization stage in usb controller.
Actually, hardware can support less than or equal to 512 bytes in high speed mode, so I changed the condition from '!=' to '>' to fix this issue.

Quoted 3 lines

---

Applied, thanks.

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 usb: gadget: dwc2_udc_otg: modified the check condition for max packet size of ep_in in high speed

In reply to Steve Rae

Hi Steve,

Quoted 8 lines

From: Frank Wang <[email protected]>

In current high speed fastboot, fs_ep_in.wMaxPacketSize is configured 64 bytes as default, as a result, it failed to match the size at initialization stage in usb controller.
Actually, hardware can support less than or equal to 512 bytes in high speed mode, so I changed the condition from '!=' to '>' to fix this issue.

I'm aware of this problem, however now I'm busy with fixing dfu issue regarding sending large files (e.g. 26 MiB). Patches are under testing now.

After sending them I'll fix the fastboot problem.

Quoted 23 lines

---

 drivers/usb/gadget/dwc2_udc_otg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/dwc2_udc_otg.c index 90ed5ff..19d6dcd 100644

drivers/usb/gadget/dwc2_udc_otg.c +2 -2
@@ -565,8 +565,8 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
 	}
 
 	/* hardware _could_ do smaller, but driver doesn't */
-	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
-	     && le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) !=
+	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK &&
+	     le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) >
 	     ep_maxpacket(ep))
 || !get_unaligned(&desc->wMaxPacketSize)) { 
 		debug("%s: bad %s maxpacket\n", __func__, _ep->name);
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#3 lore raw

PATCH 1/1 usb: gadget: dwc2_udc_otg: modified the check condition for max packet size of ep_in in high speed

In reply to Steve Rae

Hi Steve,

Quoted 21 lines

From: Frank Wang <[email protected]>

In current high speed fastboot, fs_ep_in.wMaxPacketSize is configured 64 bytes as default, as a result, it failed to match the size at initialization stage in usb controller.
Actually, hardware can support less than or equal to 512 bytes in high speed mode, so I changed the condition from '!=' to '>' to fix this issue.

---

 drivers/usb/gadget/dwc2_udc_otg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/dwc2_udc_otg.c index 90ed5ff..19d6dcd 100644

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_ep_enable(struct usb_ep *_ep, · line 572

Quoted 10 lines
drivers/usb/gadget/dwc2_udc_otg.c +2 -2
@@ -565,8 +565,8 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
 	}
 
 	/* hardware _could_ do smaller, but driver doesn't */
-	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
-	     && le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) !=
+	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK &&
+	     le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) >
 	     ep_maxpacket(ep))
 || !get_unaligned(&desc->wMaxPacketSize)) { 
 		debug("%s: bad %s maxpacket\n", __func__, _ep->name);

Test HW: Trats - Exynos4210 (dwc2 udc controller).

@Marek:

Should I pick this patch or will you take it?

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#4 lore raw

PATCH 1/1 usb: gadget: dwc2_udc_otg: modified the check condition for max packet size of ep_in in high speed

Quoted 42 lines · Lukasz Majewski

Hi Steve,

Quoted 32 lines

From: Frank Wang <[email protected]>

In current high speed fastboot, fs_ep_in.wMaxPacketSize is configured 64 bytes as default, as a result, it failed to match the size at initialization stage in usb controller.
Actually, hardware can support less than or equal to 512 bytes in high speed mode, so I changed the condition from '!=' to '>' to fix this issue.

---

 drivers/usb/gadget/dwc2_udc_otg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/usb/gadget/dwc2_udc_otg.c index 90ed5ff..19d6dcd 100644

drivers/usb/gadget/dwc2_udc_otg.c +2 -2
@@ -565,8 +565,8 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
 
 	}
 
 	/* hardware _could_ do smaller, but driver doesn't */
 
-	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
-	     && le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) !=
+	if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK &&
+	     le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) >
 

ep_maxpacket(ep))

Quoted 4 lines
|| 
|| !get_unaligned(&desc->wMaxPacketSize)) {
|| 

debug("%s: bad %s maxpacket\n", __func__, _ep->name);

Quoted 5 lines

Test HW: Trats - Exynos4210 (dwc2 udc controller).

@Marek:

Should I pick this patch or will you take it?

Pick it (and all the other udc stuff) and send me a PR please.

Best regards,
Marek Vasut