All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "James Hilliard" <james.hilliard1@gmail.com>
Cc: lee@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	mfd@lists.linux.dev, robh@kernel.org
Subject: Re: [PATCH net-next v2 6/8] net: phy: add X-Powers AC300 EPHY control driver
Date: Thu, 06 Aug 2026 02:32:36 +0000	[thread overview]
Message-ID: <20260806023237.69DCE1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804-submit-acx00-of-dynamic-v1-v2-6-3eef49ff1d8c@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unconditional assertion of CHIP_RESET on first power-on wipes external-supply configuration.
--

--- Patch [6]: [PATCH net-next v2 6/8] net: phy: add X-Powers AC300 EPHY control driver ---
commit 22de676d43131faa2cdf14d10397704b51076320
Author: James Hilliard <james.hilliard1@gmail.com>

net: phy: add X-Powers AC300 EPHY control driver

This commit adds an MDIO control driver for the Fast Ethernet PHY in the
X-Powers AC300 companion IC. It programs the PHY calibration, interface mode,
clock, and I/O controls.

diff --git a/drivers/net/phy/xpowers-ac300-ctl.c b/drivers/net/phy/xpowers-ac300-ctl.c
--- /dev/null
+++ b/drivers/net/phy/xpowers-ac300-ctl.c

[ ... ]

> +static int ac300_ephy_ctl_power_on(struct acx00_ephy_control *control,
> +				   unsigned int phy_addr)
> +{
> +	struct ac300_ephy_ctl *priv =
> +		container_of(control, struct ac300_ephy_ctl, control);

[ ... ]

> +	ret = clk_prepare_enable(priv->clk);
> +	if (ret)
> +		goto out_unlock;
> +	priv->powered = true;
> +
> +	/* Keep the external-supply configuration across subsequent resets. */
> +	reset_value = priv->package_known && !priv->internal_dldo ?
> +		      AC300_CHIP_RESET_DEASSERT : 0;
> +	ret = mdiodev_write(priv->mdiodev, AC300_SYS_CONTROL_REG, reset_value);

[Severity: High]
Does this code inadvertently wipe the external-supply configuration on the
first probe?

When ac300_ephy_ctl_power_on() is called for the first time,
priv->package_known is false because it is zero-initialized by
devm_kzalloc().

This causes reset_value to evaluate to 0, which is then written to
AC300_SYS_CONTROL_REG, unconditionally asserting CHIP_RESET for all package
types before the package status is ever read.

[ ... ]

> +static int ac300_ephy_ctl_probe(struct mdio_device *mdiodev)
> +{

[ ... ]

> +	priv->control.power_on = ac300_ephy_ctl_power_on;
> +	priv->control.power_off = ac300_ephy_ctl_power_off;
> +	priv->control.set_interface = ac300_ephy_ctl_set_interface;
> +	/* MII is the reset default used until the MAC supplies its interface. */
> +	priv->interface = PHY_INTERFACE_MODE_MII;
> +	mdiodev_set_drvdata(mdiodev, &priv->control);
> +
> +	/* Validate the package while the control endpoint is known to respond. */
> +	phy_addr = ac300_ephy_ctl_link_addr(priv);
> +	ret = ac300_ephy_ctl_power_on(&priv->control, phy_addr);

[Severity: High]
Could this first call to ac300_ephy_ctl_power_on() trigger the destructive
reset mentioned above?

Since priv->package_known is still false at this point during the probe,
the driver seems to wipe out the configuration it intends to preserve.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260804-submit-acx00-of-dynamic-v1-v2-0-3eef49ff1d8c@gmail.com?part=6

  parent reply	other threads:[~2026-08-06  2:32 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05  2:26 [PATCH net-next v2 0/8] net: phy: add X-Powers AC200/AC300 EPHY support James Hilliard
2026-08-05  2:26 ` James Hilliard
2026-08-05  2:26 ` [PATCH net-next v2 1/8] dt-bindings: net: x-powers: add AC200 EPHY control James Hilliard
2026-08-05  2:26   ` James Hilliard
2026-08-06  2:32   ` sashiko-bot
2026-08-05  2:27 ` [PATCH net-next v2 2/8] dt-bindings: mfd: x-powers: add AC200 James Hilliard
2026-08-05  2:27   ` James Hilliard
2026-08-06  2:32   ` sashiko-bot
2026-08-05  2:27 ` [PATCH net-next v2 3/8] mfd: add X-Powers AC200 support James Hilliard
2026-08-05  2:27   ` James Hilliard
2026-08-06  2:32   ` sashiko-bot
2026-08-05  2:27 ` [PATCH net-next v2 4/8] net: phy: add X-Powers AC200 EPHY control driver James Hilliard
2026-08-05  2:27   ` James Hilliard
2026-08-06  2:32   ` sashiko-bot
2026-08-06  9:19   ` Jagielski, Jedrzej
2026-08-06  9:19     ` Jagielski, Jedrzej
2026-08-05  2:27 ` [PATCH net-next v2 5/8] dt-bindings: net: x-powers: add AC300 EPHY control James Hilliard
2026-08-05  2:27   ` James Hilliard
2026-08-05  3:38   ` Rob Herring (Arm)
2026-08-05  3:38     ` Rob Herring (Arm)
2026-08-05 14:17   ` Rob Herring
2026-08-05 14:17     ` Rob Herring
2026-08-06  1:36     ` James Hilliard
2026-08-06  1:36       ` James Hilliard
2026-08-06  2:32   ` sashiko-bot
2026-08-05  2:27 ` [PATCH net-next v2 6/8] net: phy: add X-Powers AC300 EPHY control driver James Hilliard
2026-08-05  2:27   ` James Hilliard
2026-08-05 12:22   ` Andrew Lunn
2026-08-05 12:22     ` Andrew Lunn
2026-08-06  2:32   ` sashiko-bot [this message]
2026-08-06  9:20   ` Jagielski, Jedrzej
2026-08-06  9:20     ` Jagielski, Jedrzej
2026-08-05  2:27 ` [PATCH net-next v2 7/8] dt-bindings: net: x-powers: add AC200/AC300 EPHY James Hilliard
2026-08-05  2:27   ` James Hilliard
2026-08-06  2:32   ` sashiko-bot
2026-08-05  2:27 ` [PATCH net-next v2 8/8] net: phy: add X-Powers AC200/AC300 EPHY driver James Hilliard
2026-08-05  2:27   ` James Hilliard
2026-08-05 12:37   ` Andrew Lunn
2026-08-05 12:37     ` Andrew Lunn
2026-08-06  1:28     ` James Hilliard
2026-08-06  1:28       ` James Hilliard
2026-08-06  9:21       ` Jagielski, Jedrzej
2026-08-06  9:21         ` Jagielski, Jedrzej
2026-08-06  2:32   ` 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=20260806023237.69DCE1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=james.hilliard1@gmail.com \
    --cc=lee@kernel.org \
    --cc=mfd@lists.linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.