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

Marek Vasut marex at nabladev.com
Mon Aug 24 07:53:23 PDT 2026


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;
>> +}
[...]



More information about the linux-arm-kernel mailing list