ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alastair D'Silva" <alastair@d-silva.org>
Cc: conor+dt@kernel.org, linux-sunxi@lists.linux.dev,
	devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next 2/4] net: phy: Add Allwinner AC300 EPHY driver
Date: Thu, 17 Sep 2026 04:42:31 +0000	[thread overview]
Message-ID: <20260917044232.100981F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260916044119.475666-3-alastair@d-silva.org>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] net: phy: ac300: leaked PHY page state on error paths
- [High] net: phy: ac300: race condition in paged PHY register access
- [Medium] pm: incorrect PHY suspend sequence causes MDIO operations on powered-down device
--

commit f19e9d7452b2e059755510b20bf6ea442e025e0f
Author: Alastair D'Silva <alastair@d-silva.org>

net: phy: Add Allwinner AC300 EPHY driver

Adds support for the Allwinner AC300 integrated Fast Ethernet Physical
Layer (EPHY) co-packaged on Allwinner H616 and H618 SoCs.

> diff --git a/drivers/net/phy/ac300-phy.c b/drivers/net/phy/ac300-phy.c
> new file mode 100644
> index 0000000000000..c70f567c31794
> --- /dev/null
> +++ b/drivers/net/phy/ac300-phy.c

[ ... ]

> +static int ac300_phy_config_init(struct phy_device *phydev)
> +{
> +	struct ac300_phy_priv *priv = phydev->priv;
> +	int ret;
> +
> +	/* Write page-based EPHY transceiver and signal path optimizations */
> +	ret = phy_write(phydev, 0x1f, 0x0100); /* Switch to Page 1 */
> +	if (ret)
> +		return ret;
> +	ret = phy_write(phydev, 0x12, 0x4824); /* Disable APS */

[Severity: High]
Can a concurrent MDIO operation interleave during this unlocked window?
phy_write() internally acquires and immediately releases the shared mdio_lock
for each individual register access. This leaves the MDIO bus unlocked between
the page switch and the data write. Should the driver hold mdio_lock across
the entire page manipulation sequence, or implement the .write_page callback
and use phy_write_paged() instead?

> +	if (ret)
> +		return ret;

[Severity: High]
If a transient MDIO error occurs and triggers this early return, does this
leave the PHY permanently stuck on Page 1 instead of restoring it to Page 0?
Subsequent PHY operations, including generic link status polling like
genphy_read_status(), assume the PHY is on Page 0 and might read garbage data
if left on the wrong page.

> +
> +	ret = phy_write(phydev, 0x1f, 0x0200); /* Switch to Page 2 */

[ ... ]

> +static int ac300_phy_suspend(struct phy_device *phydev)
> +{
> +	int ret;
> +
> +	ret = ac300_phy_disable(phydev);
> +	if (ret)
> +		return ret;
> +	return genphy_suspend(phydev);

[Severity: Medium]
Will genphy_suspend() fail or produce warnings when called here?
ac300_phy_disable() powers down and resets the PHY, but genphy_suspend()
subsequently issues standard IEEE MDIO writes to MII_BMCR to set BMCR_PDOWN.
Should genphy_suspend() be called while the hardware is still active, before
powering it down?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916044119.475666-1-alastair@d-silva.org?part=2

  parent reply	other threads:[~2026-09-17  4:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  4:41 [PATCH net-next 0/4] net: Add Allwinner H616/H618 EMAC1 and AC300 EPHY support Alastair D'Silva
2026-09-16  4:41 ` [PATCH net-next 1/4] dt-bindings: net: phy: Add Allwinner AC300 EPHY binding Alastair D'Silva
2026-09-16 14:49   ` Andrew Lunn
2026-09-16 15:22   ` Rob Herring (Arm)
2026-09-17  4:42   ` sashiko-bot
2026-09-16  4:41 ` [PATCH net-next 2/4] net: phy: Add Allwinner AC300 EPHY driver Alastair D'Silva
2026-09-16 15:05   ` Andrew Lunn
2026-09-17  4:42   ` sashiko-bot [this message]
2026-09-16  4:41 ` [PATCH net-next 3/4] dt-bindings: net: allwinner,sun8i-a83t-emac: Add Allwinner H616 EMAC1 and syscon index Alastair D'Silva
2026-09-16 15:22   ` Rob Herring (Arm)
2026-09-17  4:42   ` sashiko-bot
2026-09-16  4:41 ` [PATCH net-next 4/4] net: stmmac: dwmac-sun8i: Add Allwinner H616 EMAC clock index and internal PHY support Alastair D'Silva
2026-09-16  6:24   ` Maxime Chevallier
2026-09-16  6:29     ` James Hilliard
2026-09-16  6:45     ` Alastair D'Silva
2026-09-16  6:47     ` Andre Przywara
2026-09-17  4:42   ` sashiko-bot
2026-09-16  4:56 ` [PATCH net-next 0/4] net: Add Allwinner H616/H618 EMAC1 and AC300 EPHY support Chen-Yu Tsai
2026-09-16  5:12   ` James Hilliard
2026-09-16  6:49     ` Alastair D'Silva
2026-09-16  7:06       ` Maxime Chevallier
2026-09-16  8:02         ` Alastair D'Silva

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=20260917044232.100981F00898@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alastair@d-silva.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sunxi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox