All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Peter Chen <peter.chen@kernel.org>
Cc: Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Peter Chen <Peter.Chen@nxp.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Felipe Balbi <balbi@kernel.org>,
	Maxim Schwalm <maxim.schwalm@gmail.com>,
	linux-tegra@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] usb: chipidea: tegra: Delay PHY suspending
Date: Sat, 12 Jun 2021 16:55:14 +0300	[thread overview]
Message-ID: <968bdb71-0c36-b8c7-3d8a-42d494c8a7cd@gmail.com> (raw)
In-Reply-To: <20210612073450.GB4580@Peter>

12.06.2021 10:34, Peter Chen пишет:
> On 21-06-09 15:04:04, Dmitry Osipenko wrote:
>> The ChipIdea driver enters into suspend immediately after seeing a
>> VBUS disconnection. Some devices need an extra delay after losing
>> VBUS, otherwise VBUS may be floating, preventing the PHY's suspending
>> by the VBUS detection sensors. This problem was found on Tegra30 Asus
>> Transformer TF700T tablet device, where the USB PHY wakes up immediately
>> from suspend because VBUS sensor continues to detect VBUS as active after
>> disconnection. A minimum delay of 20ms is needed in order to fix this
>> issue, hence add 25ms delay before suspending the PHY.
>>
>> Reported-by: Maxim Schwalm <maxim.schwalm@gmail.com> # Asus TF700T
>> Tested-by: Maxim Schwalm <maxim.schwalm@gmail.com> # Asus TF700T
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>> ---
>>  drivers/usb/chipidea/ci_hdrc_tegra.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c
>> index 60361141ac04..d1359b76a0e8 100644
>> --- a/drivers/usb/chipidea/ci_hdrc_tegra.c
>> +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
>> @@ -4,6 +4,7 @@
>>   */
>>  
>>  #include <linux/clk.h>
>> +#include <linux/delay.h>
>>  #include <linux/io.h>
>>  #include <linux/module.h>
>>  #include <linux/of_device.h>
>> @@ -255,6 +256,13 @@ static int tegra_ehci_hub_control(struct ci_hdrc *ci, u16 typeReq, u16 wValue,
>>  
>>  static void tegra_usb_enter_lpm(struct ci_hdrc *ci, bool enable)
>>  {
>> +	/*
>> +	 * Give hardware time to settle down after VBUS disconnection,
>> +	 * otherwise PHY may wake up from suspend immediately.
>> +	 */
>> +	if (enable)
>> +		msleep(25);
>> +
> 
> How could you know 25ms is enough for other Tegra designs?

I don't know what is the maximum timeout could be, but it shouldn't be a
problem to bump the timeout if somebody will report the need to do so.

> Could you poll VBUS wakeup threshold register to ensure the
> wakeup will not occur?

We indeed can poll the wakeup threshold status in the PHY driver, it
works too. I'll make the patch for the PHY driver, thank you for the
suggestion.

> The similar design exists at function:
> hw_wait_vbus_lower_bsv.

The hw_wait_vbus_lower_bsv uses 5sec timeout, which should be too much.
I'll set the polling timeout to 100ms.

      reply	other threads:[~2021-06-12 13:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-09 12:04 [PATCH v1] usb: chipidea: tegra: Delay PHY suspending Dmitry Osipenko
2021-06-09 12:07 ` Dmitry Osipenko
2021-06-12  7:34 ` Peter Chen
2021-06-12 13:55   ` Dmitry Osipenko [this message]

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=968bdb71-0c36-b8c7-3d8a-42d494c8a7cd@gmail.com \
    --to=digetx@gmail.com \
    --cc=Peter.Chen@nxp.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maxim.schwalm@gmail.com \
    --cc=peter.chen@kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=thierry.reding@gmail.com \
    /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.