From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F71EC001E0 for ; Wed, 19 Jul 2023 16:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbjGSQs4 (ORCPT ); Wed, 19 Jul 2023 12:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230370AbjGSQsx (ORCPT ); Wed, 19 Jul 2023 12:48:53 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 882B21BF2; Wed, 19 Jul 2023 09:48:39 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 63728FF802; Wed, 19 Jul 2023 16:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1689785317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JKDmPUsTotuvgM8MSiKrmp7WDzMVYFV4Cjd7anLXrXo=; b=Ik2teUmfo0wnP/ByQx4yLDuXDr9fSqxD0pDRf5TZXTjBH6M/k8OCT6oMi30+bfGiw0ALkP t0abRvexgfIdDy5GvQMBQ1cg92YaF+MyvZZCHxtKJ0qQPphxGn8uBpWUYDutRKL7U6btFW CY3ovATDDERETU8GW1kB5p8XdUVkjUPtjHBVuCYp9LJg/+EF2NDX7FMfn6IVQYFoFlXDNs cvSC8LKXUaV4Zg4tdGmNEByU68+XO59W8+exdE0NTOTvm1mI/dCs0I18xrHk26v3A5l2LX UrucgJTXqVZabnVYEqrhamESPEUGJXjzlgTKPeHFH3cee3MxE4i5tmJLcV/p9g== Date: Wed, 19 Jul 2023 18:48:31 +0200 From: Luca Ceresoli To: Xu Yang Cc: Francesco Dolcini , Jun Li , "devicetree@vger.kernel.org" , "festevam@gmail.com" , "gregkh@linuxfoundation.org" , "kernel@pengutronix.de" , "linux-arm-kernel@lists.infradead.org" , dl-linux-imx , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "robh+dt@kernel.org" , "s.hauer@pengutronix.de" , "shawnguo@kernel.org" , Krzysztof Kozlowski , Francesco Dolcini Subject: Re: [EXT] Re: [PATCH v2 2/3] usb: chipidea: imx: support disabling runtime-pm Message-ID: <20230719184831.75ae8658@booty> In-Reply-To: References: <20230504162312.1506763-1-luca.ceresoli@bootlin.com> <20230505120618.2f4cf22c@booty> <20230508151756.785ec07e@booty> <20230529121825.71e9b6d6@booty> <20230717184537.6d6ed607@booty> <20230718142504.075d0186@booty> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: luca.ceresoli@bootlin.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Xu, thanks for the follow up. On Wed, 19 Jul 2023 11:23:26 +0000 Xu Yang wrote: > Hi Luca, > > > -----Original Message----- > > > > Hello Xu, > > > > On Tue, 18 Jul 2023 08:31:48 +0000 > > Xu Yang wrote: > > > > > > -----Original Message----- > > > > > > > > Ciao Francesco, > > > > > > > > On Thu, 6 Jul 2023 12:23:43 +0200 > > > > Francesco Dolcini wrote: > > > > > > > > > Hello Luca, > > > > > > > > > > On Tue, May 30, 2023 at 11:22:51AM +0000, Jun Li wrote: > > > > > > Yes, your understanding is correct, talked with Xu(in CC), he will take this > > > > > > soon. > > > > > > > > > > A series was posted > > > > > > > > > > I had no time to try or look at it yet. > > > > > > > > Thanks for keeping me up to date on this topic, which is still totally > > > > relevant to me. > > > > > > > > I looked at the series, but it does not seem to be addressing the > > > > problem with USB host not detecting new devices when VBUS is not > > > > directly connected, e.g. in the Colibri imx6ull SoM. > > > > > > > > Xu, do you confirm the series at the link is _not_ solving the problem > > > > being discussed here? > > > > > > Have you tried this patchset? The upstream driver couldn't get correct > > > USB role from HW_USBPHY_CTRL register when the ID pin is float. This is > > > what this patchset is trying to fix. With this patch, condition > > > "(!vbus_is_on && !mxs_phy_is_otg_host(mxs_phy)" will always be false when > > > controller acts as host role, then __mxs_phy_disconnect_line(phy, true) > > > will never be called. So I think it doesn't matter whether VBUS is connected > > > or not when act as host mode. If you still have issue after apply this patchset, > > > please let me know. > > > > I tested this patchset on top of v6.5-rc2 and I confirm USB detection > > is still broken on the Colibri iMX6ULL. With or without the patches > > the behavior is the same: USB devices are detected only during boot, > > and anything connected after boot are never detected. > > Thanks for your feedback. As you said this issue will disappear with below change, right? > > diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c > index e1a2b2ea098b..ec5ee790455e 100644 > --- a/drivers/usb/phy/phy-mxs-usb.c > +++ b/drivers/usb/phy/phy-mxs-usb.c > @@ -178,7 +178,6 @@ static const struct mxs_phy_data imx6sx_phy_data = { > }; > > static const struct mxs_phy_data imx6ul_phy_data = { > - .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, > }; > > static const struct mxs_phy_data imx7ulp_phy_data = { Exactly. > So I guess something in __mxs_phy_disconnect_line(mxs_phy, true) is causing this behavior. > Could you please help to find which line to comment to make this issue disappear? I did some tests and detection works by doing _any_ of the following two changes (or both of them). Change 1: --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -359,10 +359,6 @@ static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) void __iomem *base = mxs_phy->phy.io_priv; u32 reg; - if (disconnect) - writel_relaxed(BM_USBPHY_DEBUG_CLKGATE, - base + HW_USBPHY_DEBUG_CLR); - if (mxs_phy->port_id == 0) { reg = disconnect ? ANADIG_USB1_LOOPBACK_SET : ANADIG_USB1_LOOPBACK_CLR; Change 2: --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -372,9 +372,6 @@ static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) } else if (mxs_phy->port_id == 1) { reg = disconnect ? ANADIG_USB2_LOOPBACK_SET : ANADIG_USB2_LOOPBACK_CLR; - regmap_write(mxs_phy->regmap_anatop, reg, - BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1 | - BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN); } if (!disconnect) I hope this clarifies something to you. Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0BF5C001E0 for ; Wed, 19 Jul 2023 16:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DL3EyWtJMO2mEJY4KYVXMt2CtZgSJQaxOA0WdgOo8wQ=; b=J6OIdYKeD7FHdJ jNcK6sRzoFRzkkTrDse/a43xwuZssF/mXFkfhQvz/HXHhNh4Y9JRkzgxzX/A3oRRF0Y5V9mlfFITW 4jnuQI19GUGQhz/ZmuerkMcs9bgvlXdhQBfivYTsmaThLFxEM/hbWYsVmueitbb9PrWkK3hsUk36C jfWVK6be1aAmRwipxaDfttm/PvMXzwwd9SFzadx27L3YyfKoNmqEpyOjmJteiaDAAGQYNbEzqAOT1 mJI1vU1h1L36RQV3DqjJjZUSuASXOLlZpVKF0yDQGnJTd4StK7kn3hLWivjOPNdf4HPeMyws4qSC8 sS+GkYB09d2NHQ6TTneA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qMAM3-008CJj-1Q; Wed, 19 Jul 2023 16:48:47 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qMALz-008CHF-3D for linux-arm-kernel@lists.infradead.org; Wed, 19 Jul 2023 16:48:46 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 63728FF802; Wed, 19 Jul 2023 16:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1689785317; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JKDmPUsTotuvgM8MSiKrmp7WDzMVYFV4Cjd7anLXrXo=; b=Ik2teUmfo0wnP/ByQx4yLDuXDr9fSqxD0pDRf5TZXTjBH6M/k8OCT6oMi30+bfGiw0ALkP t0abRvexgfIdDy5GvQMBQ1cg92YaF+MyvZZCHxtKJ0qQPphxGn8uBpWUYDutRKL7U6btFW CY3ovATDDERETU8GW1kB5p8XdUVkjUPtjHBVuCYp9LJg/+EF2NDX7FMfn6IVQYFoFlXDNs cvSC8LKXUaV4Zg4tdGmNEByU68+XO59W8+exdE0NTOTvm1mI/dCs0I18xrHk26v3A5l2LX UrucgJTXqVZabnVYEqrhamESPEUGJXjzlgTKPeHFH3cee3MxE4i5tmJLcV/p9g== Date: Wed, 19 Jul 2023 18:48:31 +0200 From: Luca Ceresoli To: Xu Yang Cc: Francesco Dolcini , Jun Li , "devicetree@vger.kernel.org" , "festevam@gmail.com" , "gregkh@linuxfoundation.org" , "kernel@pengutronix.de" , "linux-arm-kernel@lists.infradead.org" , dl-linux-imx , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , "robh+dt@kernel.org" , "s.hauer@pengutronix.de" , "shawnguo@kernel.org" , Krzysztof Kozlowski , Francesco Dolcini Subject: Re: [EXT] Re: [PATCH v2 2/3] usb: chipidea: imx: support disabling runtime-pm Message-ID: <20230719184831.75ae8658@booty> In-Reply-To: References: <20230504162312.1506763-1-luca.ceresoli@bootlin.com> <20230505120618.2f4cf22c@booty> <20230508151756.785ec07e@booty> <20230529121825.71e9b6d6@booty> <20230717184537.6d6ed607@booty> <20230718142504.075d0186@booty> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-GND-Sasl: luca.ceresoli@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230719_094844_653314_008A176C X-CRM114-Status: GOOD ( 42.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Xu, thanks for the follow up. On Wed, 19 Jul 2023 11:23:26 +0000 Xu Yang wrote: > Hi Luca, > > > -----Original Message----- > > > > Hello Xu, > > > > On Tue, 18 Jul 2023 08:31:48 +0000 > > Xu Yang wrote: > > > > > > -----Original Message----- > > > > > > > > Ciao Francesco, > > > > > > > > On Thu, 6 Jul 2023 12:23:43 +0200 > > > > Francesco Dolcini wrote: > > > > > > > > > Hello Luca, > > > > > > > > > > On Tue, May 30, 2023 at 11:22:51AM +0000, Jun Li wrote: > > > > > > Yes, your understanding is correct, talked with Xu(in CC), he will take this > > > > > > soon. > > > > > > > > > > A series was posted > > > > > > > > > > I had no time to try or look at it yet. > > > > > > > > Thanks for keeping me up to date on this topic, which is still totally > > > > relevant to me. > > > > > > > > I looked at the series, but it does not seem to be addressing the > > > > problem with USB host not detecting new devices when VBUS is not > > > > directly connected, e.g. in the Colibri imx6ull SoM. > > > > > > > > Xu, do you confirm the series at the link is _not_ solving the problem > > > > being discussed here? > > > > > > Have you tried this patchset? The upstream driver couldn't get correct > > > USB role from HW_USBPHY_CTRL register when the ID pin is float. This is > > > what this patchset is trying to fix. With this patch, condition > > > "(!vbus_is_on && !mxs_phy_is_otg_host(mxs_phy)" will always be false when > > > controller acts as host role, then __mxs_phy_disconnect_line(phy, true) > > > will never be called. So I think it doesn't matter whether VBUS is connected > > > or not when act as host mode. If you still have issue after apply this patchset, > > > please let me know. > > > > I tested this patchset on top of v6.5-rc2 and I confirm USB detection > > is still broken on the Colibri iMX6ULL. With or without the patches > > the behavior is the same: USB devices are detected only during boot, > > and anything connected after boot are never detected. > > Thanks for your feedback. As you said this issue will disappear with below change, right? > > diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c > index e1a2b2ea098b..ec5ee790455e 100644 > --- a/drivers/usb/phy/phy-mxs-usb.c > +++ b/drivers/usb/phy/phy-mxs-usb.c > @@ -178,7 +178,6 @@ static const struct mxs_phy_data imx6sx_phy_data = { > }; > > static const struct mxs_phy_data imx6ul_phy_data = { > - .flags = MXS_PHY_DISCONNECT_LINE_WITHOUT_VBUS, > }; > > static const struct mxs_phy_data imx7ulp_phy_data = { Exactly. > So I guess something in __mxs_phy_disconnect_line(mxs_phy, true) is causing this behavior. > Could you please help to find which line to comment to make this issue disappear? I did some tests and detection works by doing _any_ of the following two changes (or both of them). Change 1: --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -359,10 +359,6 @@ static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) void __iomem *base = mxs_phy->phy.io_priv; u32 reg; - if (disconnect) - writel_relaxed(BM_USBPHY_DEBUG_CLKGATE, - base + HW_USBPHY_DEBUG_CLR); - if (mxs_phy->port_id == 0) { reg = disconnect ? ANADIG_USB1_LOOPBACK_SET : ANADIG_USB1_LOOPBACK_CLR; Change 2: --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -372,9 +372,6 @@ static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) } else if (mxs_phy->port_id == 1) { reg = disconnect ? ANADIG_USB2_LOOPBACK_SET : ANADIG_USB2_LOOPBACK_CLR; - regmap_write(mxs_phy->regmap_anatop, reg, - BM_ANADIG_USB2_LOOPBACK_UTMI_DIG_TST1 | - BM_ANADIG_USB2_LOOPBACK_TSTI_TX_EN); } if (!disconnect) I hope this clarifies something to you. Luca -- Luca Ceresoli, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel