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 69A74C624D6 for ; Wed, 2 Sep 2026 14:01:17 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RhAXtkH+IucqYF4KZV14KRKgMLKrzSkrKGp2Yuk7vZk=; b=hJMZ1jN6zC43uU u6RJY96FAbB+6UL9W3TFBpZOCSZV3QpuWNq1f73ezOcDIah/K+P2sM9jiflL3yfYG0ZoTfMxZ49mu 6HB5sH47r4iE86sv7AkgRFrZ8lKtLdTgw9yHnqKVIplhwN/iMAVF0h5eCt9o3F2QnmXyrExjvY30l acgJbsTI+zqINxcjOJi+o/0VmOJ80+3coEwrfNBsTh3jAuBB+iohGeRenPZzAwps86/ldl4bXgRXc tH6HSe4UYoKNVjs/S1JzbJ6o4OMTrd0p0z+Njap1Rfc3iiuiP/bsfND7h1RO5w8FEbVlvNZnGHC4u x/HaOKwyW3PTtmh/9bgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1lWe-0000000EsUR-16Gn; Wed, 02 Sep 2026 14:01:16 +0000 Received: from mx.nabladev.com ([2a00:f820:417:0:178:251:229:89]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1lWb-0000000EsTl-2tam; Wed, 02 Sep 2026 14:01:15 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id CB580116285; Wed, 02 Sep 2026 16:00:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nabladev.com; s=dkim; t=1788357666; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=UBvLVixT6RLkfZb5JmChiUQYBB/FY97zNKMHPqvta4I=; b=c0vhFCUm60JhACOaILD6cYJwpBpRswO/i3lqu56CVr/czbBMgUfZFhRhbswuSBOvFcrnt5 umsfz3gNoE3y+FnfJ725bec1sYgvHj2t1SqJVD/kdEkf1hGQBn/uqXfm5NDB0KPZbgL/4L CTSBib66XoXyCKoCsMikTAIk9LokJgaqTN/1d44C2d1aHp2PQ5eHeXdoNYSoWFifK7bXyk bzuIEEq++2YUKG7ID8qeLFFn2yZ9jC3/VeID1XIl++kMZdccFMXY12U0+Q8saPOwPsPkA1 qcldKnPecGK9avgb+c4COn2TAIRkF/ucNtNpYd2RtxyB3CZnCnlfkasnOhLK5w== Message-ID: <6ffc69b6-4f93-4799-a369-f71ce9d97530@nabladev.com> Date: Wed, 2 Sep 2026 15:45:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/2] phy: stm32: Add support for ST STM32MP25 USB2-FEMTO PHY To: Fabrice Gasnier , linux-phy@lists.infradead.org Cc: Pankaj Dev , Rahul Kumar , Christian Bruel , Alexandre Torgue , Conor Dooley , Krzysztof Kozlowski , Manivannan Sadhasivam , Maxime Coquelin , Neil Armstrong , Patrice Chotard , Rob Herring , Rosen Penev , Vinod Koul , devicetree@vger.kernel.org, kernel@dh-electronics.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com References: <20260828150739.174460-1-marex@nabladev.com> <20260828150739.174460-2-marex@nabladev.com> <4a33230b-3e5a-4132-8467-79b864a91b99@foss.st.com> Content-Language: en-US From: Marek Vasut In-Reply-To: <4a33230b-3e5a-4132-8467-79b864a91b99@foss.st.com> X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260902_070113_948587_47718242 X-CRM114-Status: GOOD ( 12.37 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org On 9/2/26 9:52 AM, Fabrice Gasnier wrote: [...] >> +static int stm32_usb2phy_set_mode(struct phy *phy, enum phy_mode mode, int submode) >> +{ >> + struct stm32_usb2phy *phy_dev = phy_get_drvdata(phy); >> + u32 mask = SYSCFG_USB2PHY2CR_USB2PHY2CMN | >> + SYSCFG_USB2PHY2CR_VBUSVALID | >> + SYSCFG_USB2PHY2CR_VBUSVLDEXT; >> + u32 val = 0; >> + int ret; >> + >> + if (mode == PHY_MODE_USB_HOST) { >> + if (submode != USB_ROLE_NONE) >> + val = SYSCFG_USB2PHY2CR_VBUSVALID; >> + } else if (mode == PHY_MODE_USB_DEVICE) { >> + val = SYSCFG_USB2PHY2CR_USB2PHY2CMN | >> + SYSCFG_USB2PHY2CR_VBUSVLDEXTSEL; >> + if (submode != USB_ROLE_NONE) >> + val |= SYSCFG_USB2PHY2CR_VBUSVLDEXT; >> + mask |= SYSCFG_USB2PHY2CR_VBUSVLDEXTSEL; >> + } else { >> + return -EINVAL; >> + } >> + >> + ret = regmap_update_bits(phy_dev->regmap, phy_dev->cr_offset, mask, val); >> + if (ret) >> + return ret; >> + >> + phy_dev->mode = mode; > > Hello Marek, > > The 'mode' is used typically when exiting low power mode. Should keep > track of the submode too here. See next comment. > >> + >> + return 0; >> +} >> + >> +static int stm32_usb2phy1_init(struct phy *phy) >> +{ >> + struct stm32_usb2phy *phy_dev = phy_get_drvdata(phy); >> + int ret; >> + >> + ret = stm32_usb2phy_enable(phy_dev); >> + if (ret) >> + return ret; >> + >> + phy_dev->is_init = true; >> + >> + return 0; >> +} >> + >> +static int stm32_usb2phy2_init(struct phy *phy) >> +{ >> + struct stm32_usb2phy *phy_dev = phy_get_drvdata(phy); >> + int ret; >> + >> + ret = stm32_usb2phy_enable(phy_dev); >> + if (ret) >> + return ret; >> + >> + if (phy_dev->mode != PHY_MODE_INVALID) { >> + ret = stm32_usb2phy_set_mode(phy, phy_dev->mode, USB_ROLE_NONE); > > This part restores the mode, when existing from low power: Controller > driver (dwc3) calls phy_init/power_on. The submode should be restored > too here, instead of USB_ROLE_NONE. Will do in V5, thanks ! -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy