Thread (34 messages) flat view 34 messages, 4 authors, 25d ago

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

From: Marek Vasut <hidden>
Date: 2026-08-25 09:48:17
Also in: linux-devicetree, linux-phy, linux-usb, lkml

On 8/24/26 3:17 PM, Fabrice Gasnier wrote:

[...]

Hello Fabrice,
quoted
+static int stm32_usb2phy1_init(struct phy *phy)
Hello Marek,

Could same init routine may be used for both PHYs ?
See below comment.
quoted
+{
+	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.
quoted
+		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;
+}
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help