[PATCH net-next v3 1/9] net: phy: dp83867: add regulator supply management

From: Mohd Ayaan Anwar

Date: Sat Oct 17 2026 - 05:46:59 EST


Some embedded board designs use GPIO-controlled regulators for the
DP83867 power rails. Add dp83867_power_on() to enable all four supply
domains at probe time. Absent supplies are silently skipped, so boards
that do not describe them are unaffected.

When any supply is newly enabled the driver sleeps for 200 ms before
returning. This satisfies the post power-up stabilisation requirement
mentioned in section 6.6 of the DP83867E/IS/CS datasheet.

Acked-by: Lorenzo Bianconi <lorenzo.bianconi@xxxxxxxxxxxxxxxx>
Acked-by: Andrew Davis <afd@xxxxxx>
Signed-off-by: Mohd Ayaan Anwar <mohd.anwar@xxxxxxxxxxxxxxxx>
---
I have kept the Acked-by's since the overall premise of the change
remains the same between v2 and v3, please let me know if you would like
me to remove them.
---
drivers/net/phy/dp83867.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)

diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index a3cd5cb11ea0ac108219e05d990b378483b67d7a..092bc68bb9bc6561e2457f596206453dd84e56fc 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -16,6 +16,7 @@
#include <linux/etherdevice.h>
#include <linux/bitfield.h>
#include <linux/nvmem-consumer.h>
+#include <linux/regulator/consumer.h>

#include <dt-bindings/net/ti-dp83867.h>

@@ -730,11 +731,42 @@ static int dp83867_resume(struct phy_device *phydev)
return 0;
}

+static int dp83867_power_on(struct phy_device *phydev)
+{
+ static const char * const supply_names[] = {
+ "vdda-2p5", "vdd-1p0", "vdda-1p8", "vddio",
+ };
+ struct device *dev = &phydev->mdio.dev;
+ bool supplies_enabled = false;
+ int i, ret;
+
+ for (i = 0; i < ARRAY_SIZE(supply_names); i++) {
+ ret = devm_regulator_get_enable_optional(dev, supply_names[i]);
+ if (ret == -ENODEV)
+ continue;
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to enable %s supply\n",
+ supply_names[i]);
+ supplies_enabled = true;
+ }
+
+ /* Datasheet section 6.6 suggests a 200ms post power-up stabilization */
+ if (supplies_enabled)
+ fsleep(200000);
+
+ return 0;
+}
+
static int dp83867_probe(struct phy_device *phydev)
{
struct dp83867_private *dp83867;
int ret;

+ ret = dp83867_power_on(phydev);
+ if (ret)
+ return ret;
+
dp83867 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83867),
GFP_KERNEL);
if (!dp83867)

--
2.34.1