From: Peter Chen <peter.chen@kernel.org>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
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 1/2] usb: phy: tegra: Wait for VBUS wakeup status deassertion on suspend
Date: Tue, 15 Jun 2021 09:05:16 +0800 [thread overview]
Message-ID: <20210615010516.GA28352@nchen> (raw)
In-Reply-To: <20210613145936.9902-1-digetx@gmail.com>
On 21-06-13 17:59:35, Dmitry Osipenko wrote:
> Some devices need an extra delay after losing VBUS, otherwise VBUS may
> be detected as active at suspend time, preventing the PHY's suspension
> by the VBUS detection sensor. This problem was found on Asus Transformer
> TF700T (Tegra30) tablet device, where the USB PHY wakes up immediately
> from suspend because VBUS sensor continues to detect VBUS as active after
> disconnection. We need to poll the PHY's VBUS wakeup status until it's
> deasserted before suspending PHY in order to fix this minor trouble.
>
> Fixes: 35192007d28d ("usb: phy: tegra: Support waking up from a low power mode")
> 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/phy/phy-tegra-usb.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
> index fc5c6cab58ba..ff482c694200 100644
> --- a/drivers/usb/phy/phy-tegra-usb.c
> +++ b/drivers/usb/phy/phy-tegra-usb.c
> @@ -64,6 +64,7 @@
> #define A_VBUS_VLD_WAKEUP_EN BIT(30)
>
> #define USB_PHY_VBUS_WAKEUP_ID 0x408
> +#define VBUS_WAKEUP_STS BIT(10)
> #define VBUS_WAKEUP_WAKEUP_EN BIT(30)
>
> #define USB1_LEGACY_CTRL 0x410
> @@ -645,6 +646,15 @@ static int utmi_phy_power_off(struct tegra_usb_phy *phy)
> void __iomem *base = phy->regs;
> u32 val;
>
> + /*
> + * Give hardware time to settle down after VBUS disconnection,
> + * otherwise PHY will immediately wake up from suspend.
> + */
> + if (phy->wakeup_enabled && phy->mode != USB_DR_MODE_HOST)
> + readl_relaxed_poll_timeout(base + USB_PHY_VBUS_WAKEUP_ID,
> + val, !(val & VBUS_WAKEUP_STS),
> + 5000, 100000);
> +
Where will clear VBUS_WAKEUP_STS? Or it will be cleared by HW after VBUS lower than
B Session Valid?
--
Thanks,
Peter Chen
next prev parent reply other threads:[~2021-06-15 3:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-13 14:59 [PATCH v1 1/2] usb: phy: tegra: Wait for VBUS wakeup status deassertion on suspend Dmitry Osipenko
2021-06-13 14:59 ` [PATCH v1 2/2] usb: phy: tegra: Correct definition of B_SESS_VLD_WAKEUP_EN bit Dmitry Osipenko
2021-06-15 1:05 ` Peter Chen [this message]
2021-06-15 14:48 ` [PATCH v1 1/2] usb: phy: tegra: Wait for VBUS wakeup status deassertion on suspend Dmitry Osipenko
2021-06-15 1:06 ` Peter Chen
2021-06-16 0:56 ` Peter Chen
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=20210615010516.GA28352@nchen \
--to=peter.chen@kernel.org \
--cc=balbi@kernel.org \
--cc=digetx@gmail.com \
--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=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.