All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: "Walt Jr. Brake" <mr.yming81@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Mathias Nyman <mathias.nyman@intel.com>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Nishad Kamdar <nishadkamdar@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Eddie Hung <eddie.hung@mediatek.com>
Subject: Re: [PATCH v2] usb: core: reduce power-on-good delay time of root hub
Date: Wed, 3 Nov 2021 22:37:33 +0200	[thread overview]
Message-ID: <13d55059-9f66-8599-54fc-46698bae41d1@linux.intel.com> (raw)
In-Reply-To: <62d0ac30-f2b9-f58c-cb1e-215ccb455753@gmail.com>

On 2.11.2021 22.29, Walt Jr. Brake wrote:
> On 2/11/2021 17:05, Mathias Nyman wrote:
>> On 1.11.2021 16.06, Alan Stern wrote:
>>> On Sat, Oct 30, 2021 at 12:49:37PM +0800, Walt Jr. Brake wrote:
>>>> This patch make USB 3.1 device cannot be detected, and I report the bug [1]
>>>> to archlinux three month ago. Yesterday I try to fix it myself, and after I
>>>> revert this patch, compile the kernel and test, it works.
>>>>
>>>> [1] https://bugs.archlinux.org/task/71660?project=1&pagenum=2
>>>>
>>>>
>>>> diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
>>>> index 22ea1f4f2d66..73f4482d833a 100644
>>>> --- a/drivers/usb/core/hub.h
>>>> +++ b/drivers/usb/core/hub.h
>>>> @@ -148,10 +148,8 @@ static inline unsigned hub_power_on_good_delay(struct
>>>> usb_hub *hub)
>>>>   {
>>>>          unsigned delay = hub->descriptor->bPwrOn2PwrGood * 2;
>>>>
>>>> -       if (!hub->hdev->parent) /* root hub */
>>>> -               return delay;
>>>> -       else /* Wait at least 100 msec for power to become stable */
>>>> -               return max(delay, 100U);
>>>> +       /* Wait at least 100 msec for power to become stable */
>>>> +       return max(delay, 100U);
>>>>   }
>>> Mathias:
>>>
>>> It looks like the bPwrOn2PwrGood value in xhci-hcd's hub descriptor is
>>> too small for some USB 3.1 devices.
>>>
>>> Can you look into this?
>>>
>>> Alan Stern
>>>
>> At first glance the xhci roothub bPwrOn2PwrGood value looks ok.
>> xhci spec 5.4.8 states software should wait 20ms after asserting PP, before
>> attempting to change the state of the port.
>>
>> xhci driver sets desc->bPwrOn2PwrGood = 10; (2ms interval, so equals 20ms )
>>
>> We should probably get this working immediately, so maybe revert that patch
>> while looking into the rootcause.
>>
>> Walt Jr. Brake, instead of reverting that patch, could you test if changing the
>> xhci roothub bPwrOn2PwrGood value helps.
>>
>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>> index a3f875eea751..756231a55602 100644
>> --- a/drivers/usb/host/xhci-hub.c
>> +++ b/drivers/usb/host/xhci-hub.c
>> @@ -257,7 +257,7 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci,
>>   {
>>          u16 temp;
>>   -       desc->bPwrOn2PwrGood = 10;      /* xhci section 5.4.9 says 20ms max */
>> +       desc->bPwrOn2PwrGood = 50;      /* The 20ms in xhci 5.4.8 isn't enough for USB 3.1 */
>>          desc->bHubContrCurrent = 0;
>>            desc->bNbrPorts = ports;
>>
>> Thanks
>> -Mathias
> 
> Mathias:
> 
> Sorry to reply lately. I test with your patch, it works.
> 
> I also test with setting bPwrOn2PwrGood to 45, and it not work.
> 
> Seems that the minimal value should be 50 for this case.
> 

Thanks for testing, and for checking that 90ms wait isn't enough

-Mathias

WARNING: multiple messages have this Message-ID (diff)
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: "Walt Jr. Brake" <mr.yming81@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Mathias Nyman <mathias.nyman@intel.com>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Nishad Kamdar <nishadkamdar@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Eddie Hung <eddie.hung@mediatek.com>
Subject: Re: [PATCH v2] usb: core: reduce power-on-good delay time of root hub
Date: Wed, 3 Nov 2021 22:37:33 +0200	[thread overview]
Message-ID: <13d55059-9f66-8599-54fc-46698bae41d1@linux.intel.com> (raw)
In-Reply-To: <62d0ac30-f2b9-f58c-cb1e-215ccb455753@gmail.com>

On 2.11.2021 22.29, Walt Jr. Brake wrote:
> On 2/11/2021 17:05, Mathias Nyman wrote:
>> On 1.11.2021 16.06, Alan Stern wrote:
>>> On Sat, Oct 30, 2021 at 12:49:37PM +0800, Walt Jr. Brake wrote:
>>>> This patch make USB 3.1 device cannot be detected, and I report the bug [1]
>>>> to archlinux three month ago. Yesterday I try to fix it myself, and after I
>>>> revert this patch, compile the kernel and test, it works.
>>>>
>>>> [1] https://bugs.archlinux.org/task/71660?project=1&pagenum=2
>>>>
>>>>
>>>> diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
>>>> index 22ea1f4f2d66..73f4482d833a 100644
>>>> --- a/drivers/usb/core/hub.h
>>>> +++ b/drivers/usb/core/hub.h
>>>> @@ -148,10 +148,8 @@ static inline unsigned hub_power_on_good_delay(struct
>>>> usb_hub *hub)
>>>>   {
>>>>          unsigned delay = hub->descriptor->bPwrOn2PwrGood * 2;
>>>>
>>>> -       if (!hub->hdev->parent) /* root hub */
>>>> -               return delay;
>>>> -       else /* Wait at least 100 msec for power to become stable */
>>>> -               return max(delay, 100U);
>>>> +       /* Wait at least 100 msec for power to become stable */
>>>> +       return max(delay, 100U);
>>>>   }
>>> Mathias:
>>>
>>> It looks like the bPwrOn2PwrGood value in xhci-hcd's hub descriptor is
>>> too small for some USB 3.1 devices.
>>>
>>> Can you look into this?
>>>
>>> Alan Stern
>>>
>> At first glance the xhci roothub bPwrOn2PwrGood value looks ok.
>> xhci spec 5.4.8 states software should wait 20ms after asserting PP, before
>> attempting to change the state of the port.
>>
>> xhci driver sets desc->bPwrOn2PwrGood = 10; (2ms interval, so equals 20ms )
>>
>> We should probably get this working immediately, so maybe revert that patch
>> while looking into the rootcause.
>>
>> Walt Jr. Brake, instead of reverting that patch, could you test if changing the
>> xhci roothub bPwrOn2PwrGood value helps.
>>
>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>> index a3f875eea751..756231a55602 100644
>> --- a/drivers/usb/host/xhci-hub.c
>> +++ b/drivers/usb/host/xhci-hub.c
>> @@ -257,7 +257,7 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci,
>>   {
>>          u16 temp;
>>   -       desc->bPwrOn2PwrGood = 10;      /* xhci section 5.4.9 says 20ms max */
>> +       desc->bPwrOn2PwrGood = 50;      /* The 20ms in xhci 5.4.8 isn't enough for USB 3.1 */
>>          desc->bHubContrCurrent = 0;
>>            desc->bNbrPorts = ports;
>>
>> Thanks
>> -Mathias
> 
> Mathias:
> 
> Sorry to reply lately. I test with your patch, it works.
> 
> I also test with setting bPwrOn2PwrGood to 45, and it not work.
> 
> Seems that the minimal value should be 50 for this case.
> 

Thanks for testing, and for checking that 90ms wait isn't enough

-Mathias

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: "Walt Jr. Brake" <mr.yming81@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	Mathias Nyman <mathias.nyman@intel.com>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Nishad Kamdar <nishadkamdar@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org,
	Eddie Hung <eddie.hung@mediatek.com>
Subject: Re: [PATCH v2] usb: core: reduce power-on-good delay time of root hub
Date: Wed, 3 Nov 2021 22:37:33 +0200	[thread overview]
Message-ID: <13d55059-9f66-8599-54fc-46698bae41d1@linux.intel.com> (raw)
In-Reply-To: <62d0ac30-f2b9-f58c-cb1e-215ccb455753@gmail.com>

On 2.11.2021 22.29, Walt Jr. Brake wrote:
> On 2/11/2021 17:05, Mathias Nyman wrote:
>> On 1.11.2021 16.06, Alan Stern wrote:
>>> On Sat, Oct 30, 2021 at 12:49:37PM +0800, Walt Jr. Brake wrote:
>>>> This patch make USB 3.1 device cannot be detected, and I report the bug [1]
>>>> to archlinux three month ago. Yesterday I try to fix it myself, and after I
>>>> revert this patch, compile the kernel and test, it works.
>>>>
>>>> [1] https://bugs.archlinux.org/task/71660?project=1&pagenum=2
>>>>
>>>>
>>>> diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
>>>> index 22ea1f4f2d66..73f4482d833a 100644
>>>> --- a/drivers/usb/core/hub.h
>>>> +++ b/drivers/usb/core/hub.h
>>>> @@ -148,10 +148,8 @@ static inline unsigned hub_power_on_good_delay(struct
>>>> usb_hub *hub)
>>>>   {
>>>>          unsigned delay = hub->descriptor->bPwrOn2PwrGood * 2;
>>>>
>>>> -       if (!hub->hdev->parent) /* root hub */
>>>> -               return delay;
>>>> -       else /* Wait at least 100 msec for power to become stable */
>>>> -               return max(delay, 100U);
>>>> +       /* Wait at least 100 msec for power to become stable */
>>>> +       return max(delay, 100U);
>>>>   }
>>> Mathias:
>>>
>>> It looks like the bPwrOn2PwrGood value in xhci-hcd's hub descriptor is
>>> too small for some USB 3.1 devices.
>>>
>>> Can you look into this?
>>>
>>> Alan Stern
>>>
>> At first glance the xhci roothub bPwrOn2PwrGood value looks ok.
>> xhci spec 5.4.8 states software should wait 20ms after asserting PP, before
>> attempting to change the state of the port.
>>
>> xhci driver sets desc->bPwrOn2PwrGood = 10; (2ms interval, so equals 20ms )
>>
>> We should probably get this working immediately, so maybe revert that patch
>> while looking into the rootcause.
>>
>> Walt Jr. Brake, instead of reverting that patch, could you test if changing the
>> xhci roothub bPwrOn2PwrGood value helps.
>>
>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>> index a3f875eea751..756231a55602 100644
>> --- a/drivers/usb/host/xhci-hub.c
>> +++ b/drivers/usb/host/xhci-hub.c
>> @@ -257,7 +257,7 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci,
>>   {
>>          u16 temp;
>>   -       desc->bPwrOn2PwrGood = 10;      /* xhci section 5.4.9 says 20ms max */
>> +       desc->bPwrOn2PwrGood = 50;      /* The 20ms in xhci 5.4.8 isn't enough for USB 3.1 */
>>          desc->bHubContrCurrent = 0;
>>            desc->bNbrPorts = ports;
>>
>> Thanks
>> -Mathias
> 
> Mathias:
> 
> Sorry to reply lately. I test with your patch, it works.
> 
> I also test with setting bPwrOn2PwrGood to 45, and it not work.
> 
> Seems that the minimal value should be 50 for this case.
> 

Thanks for testing, and for checking that 90ms wait isn't enough

-Mathias

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-11-03 20:36 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-10  1:20 [PATCH v2] usb: core: reduce power-on-good delay time of root hub Chunfeng Yun
2021-04-10  1:20 ` Chunfeng Yun
2021-04-10  1:20 ` Chunfeng Yun
2021-11-01  3:33 ` Walt Jr. Brake
2021-11-01  3:33   ` Walt Jr. Brake
2021-11-01  3:33   ` Walt Jr. Brake
2021-11-01 16:46   ` Thorsten Leemhuis
2021-11-02  6:41     ` Thorsten Leemhuis
2021-11-09 10:28     ` Thorsten Leemhuis
     [not found] ` <5e907ccd-40bb-2ece-fe05-1a65a74f3aa2@gmail.com>
2021-11-01 14:06   ` Alan Stern
2021-11-01 14:06     ` Alan Stern
2021-11-01 14:06     ` Alan Stern
2021-11-02  9:05     ` Mathias Nyman
2021-11-02  9:05       ` Mathias Nyman
2021-11-02  9:05       ` Mathias Nyman
2021-11-02 20:29       ` Walt Jr. Brake
2021-11-02 20:29         ` Walt Jr. Brake
2021-11-02 20:29         ` Walt Jr. Brake
2021-11-03 20:37         ` Mathias Nyman [this message]
2021-11-03 20:37           ` Mathias Nyman
2021-11-03 20:37           ` Mathias Nyman
2021-11-05 10:00           ` Greg Kroah-Hartman
2021-11-05 10:00             ` Greg Kroah-Hartman
2021-11-05 10:00             ` Greg Kroah-Hartman
2021-11-05 13:30             ` Alan Stern
2021-11-05 13:30               ` Alan Stern
2021-11-05 13:30               ` Alan Stern
2021-11-05 16:00               ` [PATCH] xhci: Fix USB 3.1 enumeration issues by increasing roothub power-on-good delay Mathias Nyman
2021-11-05 16:00                 ` Mathias Nyman
2021-11-05 16:00                 ` Mathias Nyman
2021-11-05 16:09                 ` Mathias Nyman
2021-11-05 16:09                   ` Mathias Nyman
2021-11-05 16:09                   ` Mathias Nyman
2021-11-05 17:32                   ` Walt Jr. Brake
2021-11-05 17:32                     ` Walt Jr. Brake
2021-11-05 17:32                     ` Walt Jr. Brake
2021-11-05 19:41                     ` Mathias Nyman
2021-11-05 19:41                       ` Mathias Nyman
2021-11-05 19:41                       ` Mathias Nyman
2021-11-05 16:15                 ` Greg KH
2021-11-05 16:15                   ` Greg KH
2021-11-05 16:15                   ` Greg KH
2021-11-05 19:56                   ` Mathias Nyman
2021-11-05 19:56                     ` Mathias Nyman
2021-11-05 19:56                     ` Mathias Nyman
2021-11-06 14:41                     ` Greg KH
2021-11-06 14:41                       ` Greg KH
2021-11-06 14:41                       ` Greg KH

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=13d55059-9f66-8599-54fc-46698bae41d1@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=eddie.hung@mediatek.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mr.yming81@gmail.com \
    --cc=nishadkamdar@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.