Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3287666pxj; Mon, 14 Jun 2021 20:03:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfKhPUpGoFIuoIixNgGKtRQmcRFQ3DDRqn9OZhxj0qsFRjFcGtY1nodmRp+duY6A/RoM0S X-Received: by 2002:a5e:c64c:: with SMTP id s12mr16003810ioo.3.1623726201302; Mon, 14 Jun 2021 20:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623726201; cv=none; d=google.com; s=arc-20160816; b=sUvwyeFqbhuvUO9QiZ459ytcvgERrdvEcGHmBidF29OkoCrtBgo6LADD5KLWpZj5HD y9vEEqlEDNQWijTtPhPJHfI1P5+rlKYlVzgNploq0yYO1ZUgHn643rTZf+q4Cn6pfZ17 j78FoChR51hmN5bNffqXUuRtNBH0oHHLaDXcKr6wM+4YXcmwxNabcp4YKgBXdc/hp5qp iT9aUqLK7ocUONwv+MpL75yTtmO3E4e4sCI+1TAN8FJLROTkH5YD3zVKsqkVPMraHl6K 1kWbnfLxU/ybVgEPIj9vNvBRbefDoLuU3MeU+VXKryLvS+Bem9nM4yL/aJGwZSybLv5k Dpxw== 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=ea/HyGc1JFkxIPK4v4FfEELpVnFRQN6by7gcUSW7S3I=; b=dbdTksiWLXSVNy/i0VsgxTvPX5txYf+y/a4JcctTwe3hsrD57/tpiEew0Ik/7fGZKN MPIhfpygkH9otY/44CUN31yHTUg1bGXsVKY+fuzNXrDhI/irdfqf39QHAyguofNsibdl i5MsDkF0D0n8Sn51497Gyd4a83GP7B1lMLb6eBtREisvWXwse674U14TzejLQ9RCQSsl 1cVVR6E1VBxDy/o3D0Ajsph7g5NifRoZ7IBS7iqxwIY8xH1/zlrw2nYW7RuvjQwF2xHk LUHprn9kvVKwe/VdmxP3juX0p8Suw+DL7d6+jlk86rRP6BbGptY2aBvP5YVTgfVcT1+e cDFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cI0ZAUKH; 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 b19si21731386iow.46.2021.06.14.20.03.08; Mon, 14 Jun 2021 20:03:21 -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=cI0ZAUKH; 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 S230225AbhFODDh (ORCPT + 99 others); Mon, 14 Jun 2021 23:03:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:51132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbhFODDh (ORCPT ); Mon, 14 Jun 2021 23:03:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45500613BF; Tue, 15 Jun 2021 01:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623719165; bh=5nFeD8wP5nu+m9jfAlQJ3IU5zCr3m3wHffbBI/kxC+g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cI0ZAUKHSteG8ONkxc/ThavDvsqJrcD7JO88Gz0X6tpJrYNU2wmC/2o/xkDa/y6j9 iJ9Gqybh+cDoKlXzAVCKsS9rHrBF5jFABJQtk1r6rtL4b6jS1brCwgIYKV28I5Qwjr VzM0WzzU+ezTwKaz1JMLDneEq61gkoynFFKhD7ohJ07ygzltuie4V0sxPFZW920cuI EoapArbKqYaii6i4hOQ8LKXWphvea2grXo+uOKXbd8TAGSogP/NAj0dnQK6lPCxvB/ E/ihC2iZt7F+2jXHzsd/tEEpgzmeHJcG+K3lHpsJUS9XVhtGABjWwR4gZF+3yqqKTG +l7y6DGl/8XTg== Date: Tue, 15 Jun 2021 09:06:00 +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: <20210615010600.GB28352@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 Reviewed-by: Peter Chen > --- > 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); > + > utmi_phy_clk_disable(phy); > > /* PHY won't resume if reset is asserted */ > -- > 2.30.2 > -- Thanks, Peter Chen