Re: [PATCH v3 2/9] phy: stm32: Add support for ST STM32MP25 USB2-FEMTO PHY

Marek Vasut <[email protected]>
Newsgroups org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-phy,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel,org.kernel.vger.linux-usb
Message-ID <[email protected]>
On 8/24/26 3:17 PM, Fabrice Gasnier wrote:

[...]

Hello Fabrice,

>> +static int stm32_usb2phy1_init(struct phy *phy)
> 
> Hello Marek,
> 
> Could same init routine may be used for both PHYs ?
> See below comment.
> 
>> +{
>> +	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) {
> 
> The only difference is here. On the PHY#1 the mode should never change
> e.g. mode == PHY_MODE_INVALID. So same routine may be used for both PHYs ?

Since there are separate ops for each PHY, I opted for avoiding this 
conditional on a PHY where the conditional makes no sense, hence the two 
separate init functions.

>> +		ret = stm32_usb2phy_set_mode(phy, phy_dev->mode, USB_ROLE_NONE);
>> +		if (ret) {
>> +			stm32_usb2phy_disable(phy_dev);
>> +			return ret;
>> +		}
>> +	}
>> +
>> +	phy_dev->is_init = true;
>> +
>> +	return 0;
>> +}
[...]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.