Skip to contentSkip to conversation

usb: dwc2: Init desc_before_addr

PATCH New Marek Vasut 3 participants 6 messages Apr 26, 2016 – Apr 28, 2016 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc2: Init desc_before_addr

Initialize desc_before_addr, otherwise the USB core won't send the first 64B Get Device Descriptor request in common/usb.c function usb_setup_descriptor() . There are some USB devices which expect this sequence and otherwise can misbehave.

---
 drivers/usb/host/dwc2.c | 3 +++
 1 file changed, 3 insertions(+)

---
NOTE: I checked this with TotalPhase Beagle USB480 and it does what it is
supposed to do now. It would be wonderful to get this into rc3.

drivers/usb/host/dwc2.c +3 -0
index b2f4bc6..559c43f 100644
@@ -1182,6 +1182,9 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
 static int dwc2_usb_probe(struct udevice *dev)
 {
 	struct dwc2_priv *priv = dev_get_priv(dev);
+	struct usb_bus_priv *bus_priv = dev_get_uclass_priv(dev);
+
+	bus_priv->desc_before_addr = true;
 
 	return dwc2_init_common(priv);
 }
Signature · 1 line
2.7.0
#1 lore raw

PATCH 1/1 usb: dwc2: Init desc_before_addr

Quoted 8 lines · Marek Vasut

Initialize desc_before_addr, otherwise the USB core won't send the first 64B Get Device Descriptor request in common/usb.c function usb_setup_descriptor() . There are some USB devices which expect this sequence and otherwise can misbehave.

Quoted 6 lines
---
 drivers/usb/host/dwc2.c | 3 +++
 1 file changed, 3 insertions(+)

---
NOTE: I checked this with TotalPhase Beagle USB480 and it does what it is
supposed to do now. It would be wonderful to get this into rc3.

Oh, before anyone asks if this fixes USB problem on SoCFPGA, no, it does not. There is more weird stuff to go, I have certain hypothesis, but let's see.

Quoted 15 lines
drivers/usb/host/dwc2.c +3 -0
index b2f4bc6..559c43f 100644
@@ -1182,6 +1182,9 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
 static int dwc2_usb_probe(struct udevice *dev)
 {
 	struct dwc2_priv *priv = dev_get_priv(dev);
+	struct usb_bus_priv *bus_priv = dev_get_uclass_priv(dev);
+
+	bus_priv->desc_before_addr = true;
 
 	return dwc2_init_common(priv);
 }
Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH 1/1 usb: dwc2: Init desc_before_addr

In reply to Marek Vasut
Quoted 21 lines · Marek Vasut

Initialize desc_before_addr, otherwise the USB core won't send the first 64B Get Device Descriptor request in common/usb.c function usb_setup_descriptor() . There are some USB devices which expect this sequence and otherwise can misbehave.

---
 drivers/usb/host/dwc2.c | 3 +++
 1 file changed, 3 insertions(+)

---
NOTE: I checked this with TotalPhase Beagle USB480 and it does what it is
supposed to do now. It would be wonderful to get this into rc3.

drivers/usb/host/dwc2.c +0 -0
index b2f4bc6..559c43f 100644

drivers/usb/host/dwc2.c static int dwc2_usb_ofdata_to_platdata(struct udevice *dev) · line 1190

Quoted 9 lines
drivers/usb/host/dwc2.c +3 -0
@@ -1182,6 +1182,9 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
 static int dwc2_usb_probe(struct udevice *dev)
 {
 	struct dwc2_priv *priv = dev_get_priv(dev);
+	struct usb_bus_priv *bus_priv = dev_get_uclass_priv(dev);
+
+	bus_priv->desc_before_addr = true;
 
 	return dwc2_init_common(priv);
 }

With this patch, I no longer have to revert commit "c998da0d67091 usb:
Change power-on / scanning timeout handling" for my problematic Kingston USB stick to work.

So feel free to add:

Dinh

#3 lore raw

PATCH 1/1 usb: dwc2: Init desc_before_addr

Quoted 36 lines · Dinh Nguyen
Quoted 21 lines · Marek Vasut

Initialize desc_before_addr, otherwise the USB core won't send the first 64B Get Device Descriptor request in common/usb.c function usb_setup_descriptor() . There are some USB devices which expect this sequence and otherwise can misbehave.

---
 drivers/usb/host/dwc2.c | 3 +++
 1 file changed, 3 insertions(+)

---
NOTE: I checked this with TotalPhase Beagle USB480 and it does what it is
supposed to do now. It would be wonderful to get this into rc3.

drivers/usb/host/dwc2.c +0 -0
index b2f4bc6..559c43f 100644

drivers/usb/host/dwc2.c static int dwc2_usb_ofdata_to_platdata(struct udevice *dev) · line 1190

Quoted 9 lines
drivers/usb/host/dwc2.c +3 -0
@@ -1182,6 +1182,9 @@ static int dwc2_usb_ofdata_to_platdata(struct udevice *dev)
 static int dwc2_usb_probe(struct udevice *dev)
 {
 	struct dwc2_priv *priv = dev_get_priv(dev);
+	struct usb_bus_priv *bus_priv = dev_get_uclass_priv(dev);
+
+	bus_priv->desc_before_addr = true;
 
 	return dwc2_init_common(priv);
 }

With this patch, I no longer have to revert commit "c998da0d67091 usb:
Change power-on / scanning timeout handling" for my problematic Kingston USB stick to work.

Quoted 3 lines

So feel free to add:

Good for you, bad for me ;-) If we don't fix this USB horror before ELCE, you can expect a nice gift :)

Quoted 2 lines

Dinh

Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH 1/1 usb: dwc2: Init desc_before_addr

In reply to Marek Vasut
Quoted 8 lines · Marek Vasut

Initialize desc_before_addr, otherwise the USB core won't send the first 64B Get Device Descriptor request in common/usb.c function usb_setup_descriptor() . There are some USB devices which expect this sequence and otherwise can misbehave.

Thanks,
Stefan

author Applied
#5 lore raw

PATCH 1/1 usb: dwc2: Init desc_before_addr

Quoted 6 lines · Stefan Roese
Quoted 5 lines · Marek Vasut

Initialize desc_before_addr, otherwise the USB core won't send the first 64B Get Device Descriptor request in common/usb.c function usb_setup_descriptor() . There are some USB devices which expect this sequence and otherwise can misbehave.

Quoted 8 lines
Quoted 3 lines

Thanks,
Stefan

Applied.

Signature · 2 lines
Best regards,
Marek Vasut