Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4193508pxj; Tue, 15 Jun 2021 18:00:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwre+Jg+qXwup//WFq1Yoz5fJzsQoTqJR5JJOa0BA18ANpJ9rOSf0bCEI4bRcTSErs/61bi X-Received: by 2002:a17:906:d97:: with SMTP id m23mr2375590eji.392.1623805218309; Tue, 15 Jun 2021 18:00:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623805218; cv=none; d=google.com; s=arc-20160816; b=ySFUHXpx8fPyKWGEKu0oGZ2kZ1+/22itgfyBnXmbgqeepeFejUK9O86aJi0QVO1yRR cm6F2ba8NldFoqMB8gpcp4YPVJ1uWhimgEm9QAI2smuOjFaTXen5uXnceUAzjLg95KUW bHP+AkrnQ0Y7HYMel3fqPIfXVNVsLRdpIg/5bGX85/99aqf/Nr3Q2mwwaRrtuy75idnk ZRTRA5Hac6W7szT6h7SoPoPwKDWT+c7qvQuSTtI6wcq/wJWcOhJ6d7jMb1sqTCJn4Iso WibXNUMkMVlIbhQcUNB5G+yxUouyiyfqOLcXHkdqUglztuz2gwVE3IVhG1NEngi1a+tW wDvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=sMATQ7GyWZQwJhJfWC3aaXcMitby5lVuxl8Qejd0Zsg=; b=qEd4Aks91zD6ReUcCvNrhC2QkiETmunLR0ku9LOdsVJwM4wWciFvh6FaND9Twvx+4T z/qaUfDbZg4EofPIZVriJ+3PjY2l+lEN/5T7ktWo/jP+2s9hQqT4VlvF1hfv2D2LJ8Z7 raSM1sqNXFSlPU9CX/g/hbsp3QVNI4ZO75qgLqS6z81+eLhdSQkSNwWFaJ8HsWXfvj2v lx9oeSdXQfl4ARsR6gCOxSTS+sJSWALrKPK/1YDTJ/DaIvDK9fj2sey2Gmpy7A9q4PB6 yyOr/jAqEf07P50v2BwEjGMlX7+PCWJIFEl48s53yUuHZ0djzGbicqWhfBeQG5HJAUxC eUkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o8kQ/VfO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si670715ejl.2.2021.06.15.17.59.45; Tue, 15 Jun 2021 18:00:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="o8kQ/VfO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231793AbhFPA6r (ORCPT + 99 others); Tue, 15 Jun 2021 20:58:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:35946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbhFPA6q (ORCPT ); Tue, 15 Jun 2021 20:58:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C966C60FE6; Wed, 16 Jun 2021 00:56:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623805001; bh=tykSCrhMj9oIg5fZltaBtQORVAoQ00lf7s/Go9WGD9g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o8kQ/VfO6WbIfltUOrrHcjd/+jH+LBTTTLJU79jwnPsz40YyKPj1CrWWo7K/EaXzP 9JDqOsv7UgIKe46vU2Xhr2RHt0UO/EtO5HT57FhRBHWUdL8/bJxzLdUoJmttDAHJ4H ebSKEEOkepCYCVLJj/oeAQTHcjEi3FO2zwV59abQ66egiSMrNq650nm4W8xnaasRjR pxfg1prT/3FgjHQDlo3fbR4tx+i0HJLpjG/SV8Z6QVRulxeH9rUhuo4o3/IEQ2mW6P iVmb0x32LWkKPA2PYmF6u1Oc+z5Rs/TzwBt8QEJbllx53OWAZuYw43BPs/vHgigFqB 2/i28B20n+fLg== Date: Wed, 16 Jun 2021 08:56:36 +0800 From: Peter Chen To: Dmitry Osipenko Cc: Thierry Reding , Jonathan Hunter , Greg Kroah-Hartman , Felipe Balbi , Maxim Schwalm , 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 Message-ID: <20210616005636.GA19025@nchen> References: <20210613145936.9902-1-digetx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210613145936.9902-1-digetx@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 # Asus TF700T > Tested-by: Maxim Schwalm # Asus TF700T > Signed-off-by: Dmitry Osipenko > --- > 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); > + Reviewed-by: Peter Chen > utmi_phy_clk_disable(phy); > > /* PHY won't resume if reset is asserted */ > -- > 2.30.2 > -- Thanks, Peter Chen