public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Dragan Simic <dsimic@manjaro.org>
To: Marek Vasut <marex@denx.de>
Cc: Shantur Rathore <i@shantur.com>,
	u-boot@lists.denx.de, andre.przywara@arm.com,
	Hector Martin <marcan@marcan.st>, Simon Glass <sjg@chromium.org>,
	Tom Rini <trini@konsulko.com>
Subject: Re: [FIX PATCH v1] Fix: common: usb_hub: Reset only USB3.0 hub
Date: Thu, 08 Feb 2024 14:44:29 +0100	[thread overview]
Message-ID: <24f25359ce213370214bceeabc55e1df@manjaro.org> (raw)
In-Reply-To: <93f69779-3197-4ede-bb78-f2512ec30fc1@denx.de>

On 2024-02-08 14:33, Marek Vasut wrote:
> On 2/8/24 12:30, Shantur Rathore wrote:
>> On Wed, Feb 7, 2024 at 1:07 PM Marek Vasut <marex@denx.de> wrote:
>>> On 2/7/24 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.
>>> 
>>> It would be good to include as many details about the faulty hardware 
>>> in
>>> the commit message as possible, so that when someone else runs into
>>> this, they would have all that information available.
>>> 
>>>> Tested-by: Andre Przywara <andre.przywara@arm.com>
>>>> 
>>>> Signed-off-by: Shantur Rathore <i@shantur.com>
>>>> ---
>>>> 
>>>>    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)) {
>>> 
>>> Should this condition be "all which are lower than superspeed" 
>>> instead ,
>>> so when the next generation of USB comes, this problem won't trigger 
>>> ?
>>> 
>>> What does Linux do btw ?
>> 
>> As of now Linux checks if the hub is superspeed
>> https://github.com/torvalds/linux/blob/master/drivers/usb/core/hub.c#L2859
>> 
>> which is
>>   return hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS; // 
>> USB_HUB_PR_SS = 3
>> 
>> This holds true for newer SuperSpeedPlus hubs as well.
>> https://github.com/torvalds/linux/blob/master/drivers/usb/core/hub.h#L155
>> 
>> We can change the check to be  bDeviceProtocol > 2 but who knows if
>> things change in the newer version of spec.
>> I am open to suggestions.
> 
> Please just include the ^ in the commit description. Use link to
> git.kernel.org , not some mirror . This is extremely useful
> information and, well, you already wrote the V2 commit message
> addition in this answer.

Shantur, if that would be easier or quicker for you, I can write
a quite detailed patch description for you, in exchange for a
"Helped-by" tag in the v2 patch submission. :)

  reply	other threads:[~2024-02-08 13:44 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 10:23 [FIX PATCH v1] Fix: common: usb_hub: Reset only USB3.0 hub Shantur Rathore
2024-02-07 13:03 ` Marek Vasut
2024-02-08 11:30   ` Shantur Rathore
2024-02-08 13:33     ` Marek Vasut
2024-02-08 13:44       ` Dragan Simic [this message]
2024-02-08 14:10         ` Shantur Rathore
2024-02-08 14:17           ` Dragan Simic
2024-02-10  7:13             ` Dragan Simic
2024-02-12 13:40               ` Shantur Rathore
2024-02-12 13:41                 ` Shantur Rathore
2024-02-12 20:19                   ` Marek Vasut
2024-02-12 21:10                     ` Dragan Simic
2024-02-12 23:33                       ` Marek Vasut
2024-02-13  3:59                         ` Dragan Simic
2024-02-13 11:50                           ` Marek Vasut
2024-02-14  2:04                     ` Andre Przywara
2024-02-14  3:18                       ` Dragan Simic
2024-02-14  3:48                         ` Dragan Simic
2024-02-14  9:56                           ` Shantur Rathore
2024-02-14 10:01                             ` Shantur Rathore
2024-02-14 10:23                               ` Dragan Simic
2024-02-12 13:50                 ` Dragan Simic
2024-02-07 13:14 ` Dragan Simic
2024-02-07 13:16   ` Dragan Simic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24f25359ce213370214bceeabc55e1df@manjaro.org \
    --to=dsimic@manjaro.org \
    --cc=andre.przywara@arm.com \
    --cc=i@shantur.com \
    --cc=marcan@marcan.st \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox