Devicetree
 help / color / mirror / Atom feed
From: Marek Vasut <marex@nabladev.com>
To: Fabrice Gasnier <fabrice.gasnier@foss.st.com>,
	linux-phy@lists.infradead.org
Cc: Pankaj Dev <pankaj.dev@st.com>,
	Rahul Kumar <rahul.kumar05@st.com>,
	Christian Bruel <christian.bruel@foss.st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Conor Dooley <conor+dt@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Rob Herring <robh@kernel.org>, Rosen Penev <rosenp@gmail.com>,
	Vinod Koul <vkoul@kernel.org>,
	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
Subject: Re: [PATCH v4 2/2] phy: stm32: Add support for ST STM32MP25 USB2-FEMTO PHY
Date: Wed, 2 Sep 2026 15:45:05 +0200	[thread overview]
Message-ID: <6ffc69b6-4f93-4799-a369-f71ce9d97530@nabladev.com> (raw)
In-Reply-To: <4a33230b-3e5a-4132-8467-79b864a91b99@foss.st.com>

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 !

  reply	other threads:[~2026-09-02 14:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 15:06 [PATCH v4 1/2] dt-bindings: phy: Document ST STM32MP25 USB2-FEMTO PHY Marek Vasut
2026-08-28 15:06 ` [PATCH v4 2/2] phy: stm32: Add support for " Marek Vasut
2026-08-28 15:20   ` sashiko-bot
2026-09-02  7:52   ` Fabrice Gasnier
2026-09-02 13:45     ` Marek Vasut [this message]
2026-08-31  8:47 ` [PATCH v4 1/2] dt-bindings: phy: Document " Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ffc69b6-4f93-4799-a369-f71ce9d97530@nabladev.com \
    --to=marex@nabladev.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=christian.bruel@foss.st.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=kernel@dh-electronics.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mani@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=neil.armstrong@linaro.org \
    --cc=pankaj.dev@st.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=rahul.kumar05@st.com \
    --cc=robh@kernel.org \
    --cc=rosenp@gmail.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox