mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: paul.louvel@bootlin.com
Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, maxime.chevallier@bootlin.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com, miquel.raynal@bootlin.com,
	herve.codina@bootlin.com
Subject: Re: [PATCH net-next v2 4/4] net: phy: marvell: add RGMII-to-Copper mode configuration
Date: Thu, 19 Nov 2026 06:29:11 +0000	[thread overview]
Message-ID: <179506975119.3136.5908839389379097437@kernel.org> (raw)
In-Reply-To: <20261116-marvell-phy-rgmii-v2-4-e04dca67e89a@bootlin.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

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

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).

- [High] This patch breaks the SFP-removal (serdes disable) path.
- [Medium] The new RGMII config_init path does not achieve its stated
  purpose ('Add code in m88e1510_config_init() to configure the device')…

--

net: phy: marvell: add RGMII-to-Copper mode configuration

With this commit, m88e1510_config_init() programs the RGMII-to-Copper mode
in GEN_CTRL_REG_1 when the PHY interface is RGMII. It also adds a check to
m88e1510_config_mode() so that an RGMII request does not overwrite an RGMII
media mode already present in the register.

> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index a72d307eaf12c..9748fdd843ffd 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -1341,6 +1341,23 @@ static int m88e1510_config_mode(struct phy_device *phydev, u16 mode)
>  	if (oldpage < 0)
>  		goto error;
>  
> +	ret = __phy_read(phydev, MII_88E1510_GEN_CTRL_REG_1);
> +	if (ret < 0)
> +		goto error;
> +
> +	if (mode == MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII) {
> +		switch (FIELD_GET(MII_88E1510_GEN_CTRL_REG_1_MODE_MASK, ret)) {
> +		case MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII:
> +		case MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII_1000X:
> +		case MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII_100FX:
> +		case MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII_SGMII:
> +			ret = 0;
> +			goto error;
> +		default:
> +			break;
> +		}
> +	}

[Severity: High]
This check sits in the shared helper. Does it also change the SFP removal
path in m88e1510_port_configure_serdes()?

When an SFP module is inserted, phy_sfp_module_insert() calls
configure_mii(port, true, iface). That writes RGMII_1000X, RGMII_100FX or
RGMII_SGMII into the mode field. On removal the call chain is:

phy_sfp_module_remove()
  m88e1510_port_configure_serdes(port, false, PHY_INTERFACE_MODE_NA)
    mode = MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII;
    m88e1510_config_mode(phydev, mode)

The register still holds one of the serdes modes at that point. The new
switch matches it, sets ret = 0 and jumps to error. That skips both the
__phy_modify() of the mode field and the MII_88E1510_GEN_CTRL_REG_1_RESET
soft reset.

Does that leave the PHY in RGMII-to-fiber/SGMII mode after the module is
removed, even though the caller sees success?

On resume or re-attach, m88e1510_config_init() also requests MODE_RGMII for
RGMII interfaces, so it would hit the same early return. Is a hardware
reset the only way to get back to copper mode?

Before this patch, the disable path always wrote MODE_RGMII and then did
the soft reset.

Could this be decided explicitly, through a caller argument or driver
state, instead of from the current register value?

>  	ret = __phy_modify(phydev, MII_88E1510_GEN_CTRL_REG_1,
>  			   MII_88E1510_GEN_CTRL_REG_1_MODE_MASK, mode);
>  	if (ret < 0)
> @@ -1403,9 +1420,11 @@ static int m88e1510_config_init(struct phy_device *phydev)
>  	if (err < 0)
>  		return err;
>  
> -	/* SGMII-to-Copper mode initialization */
> +	/* RGMII/SGMII-to-Copper mode initialization */
>  	if (phydev->interface == PHY_INTERFACE_MODE_SGMII)
>  		err = m88e1510_config_mode(phydev, MII_88E1510_GEN_CTRL_REG_1_MODE_SGMII);
> +	else if (phy_interface_is_rgmii(phydev))
> +		err = m88e1510_config_mode(phydev, MII_88E1510_GEN_CTRL_REG_1_MODE_RGMII);

[Severity: Medium]
The commit message says:

    Do not overwrite the media interface mode configured via
    m88e1510_port_configure_serdes().

However, the check in m88e1510_config_mode() only looks at the hardware
mode field. It keeps any RGMII_1000X, RGMII_100FX or RGMII_SGMII value,
whoever wrote it.

Suppose an RGMII board comes up with GEN_CTRL_REG_1[2:0] already set to one
of those values. The source could be the bootloader, strapping, or state
left over across kexec or a driver rebind. Would this call then skip both
the mode write and the soft reset, and leave the PHY out of copper mode?

As written, the new RGMII call seems to take effect only when the field
reads 0x1 or 0x5-0x7. Is that intended?

The driver does not record whether the serdes mode came from
m88e1510_port_configure_serdes(). Could that be tracked in driver state so
the code does what the commit message describes? The same change would
also fix the SFP removal issue above.

>  	if (err < 0)
>  		return err;
>

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-marvell-phy-rgmii-v2-0-e04dca67e89a%40bootlin.com

      parent reply	other threads:[~2026-11-19  6:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 15:27 [PATCH net-next v2 0/4] " Paul Louvel
2026-11-16 15:27 ` [PATCH net-next v2 1/4] net: phy: marvell: move mode configuration into standalone function Paul Louvel
2026-11-17  2:02   ` Andrew Lunn
2026-11-16 15:27 ` [PATCH net-next v2 2/4] net: phy: marvell: de-duplicate mode initialization code Paul Louvel
2026-11-17  2:03   ` Andrew Lunn
2026-11-16 15:27 ` [PATCH net-next v2 3/4] net: phy: marvell: factor out EEE errata initialization Paul Louvel
2026-11-17  2:04   ` Andrew Lunn
2026-11-19  6:29   ` netdev-bot+sashiko
2026-11-16 15:27 ` [PATCH net-next v2 4/4] net: phy: marvell: add RGMII-to-Copper mode configuration Paul Louvel
2026-11-18  8:20   ` Maxime Chevallier
2026-11-19  6:29   ` netdev-bot+sashiko [this message]

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=179506975119.3136.5908839389379097437@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=herve.codina@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paul.louvel@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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

all inboxes | Powered by JetHome®