Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3287257pxj; Mon, 14 Jun 2021 20:02:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhVn2IrKt0Xf0Jv3YEI7juef0bjYpiqOjS4WiQskyObmChjQwo88/2H2mciou7Sla8LWY3 X-Received: by 2002:a05:6e02:12:: with SMTP id h18mr16886580ilr.265.1623726159182; Mon, 14 Jun 2021 20:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623726159; cv=none; d=google.com; s=arc-20160816; b=hmhu1R06hBo4n5dm6lew9oerqLfz2PMOcSgg5p9ILEvpGhi4IxBa7DiG6gWjY/eXG5 cGRoBSajPokL1EHDrATQzxmWaANXqO6xjF/unbvhWcOQdLVT5QWwVmWSjEX+evfq9DIo 25/8SIfhpfBRjjB64yms6eEN5XsYlo93zW8lsFZKX/1viI2V3yMoXhUHNa8Yh9Jg6dua uQlQXujKWUtPtOQfv1E7Dpk/STy5N1HHedAQUrvzuFfIEDNvOG3ToLYleMdH6zR8b9ZQ LiGeoTkKODda7NdbUUbEsE/XulQmJjht6FLNqRIOSFD+ThDPeT3zZCPoroLRf6X8YBYH 476A== 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=chiRllxLY0/MR4JJc9kwztoVWGGuV9dvsgcd6/BA83c=; b=M0H2+ufI0GXsXX6/u6xTE1F6LxaLA3vmToJhbIyH6L8Jkd2qBiVdVg65bIVwMVhMTA hnxGHo2skB9SqBJu7XUlsTQkkYuFp60uUs+cGSO5jGomJ4Uh9BOz2CuqffPnfbTnEi6p cBCRNJplrdqPG6Mv+OXqRWOZhzc6G75FSilx3dcxrv6lE2dcJ8S2EyWeGfrPeX9giQ71 /Oj+o1l1/mj2EdjVM6E7Eeh9BvH+Dfg4vf52RuZQ0/uTDZCfzX5mDJHhyp+sfrdUNJ0h g2Cg/gJvHiIdXHkRDTQyURML5mzxDK+KXlonI1yuTCRxqx5AS+FXUb9Q7NJafdRnRiD2 2Pdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FtZQP1L3; 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 q4si18711387ilv.85.2021.06.14.20.02.26; Mon, 14 Jun 2021 20:02:39 -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=FtZQP1L3; 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 S230358AbhFODDj (ORCPT + 99 others); Mon, 14 Jun 2021 23:03:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:51134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbhFODDh (ORCPT ); Mon, 14 Jun 2021 23:03:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D5E20611AB; Tue, 15 Jun 2021 01:05:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623719122; bh=JowlqCnPSb4zz316zjuQPncCWVeSVEJsJRR6AJAI1SE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FtZQP1L3wOJJQ3lQRa2yCPA79Dj1fEvpClc3UBsJNhL/ydK/dIdi7RAXlq7aiHl+4 KfxN293mMtTchVS+AZCvuFFNolo8Ho3YA/csiLLs/rM0TFwmZ5TFbAEL2xFmZV77wJ Lj9LtrZ9R+GmIRRpcJB4TAhJT2HfvoPSanuCBJ37oK5Gatmx5as3Rh0Nphj7EsY5ur Src7pu9r2MT+7RboovQmnX18jreeLiLL15t86RVaJqI6EP8OzSOYIQJCaOZK/yR38+ baN7BwXVOiIRVCDve3dDel5iX7uBs6V7hjVoaGp4q1DPqgu4igQvGw6TXXPexDuGAd Q/5DntGx/u5iw== Date: Tue, 15 Jun 2021 09:05:16 +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: <20210615010516.GA28352@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); > + Where will clear VBUS_WAKEUP_STS? Or it will be cleared by HW after VBUS lower than B Session Valid? -- Thanks, Peter Chen