🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19801

Re: [PATCH net-next v4 02/10] net: phy: dp83867: add regulator supply management

#19801
From: netdev-bot+sashiko
Date: Fri, 20 Nov 2026 11:45
171 lines
14576 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 2

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The supplies are only enabled from the phy_driver probe
  (dp83867_probe() -> dp83867_power_on(), drivers/net/phy/dp83867.c:769…
- [Low] The commit message says "When any supply is newly enabled the
  driver sleeps for 200 ms".
- [Low] dp83867_power_on() turns on the DP83867 rails after phylib has
  already released the PHY's reset GPIO.

--

net: phy: dp83867: add regulator supply management

This adds dp83867_power_on(), called at the start of dp83867_probe(). It
enables up to four optional supplies (vdda-2p5, vdd-1p0, vdda-1p8, vddio)
with devm_regulator_get_enable_optional(). If any supply is described, the
driver then sleeps 200 ms for the post power-up stabilisation time given
in datasheet section 6.6.

> diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
> index b4b4931c6f8ce..ed8b3089e8e0b 100644
> --- a/drivers/net/phy/dp83867.c
> +++ b/drivers/net/phy/dp83867.c

[ ... ]

> @@ -730,11 +731,45 @@ 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;
> +
> +	if (!IS_ENABLED(CONFIG_REGULATOR))
> +		return 0;
> +
> +	for (i = 0; i < ARRAY_SIZE(supply_names); i++) {
> +		ret = devm_regulator_get_enable_optional(dev, supply_names[i]);

[Severity: Low]
How does this interact with boards that describe both reset-gpios and
these switched rails? By the time dp83867_probe() runs, phylib has already
released the PHY reset line twice:

phy_device_register()
    phy_device_reset(phydev, 0);

phy_probe()
    phy_device_reset(phydev, 0);
    ...
    err = phydev->drv->probe(phydev);
        dp83867_probe()
            dp83867_power_on()
                devm_regulator_get_enable_optional()

So the reset pulse and its reset-deassert-us wait happen while the PHY is
unpowered. The rails then come up with RESET_N already high, and the PHY
depends on its internal power-on reset. That may well be tolerated, but
the reset pulse described for the board has no effect.

There is also the gap between phy_device_register() and the supply enable
in probe, which can be long if the regulator provider defers. During that
time the deasserted reset GPIO drives a high level into a chip whose VDDIO
domain may still be off. Could that back-power the chip through its pin
protection diodes?

Would it make sense to call phy_device_reset(phydev, 1) before enabling
the supplies and phy_device_reset(phydev, 0) after the stabilisation
delay?

> +		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);

[Severity: Low]
The commit message says:

    When any supply is newly enabled the driver sleeps for 200 ms before
    returning.

Is that accurate? supplies_enabled is set for every described supply where
devm_regulator_get_enable_optional() returns 0. The regulator core returns
0 whether or not the rail was already on, for example with
regulator-always-on, regulator-boot-on, a rail shared with another
consumer, or a rail left on by the bootloader.

So the 200 ms sleep runs on every probe of any board that describes at
least one supply. It also runs again on each re-probe after a later
-EPROBE_DEFER from dp83867_of_init(), such as the nvmem cell lookup in
dp83867_of_init_io_impedance().

Should the code check regulator_is_enabled() before enabling? Or should
the commit message say the delay applies whenever any supply is
described?

> +
> +	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;

[Severity: Medium]
Is this reached when the rails start out off? dp83867_probe() only runs
after the MDIO core has created a phy_device and matched it by PHY ID.

If the PHY node has no ethernet-phy-idXXXX.XXXX compatible, that ID is
read from the PHY over MDIO before any driver code runs:

of_mdiobus_register()
  __of_mdiobus_parse_phys()
    of_mdiobus_register_phy()
      fwnode_mdiobus_register_phy()
        if (is_c45 || fwnode_get_phy_id(child, &phy_id))
            phy = get_phy_device(bus, addr, is_c45);
          get_phy_c22_id()
            if ((*phy_id & 0x1fffffff) == 0x1fffffff)
                return -ENODEV;

The GPIO-controlled rails can be off at scan time, either because the
hardware defaults them off or because a non-boot-on fixed regulator has
already driven its enable GPIO low. In that case the ID reads back as all
ones and __of_mdiobus_parse_phys() only logs:

    "MDIO device at address %d is missing.\n"

No phy_device is created. dp83867_probe() and dp83867_power_on() never
run, so the supplies are never enabled and the PHY is never detected.

The companion binding patch "dt-bindings: net: ti,dp83867: add supply
properties" allows the four supply properties on a node that only
requires reg, and its example has no compatible. With the ID compatible,
fwnode_mdiobus_register_phy() calls phy_device_create() and skips the
MDIO read.

Should the binding require, or at least document, the
ethernet-phy-id2000.a231 compatible when supplies are described?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117-shikra_ethernet-v4-0-c41902e5f2fa%40oss.qualcomm.com
Technical Details
Message-ID: <179517515449.3136.10802254198110142730@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367908-linux-kernel-netdev=dewy.ru
References: <20261117-shikra_ethernet-v4-2-c41902e5f2fa@oss.qualcomm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367908-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 02/10] net: phy: dp83867: add regulator supply
 management
Date: Fri, 20 Nov 2026 11:45:54 +0000
Organization: Usenet Network
Message-ID: <179517515449.3136.10802254198110142730@kernel.org>
References: <20261117-shikra_ethernet-v4-2-c41902e5f2fa@oss.qualcomm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3149462"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:cjsqmi6KcMMHt1tqg5BYVpMxHF8= sha256:tskd9E9UfQvLorqqB/fp1k7jqm5E4GaiRD+43ZjimCw=
	sha1:DBb3w36btqyYBFlhb5mqoqrxy0w= sha256:C/146mY9RdLXti3+GFZXlCuOAKdKfoFyXRkcbLy8om4=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 5EED3115990; Fri, 20 Nov 2026 14:51:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.3
X-Spam-Status: No, score=-2.3 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id EUckujSG722I;
	Fri, 20 Nov 2026 14:51:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-367908-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 4FA79115946; Fri, 20 Nov 2026 14:51:34 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 83493E661D; Fri, 20 Nov 2026 11:46:36 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795175162;
	b=qjtx8N/gvKOpTa43Qz4vi84ESTSRFZ7eV9C0Ld4bBImxLqTKXQrzAEV/wbJx/I5h2ygV
	 ZO8cPbSCy9dF828WpZfr55DT/G4ryk7GyUYelZk2MqEgHtTmHBxqbBpxsjuihGypKqrty
	 Fs17hKLN8fS7hssHrMYpywCqeAqfevXbTQvRGJuxOBHvdupxmIjZtSv0FtvsqoHdmZmlu
	 DhOTex29AO/en5s2Ccgwpq+6ivEEX1NiP/8JDRsBoo1MzFWXemFqjLkMfw4d9Av0BCDfJ
	 wqQqtzlfaMQVxWV+zbesxUKfXuYLN1PlLIU1xImV9dznb0YOuhkgMR8POq3w+SVnnGg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795175162;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=cXx0a8LeeD7MJwMvVRKUDaLbCvneP22P9q9pHTmM+cc=;
	b=Ie/yUms4R8wunJi847bMBatH5ow/hSGLJSs02fWktaF0vSm66nnl6nGYPN1CDU2kYICQ
	 hVbdPcf2ZGxQn6pfhHCbeIGC8DbqbqzS9MQS70doFiFvFBA/VBHqoAItiBTbmAhrd2T6d
	 a8nPtrAhTflg3oD7M5XfKnYqE/BbN0gn5+sTFTKLhZzHAB5jwiEkAZhoD7UOa4WhJ+4NO
	 uCY/1DbKvGngKmG23U0laeEBcJUU7g53x8TKfZTTvr6nC0j3blOo/TlhOkMg0wbfJciZR
	 KJjQCKlPXAnEOUohTS36k+fbZFrbdYsHEq1lA7KUBWg8hkDLLe1Taa6XXJTyogQz1yg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MkPJ+L1W;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 96E3860A263A;
	Fri, 20 Nov 2026 11:46:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MkPJ+L1W
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795175156;
	b=DtNsRFg1W9C8nEzM82dAhCxVYljnabnbl+zCd8CO8WqO/FhjYI9htPyATg8ARb2ulVwJ
	 2B+SVOv+VSuTWk+Kljj2gdrpujj6dL2cOeLmZDD1NXClS9UK/xwKo6YkLnd/y3NWE2Qbr
	 7V6AYQoZVuMdNZDim6H0RTYTOVaDvLyVJSpLomf83LGIpR04GePWlp2GmCuN/t895U4ad
	 Mt4dtNTDyhwtk6xP8LzzxUNwNHho4O/338LkjFuNkTGnpvMcSg26ryU7Ijufd8wT/ZyYq
	 u69o7nyuA+SnIF1hYz+ITVt4IHkbkgJNIrOrSPJnVg1voolk6pPyqlfi30L22MUNKlQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795175156;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=cXx0a8LeeD7MJwMvVRKUDaLbCvneP22P9q9pHTmM+cc=;
	b=QnLkUDm2sBspTJlMiLiB/nk2iJ/3VczaxQUVZ+s4NBJIpPEQuvd6bvTM9MQCl4HWrlRm
	 Trfan+t7ybWuudG0suWQUyKMW29/uPpYJxYBULvzJSe9+EKdELmdaPQ+KYEkdEYkofnpL
	 e5ZHRagvSMy9Iyn+KwhAIbTtvRlMRmRzGf6WM2/3S/P23OfbNSCepvre6gvFjrv9BVInH
	 NmNFwWHX5rcgefk22xhLwUdwXsG964zbGVLyzvqMN6wJrbggF6VMZoYW07gP3A1Kkblon
	 vorFv6hX0hQm1mAzK6DRqfZJMNOnoy69ZrE/gBeX5PC3oFK/brmxbzG4gxMmm/1IlbQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MkPJ+L1W;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B436A606A32A;
	Fri, 20 Nov 2026 11:45:56 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B5A1F000C0;
	Fri, 20 Nov 2026 11:45:54 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795175156;
	bh=cXx0a8LeeD7MJwMvVRKUDaLbCvneP22P9q9pHTmM+cc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=MkPJ+L1WgTP5flX1Nr9XFJoUwfmWlpy89lNoJbZ5mpEXF2XlNG+vQcMKEJEzS7lUu
	 ZiYY4eZDfGWBBScPEop3t3gZb4219h0+lGg0rQJy6tux/+rD7SlCH+y70d3PZ326ex
	 YpvSZY2sEO/IiFYzysdRgCeqDn+FTNe/+SyOWd/eLZWbrlkwI+axdGu08zBhcMt8nl
	 E5+K7QnqlmVajSR2+3S5atXOJIZ/+6KGix2fb08PYp/1tJ8xvKvdMrqFgVxatnoZGN
	 25f+jsJmtoeUCMG8TykV2LieBQAIbWWurLXH3HLbnkAx0K2Arqn0DmT3Ih03/chHQy
	 TwUK/cisfvlug==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
 conor+dt@kernel.org, afd@ti.com, andrew@lunn.ch, hkallweit1@gmail.com,
 linux@armlinux.org.uk, richardcochran@gmail.com, andersson@kernel.org,
 konradybcio@kernel.org, alexandre.torgue@foss.st.com, peppe.cavallaro@st.com,
 joabreu@synopsys.com, maxime.chevallier@bootlin.com,
 mcoquelin.stm32@gmail.com, lorenzo.bianconi@oss.qualcomm.com,
 netdev@vger.kernel.org, devicetree@vger.kernel.org,
 linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
 linux-stm32@st-md-mailman.stormreply.com,
 linux-arm-kernel@lists.infradead.org
X-In-Reply-To: <20261117-shikra_ethernet-v4-2-c41902e5f2fa@oss.qualcomm.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list