diff mbox

[U-Boot] usb: dwc2: Init desc_before_addr

Message ID 1461632904-6909-1-git-send-email-marex@denx.de
State Accepted
Commit e96e064f51139c4af39f14499564ef76e40bbc29
Delegated to: Marek Vasut
Headers show

Commit Message

Marek Vasut April 26, 2016, 1:08 a.m. UTC
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.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Tom Rini <trini@konsulko.com>
---
 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.

Comments

Marek Vasut April 26, 2016, 1:10 a.m. UTC | #1
On 04/26/2016 03:08 AM, Marek Vasut wrote:
> 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.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>  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.

> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
> index b2f4bc6..559c43f 100644
> --- a/drivers/usb/host/dwc2.c
> +++ b/drivers/usb/host/dwc2.c
> @@ -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);
>  }
>
Dinh Nguyen April 27, 2016, 5:15 p.m. UTC | #2
On 04/25/2016 08:08 PM, Marek Vasut wrote:
> 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.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>  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.
> 
> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
> index b2f4bc6..559c43f 100644
> --- a/drivers/usb/host/dwc2.c
> +++ b/drivers/usb/host/dwc2.c
> @@ -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:

Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>

Dinh
Marek Vasut April 27, 2016, 8:40 p.m. UTC | #3
On 04/27/2016 07:15 PM, Dinh Nguyen wrote:
> On 04/25/2016 08:08 PM, Marek Vasut wrote:
>> 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.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
>> Cc: Tom Rini <trini@konsulko.com>
>> ---
>>  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.
>>
>> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
>> index b2f4bc6..559c43f 100644
>> --- a/drivers/usb/host/dwc2.c
>> +++ b/drivers/usb/host/dwc2.c
>> @@ -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:
> 
> Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>

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

> Dinh
>
Stefan Roese April 28, 2016, 6:16 a.m. UTC | #4
On 26.04.2016 03:08, Marek Vasut wrote:
> 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.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: Tom Rini <trini@konsulko.com>

Tested-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Marek Vasut April 28, 2016, 12:42 p.m. UTC | #5
On 04/28/2016 08:16 AM, Stefan Roese wrote:
> On 26.04.2016 03:08, Marek Vasut wrote:
>> 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.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Dinh Nguyen <dinguyen@opensource.altera.com>
>> Cc: Tom Rini <trini@konsulko.com>
> 
> Tested-by: Stefan Roese <sr@denx.de>
> 
> Thanks,
> Stefan

Applied.
diff mbox

Patch

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index b2f4bc6..559c43f 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -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);
 }