Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mohd.anwar@oss.qualcomm.com
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
Subject: Re: [PATCH net-next v4 02/10] net: phy: dp83867: add regulator supply management
Date: Fri, 20 Nov 2026 11:45:54 +0000	[thread overview]
Message-ID: <179517515449.3136.10802254198110142730@kernel.org> (raw)
In-Reply-To: <20261117-shikra_ethernet-v4-2-c41902e5f2fa@oss.qualcomm.com>

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

  reply	other threads:[~2026-11-20 11:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  8:45 [PATCH net-next v4 00/10] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-11-17  8:45 ` [PATCH net-next v4 01/10] dt-bindings: net: ti,dp83867: add supply properties Mohd Ayaan Anwar
2026-11-18 18:58   ` Rob Herring (Arm)
2026-11-17  8:45 ` [PATCH net-next v4 02/10] net: phy: dp83867: add regulator supply management Mohd Ayaan Anwar
2026-11-20 11:45   ` netdev-bot+sashiko [this message]
2026-11-17  8:45 ` [PATCH net-next v4 03/10] dt-bindings: net: qcom,ethqos: add qcom,shikra-ethqos compatible Mohd Ayaan Anwar
2026-11-18 19:07   ` Rob Herring
2026-11-20 11:45   ` netdev-bot+sashiko
2026-11-17  8:45 ` [PATCH net-next v4 04/10] net: stmmac: qcom-ethqos: convert ethqos_rgmii_macro_init() to void Mohd Ayaan Anwar
2026-11-17  8:45 ` [PATCH net-next v4 05/10] net: stmmac: qcom-ethqos: add DLL-bypass for PHY-managed RGMII delays Mohd Ayaan Anwar
2026-11-20 11:45   ` netdev-bot+sashiko
2026-11-17  8:45 ` [PATCH net-next v4 06/10] net: stmmac: qcom-ethqos: set initial RGMII link clock to lowest speed Mohd Ayaan Anwar
2026-11-18  9:13   ` Lorenzo Bianconi
2026-11-17  8:45 ` [PATCH net-next v4 07/10] net: stmmac: qcom-ethqos: share common GMAC4 address table Mohd Ayaan Anwar
2026-11-17  8:45 ` [PATCH net-next v4 08/10] net: stmmac: qcom-ethqos: add per-platform NOC clock voting Mohd Ayaan Anwar
2026-11-18  9:40   ` Lorenzo Bianconi
2026-11-17  8:45 ` [PATCH net-next v4 09/10] net: stmmac: qcom-ethqos: add Shikra EMAC support Mohd Ayaan Anwar
2026-11-18  9:43   ` Lorenzo Bianconi
2026-11-20 11:46   ` netdev-bot+sashiko
2026-11-17  8:45 ` [PATCH net-next v4 10/10] net: stmmac: qcom-ethqos: add QCS615 " Mohd Ayaan Anwar
2026-11-18  9:44   ` Lorenzo Bianconi
2026-11-20 11:46   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179517515449.3136.10802254198110142730@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=afd@ti.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andersson@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mohd.anwar@oss.qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox