Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alex Elder" <elder@riscstar.com>
Cc: bpf@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v2 02/14] net: phy: qcom: qca808x: Add regulator management
Date: Sat, 06 Jun 2026 01:01:22 +0000	[thread overview]
Message-ID: <20260606010122.E14BE1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260605010022.968612-3-elder@riscstar.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The PHY regulators are enabled during `probe()` without re-triggering a hardware reset, violating power-on sequencing, and the code incorrectly repurposes the MDIO `reset_assert_delay` as a post-power-on stabilization delay.
--

commit 7b9b83105850db948e3794f9c1593ea2fbeac999
Author: Daniel Thompson <daniel@riscstar.com>

    net: phy: qcom: qca808x: Add regulator management

This commit adds optional regulator management to the QCA8081 PHY driver.
It attempts to enable the regulators during the probe sequence.

> diff --git a/drivers/net/phy/qcom/qca808x.c b/drivers/net/phy/qcom/qca808x.c
> index 8eb51b1a006c4..fc3f2cf2e55d0 100644
> --- a/drivers/net/phy/qcom/qca808x.c
> +++ b/drivers/net/phy/qcom/qca808x.c

[ ... ]

> @@ -178,15 +179,44 @@ static void qca808x_fill_possible_interfaces(struct phy_device *phydev)
>  		__set_bit(PHY_INTERFACE_MODE_2500BASEX, possible);
>  }
>  
> +static int qca808x_power_on(struct phy_device *phydev)
> +{
> +#ifdef CONFIG_OF
> +	static const char * const regulator_names[] = {
> +		"avdd18", "vdd", "vdd18", "vdd125"
> +	};
> +	struct device *dev = &phydev->mdio.dev;
> +	u32 count = 0;
> +	int i, ret;
> +
> +	for (i = 0; i < ARRAY_SIZE(regulator_names); i++) {
> +		ret = devm_regulator_get_enable_optional(dev, regulator_names[i]);
> +		if (!ret)
> +			count++;
> +		else if (ret != -ENODEV)
> +			return ret;
> +	}
> +
> +	if (count)
> +		fsleep(phydev->mdio.reset_assert_delay);

[Severity: High]
Does this apply power to the PHY without re-asserting the hardware reset
line?

The Linux PHY framework pulses the hardware reset line (asserting and then
deasserting via phy_device_reset()) during device registration, which happens
before the driver's probe callback is invoked. By enabling the regulators
here inside probe(), power is applied while the reset line is already
deasserted, which violates standard hardware power-on sequencing and can
leave the PHY in an undefined or unstable state.

Additionally, is it safe to repurpose the MDIO reset_assert_delay for this
settling time?

This uses the reset-assert-us device tree property (meant to dictate the
minimum active pulse width of the reset signal) as a post-power-on settling
delay. If a board's device tree lacks a reset-assert-us property,
reset_assert_delay will be 0, causing fsleep(0) to return immediately. The
lack of a proper stabilization delay could cause subsequent MDIO accesses to
fail.

> +#endif
> +	return 0;
> +}
> +
>  static int qca808x_probe(struct phy_device *phydev)
>  {
>  	struct device *dev = &phydev->mdio.dev;
>  	struct qca808x_priv *priv;
> +	int ret;
>  
>  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>  	if (!priv)
>  		return -ENOMEM;
>  
> +	ret = qca808x_power_on(phydev);
> +	if (ret)
> +		return ret;
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260605010022.968612-1-elder@riscstar.com?part=2

  reply	other threads:[~2026-06-06  1:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05  1:00 [PATCH net-next v2 00/14] net: enable TC956x support Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 01/14] dt-bindings: net: qca,qca808x: Add regulator properties Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 02/14] net: phy: qcom: qca808x: Add regulator management Alex Elder
2026-06-06  1:01   ` sashiko-bot [this message]
2026-06-05  1:00 ` [PATCH net-next v2 03/14] net: pcs: pcs-xpcs-regmap: support XPCS memory-mapped MDIO bus via regmap Alex Elder
2026-06-05 15:35   ` Maxime Chevallier
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 04/14] net: pcs: xpcs: re-order xpcs_pre_config() to update after the reset Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 05/14] net: pcs: pcs-xpcs: select operating mode for 10G-baseR capable PCS Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 06/14] net: stmmac: dma: create a separate dma_device pointer Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 07/14] net: stmmac: dwxgmac2: Add multi MSI interrupt mode Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 08/14] net: stmmac: dwxgmac2: Add XGMAC 3.01a support Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 09/14] net: stmmac: dwxgmac2: export symbols for XGMAC 3.01a DMA Alex Elder
2026-06-05  1:00 ` [PATCH net-next v2 10/14] dt-bindings: net: toshiba,tc9654-dwmac: add TC9564 Ethernet bridge Alex Elder
2026-06-05  2:40   ` Rob Herring (Arm)
2026-06-05 12:24     ` Alex Elder
2026-06-05 14:40   ` Rob Herring
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 11/14] misc: tc956x_pci: add TC956x/QPS615 support Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 12/14] gpio: tc956x: " Alex Elder
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 13/14] net: stmmac: " Alex Elder
2026-06-05 14:47   ` Rob Herring
2026-06-05 16:05   ` Maxime Chevallier
2026-06-06  1:01   ` sashiko-bot
2026-06-05  1:00 ` [PATCH net-next v2 14/14] arm64: dts: qcom: qcs6490-rb3gen2: enable TC9564 with a single QCA8081 phy Alex Elder
2026-06-06  1:01   ` sashiko-bot

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=20260606010122.E14BE1F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=elder@riscstar.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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