Skip to contentSkip to conversation

usb: gadget: dwc2_udc_otg: set ep's desc during enable/disable

PATCH In review Gary Bisson 5 participants 5 messages Jan 6, 2022 – Jan 9, 2022 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: dwc2_udc_otg: set ep's desc during enable/disable

Fastboot support has been broken on platforms using dwc2 controller since the gadget gets its max packet size from it.
This patch is the equivalent of 723fd5668ff which fixed the same issue but for the chipidea controller.

Fixes 27c9141b111 ("usb: gadget: fastboot: use correct max packet size")
---
 drivers/usb/gadget/dwc2_udc_otg.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/dwc2_udc_otg.c +2 -0
index 2f318144421..fb10884755b 100644
@@ -655,6 +655,7 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
 		return -ESHUTDOWN;
 	}
 
+	_ep->desc = desc;
 	ep->stopped = 0;
 	ep->desc = desc;
 	ep->pio_irqs = 0;
@@ -695,6 +696,7 @@ static int dwc2_ep_disable(struct usb_ep *_ep)
 	/* Nuke all pending requests */
 	nuke(ep, -ESHUTDOWN);
 
+	_ep->desc = NULL;
 	ep->desc = 0;
 	ep->stopped = 1;
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

Hi,

Quoted 17 lines · Gary Bisson

Fastboot support has been broken on platforms using dwc2 controller since the gadget gets its max packet size from it.
This patch is the equivalent of 723fd5668ff which fixed the same issue but for the chipidea controller.

Fixes 27c9141b111 ("usb: gadget: fastboot: use correct max packet size")
---
 drivers/usb/gadget/dwc2_udc_otg.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
index 2f318144421..fb10884755b 100644

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

Quoted 6 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
@@ -655,6 +655,7 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
 		return -ESHUTDOWN;
 	}
 
+	_ep->desc = desc;
 	ep->stopped = 0;
 	ep->desc = desc;

Indeed the _ep and ep was confusing when looking code

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_ep_disable(struct usb_ep *_ep) · line 702

Quoted 10 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
 	ep->pio_irqs = 0;
@@ -695,6 +696,7 @@ static int dwc2_ep_disable(struct usb_ep *_ep)
 	/* Nuke all pending requests */
 	nuke(ep, -ESHUTDOWN);
 
+	_ep->desc = NULL;
 	ep->desc = 0;
 	ep->stopped = 1;
 

An off-tree patch removed from our Yukawa backlog, thanks !

Neil

#2 lore raw
Quoted 42 lines · Neil Armstrong

Hi,

Quoted 17 lines · Gary Bisson

Fastboot support has been broken on platforms using dwc2 controller since the gadget gets its max packet size from it.
This patch is the equivalent of 723fd5668ff which fixed the same issue but for the chipidea controller.

Fixes 27c9141b111 ("usb: gadget: fastboot: use correct max packet size")
---
  drivers/usb/gadget/dwc2_udc_otg.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
index 2f318144421..fb10884755b 100644

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

Quoted 6 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
@@ -655,6 +655,7 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
  		return -ESHUTDOWN;
  	}
 
+	_ep->desc = desc;
  	ep->stopped = 0;
  	ep->desc = desc;

Indeed the _ep and ep was confusing when looking code

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_ep_disable(struct usb_ep *_ep) · line 702

Quoted 10 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
  	ep->pio_irqs = 0;
@@ -695,6 +696,7 @@ static int dwc2_ep_disable(struct usb_ep *_ep)
  	/* Nuke all pending requests */
  	nuke(ep, -ESHUTDOWN);
 
+	_ep->desc = NULL;
  	ep->desc = 0;
  	ep->stopped = 1;
 

An off-tree patch removed from our Yukawa backlog, thanks !

Quoted 1 line

+CC Tom, can you pick this one for CURRENT 2022.01 release?

Thank you

#3 lore raw

Hi Gary,

Thank you for your patch.

Quoted 43 lines · Marek Vasut
Quoted 42 lines · Neil Armstrong

Hi,

Quoted 17 lines · Gary Bisson

Fastboot support has been broken on platforms using dwc2 controller since the gadget gets its max packet size from it.
This patch is the equivalent of 723fd5668ff which fixed the same issue but for the chipidea controller.

Fixes 27c9141b111 ("usb: gadget: fastboot: use correct max packet size")
---
  drivers/usb/gadget/dwc2_udc_otg.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/usb/gadget/dwc2_udc_otg.c +0 -0
index 2f318144421..fb10884755b 100644

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

Quoted 6 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
@@ -655,6 +655,7 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
  		return -ESHUTDOWN;
  	}
 
+	_ep->desc = desc;
  	ep->stopped = 0;
  	ep->desc = desc;

Indeed the _ep and ep was confusing when looking code

drivers/usb/gadget/dwc2_udc_otg.c static int dwc2_ep_disable(struct usb_ep *_ep) · line 702

Quoted 10 lines
drivers/usb/gadget/dwc2_udc_otg.c +1 -0
  	ep->pio_irqs = 0;
@@ -695,6 +696,7 @@ static int dwc2_ep_disable(struct usb_ep *_ep)
  	/* Nuke all pending requests */
  	nuke(ep, -ESHUTDOWN);
 
+	_ep->desc = NULL;
  	ep->desc = 0;
  	ep->stopped = 1;
 

An off-tree patch removed from our Yukawa backlog, thanks !

Quoted 1 line
Quoted 1 line

I can confirm this fixes flashing issues on VIM3/VIM3L boards when flashing AOSP(yukawa) with fastboot.

Quoted 4 lines

+CC Tom, can you pick this one for CURRENT 2022.01 release?

Thank you

#4 lore raw
In reply to Gary Bisson
Quoted 10 lines · Gary Bisson

Fastboot support has been broken on platforms using dwc2 controller since the gadget gets its max packet size from it.
This patch is the equivalent of 723fd5668ff which fixed the same issue but for the chipidea controller.

Fixes 27c9141b111 ("usb: gadget: fastboot: use correct max packet size")

Applied to u-boot/master, thanks!

Signature · 1 line
Tom