Thread (17 messages) 17 messages, 3 authors, 2023-10-05

Re: [PATCH v2 08/12] net: ethernet: stmmac: stm32: support the phy-supply regulator binding

From: Andrew Lunn <andrew@lunn.ch>
Date: 2023-09-28 17:53:31
Also in: linux-devicetree, lkml, netdev

+static int phy_power_on(struct stm32_dwmac *bsp_priv, bool enable)
I find this function name confusing, since 50% of the time it does not
actually power the PHY on. You never call it with anything other than
a static true/false value. So it might was well be two functions,
phy_power_on() and phy_power_off().
+{
+	int ret;
+	struct device *dev = bsp_priv->dev;
+
+	if (!bsp_priv->regulator)
+		return 0;
+
+	if (enable) {
+		ret = regulator_enable(bsp_priv->regulator);
+		if (ret)
+			dev_err(dev, "fail to enable phy-supply\n");
Not all PHYs are usable in 0 picoseconds. You probably want a delay
here. Otherwise the first few accesses to it might not work.

      Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help