[FIX PATCH v1] Fix: common: usb_hub: Reset only USB3.0 hub

Dragan Simic dsimic at manjaro.org
Wed Feb 7 14:16:39 CET 2024


On 2024-02-07 14:14, Dragan Simic wrote:
> Hello Shantur,
> 
> Please see my notes below.
> 
> On 2024-02-07 11:23, Shantur Rathore wrote:
>> USB 3.0 spec requires hub to reset device while
>> enumeration. Some USB 2.0 hubs / devices don't
>> handle this well and after implementation of
>> reset some USB 2.0 disks weren't detected on
>> Allwinner based boards.
>> 
>> Resetting only when hub is USB 3.0 fixes it.
>> 
>> Tested-by: Andre Przywara <andre.przywara at arm.com>
>> 
>> Signed-off-by: Shantur Rathore <i at shantur.com>
> 
> Please, add the "Fixes" line available below, reformat the patch
> description to the usual 78-character width, and remove unnecessary
> "FIX " from the patch subject prefix.
> 
> Fixes: 33e06dcbe57a ("common: usb-hub: Reset hub port before scanning")
> 
> As a side note, such tags can be produced very easily by running
> "git log --max-count=1 --pretty=fixes <commit>".  I have an alias
> like that defined in my ~/.gitconfig.
> 
> With these changes applied, please feel free to also add:
> 
> Reviewed-by: Dragan Simic <dsimic at anjaro.org>

Oops, sorry for the typo...  s/anjaro/manjaro/

>> ---
>> 
>>  common/usb_hub.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>> 
>> diff --git a/common/usb_hub.c b/common/usb_hub.c
>> index 3fb7e14d10..2e054eb935 100644
>> --- a/common/usb_hub.c
>> +++ b/common/usb_hub.c
>> @@ -174,8 +174,10 @@ static void usb_hub_power_on(struct 
>> usb_hub_device *hub)
>> 
>>  	debug("enabling power on all ports\n");
>>  	for (i = 0; i < dev->maxchild; i++) {
>> -		usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_RESET);
>> -		debug("Reset : port %d returns %lX\n", i + 1, dev->status);
>> +		if (usb_hub_is_superspeed(dev)) {
>> +			usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_RESET);
>> +			debug("Reset : port %d returns %lX\n", i + 1, dev->status);
>> +		}
>>  		usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
>>  		debug("PowerOn : port %d returns %lX\n", i + 1, dev->status);
>>  	}


More information about the U-Boot mailing list