Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: namiltd@yahoo.com
Cc: linusw@kernel.org, andrew@lunn.ch, olteanv@gmail.com,
	kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, linux@armlinux.org.uk, luizluca@gmail.com,
	maxime.chevallier@bootlin.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, alvin.sipraga@analog.com,
	gusfmora@gmail.com, kuncy7@gmail.com, fabianotassotti@gmail.com,
	gabonpivovich@gmail.com, contact@c127.dev,
	o.rempel@pengutronix.de
Subject: Re: [PATCH net-next v18 05/15] net: dsa: realtek: rtl8365mb: set RGMII mode for family D
Date: Wed, 02 Dec 2026 23:58:51 +0000	[thread overview]
Message-ID: <179625593152.3146.8730462280005903743@kernel.org> (raw)
In-Reply-To: <266ef365-4cbf-47c4-b92c-16d2935a44d2@yahoo.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] On family D EXT1, rtl8365mb_ext_config_rgmii()
  (drivers/net/dsa/realtek/rtl8365mb_main.c) sets TOP_CON0.MAC7_SEL_EXT1…

--

net: dsa: realtek: rtl8365mb: set RGMII mode for family D

On family D, this patch sets up the EXT1 pad drive and slew controls,
clears the EXT1 RGMII TX delay field, binds the shared pins to MAC7 and
disables SerDes 1 before it selects RGMII. It also stops advertising
RGMII on port 7 in phylink_get_caps() when MAC4 already owns the EXT1
pins.

> diff --git a/drivers/net/dsa/realtek/rtl8365mb_main.c b/drivers/net/dsa/realtek/rtl8365mb_main.c
> index 5c2e47074de4b..e239894392410 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_main.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_main.c

[ ... ]

> @@ -1279,6 +1310,54 @@ static int rtl8365mb_ext_config_rgmii(struct realtek_priv *priv, int port,
>  	if (ret)
>  		return ret;
>  
> +	if (rtl8365mb_is_d(priv) && extint->id == 1) {

[ ... ]

> +		/* Bind the RGMII/MII pins to MAC7. MAC4 does not own them:
> +		 * RGMII is not advertised otherwise, see
> +		 * rtl8365mb_phylink_get_caps().
> +		 */
> +		ret = regmap_update_bits(priv->map,
> +					 RTL8365MB_D_REG_TOP_CON0,
> +					 RTL8365MB_D_MAC7_SEL_EXT1_MASK,
> +					 RTL8365MB_D_MAC7_SEL_EXT1_MASK);
> +		if (ret)
> +			return ret;
> +
> +		ret = regmap_update_bits(priv->map,
> +					 RTL8365MB_D_REG_SDS1_MISC0,
> +					 RTL8365MB_D_SDS_MISC_MODE_FIELD_MASK,
> +					 RTL8365MB_D_PORT_SDS_MODE_DISABLE);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	ret = regmap_update_bits(
>  		priv->map, RTL8365MB_DIGITAL_INTERFACE_SELECT_REG(extint->id),
>  		RTL8365MB_DIGITAL_INTERFACE_SELECT_MODE_MASK(extint->id),

[Severity: Low]
Should SerDes 1 be disabled before TOP_CON0.MAC7_SEL_EXT1 is set, and not
after?

The commit message says:

  The TX delay field, the pin mux and the SerDes 1 disable are all
  programmed before RGMII is selected, so the shared pins are never
  driven by RGMII and SerDes 1 at the same time.

That only holds if the EXT1 nibble of DIGITAL_INTERFACE_SELECT is not
already RGMII when rtl8365mb_ext_config_rgmii() is entered. Nothing here
reads or clears that nibble first. After rtl8365mb_reset_chip() its value
comes from straps or EEPROM, and the commit message itself says the
driver should not rely on those defaults.

If that nibble is already RGMII and SerDes 1 is enabled, the pins are
owned by both MAC7 RGMII and SerDes 1 between the TOP_CON0 write and the
SDS1_MISC0 write.

There is a second way to end up in the same state. If the SDS1_MISC0
regmap_update_bits() fails, the function returns with the pins muxed to
MAC7 and SerDes 1 still enabled, and the TOP_CON0 change is not undone.
The caller only logs the failure and returns void:

rtl8365mb_phylink_mac_config() {
    ...
		ret = rtl8365mb_ext_config_rgmii(priv, port, state->interface);
		if (ret)
			dev_err(priv->dev,
				"failed to configure RGMII mode on port %d: %pe\n",
				port, ERR_PTR(ret));
		return;
    ...
}

phylink then goes on to mac_link_up() with the pins in that state.

If the SDS1_MISC0 write is moved ahead of the TOP_CON0 write, the window
is gone whatever the entry state is. A failure part way through would
then leave the pins with no owner instead of two.

Whether such a strap state exists, and whether brief contention matters
physically, depends on hardware behaviour that could not be checked
against the vendor RTL8367D API. Even so, the guarantee in the commit
message seems stronger than the code provides.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/1383a67b-15e4-4c76-8bbf-65d3cbfa1fc1%40yahoo.com

  reply	other threads:[~2026-12-02 23:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1383a67b-15e4-4c76-8bbf-65d3cbfa1fc1.ref@yahoo.com>
2026-12-01 23:48 ` [PATCH net-next v18 00/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-12-01 23:50   ` [PATCH net-next v18 01/15] dt-bindings: net: dsa: realtek: add RTL8367S-VB Mieczyslaw Nalewaj
2026-12-01 23:51   ` [PATCH net-next v18 02/15] net: dsa: realtek: rtl8365mb: add chip family infrastructure Mieczyslaw Nalewaj
2026-12-01 23:51   ` [PATCH net-next v18 03/15] net: dsa: realtek: rtl8365mb: refactor forcemode handling Mieczyslaw Nalewaj
2026-12-01 23:51   ` [PATCH net-next v18 04/15] net: dsa: realtek: rtl8365mb: set speed for family D Mieczyslaw Nalewaj
2026-12-01 23:51   ` [PATCH net-next v18 05/15] net: dsa: realtek: rtl8365mb: set RGMII mode " Mieczyslaw Nalewaj
2026-12-02 23:58     ` netdev-bot+sashiko [this message]
2026-12-01 23:51   ` [PATCH net-next v18 06/15] net: dsa: realtek: rtl8365mb: refactor VLAN 4k handling Mieczyslaw Nalewaj
2026-12-01 23:51   ` [PATCH net-next v18 07/15] net: dsa: realtek: rtl8365mb: add VLAN 4k/IVL for family D Mieczyslaw Nalewaj
2026-12-02 23:58     ` netdev-bot+sashiko
2026-12-01 23:51   ` [PATCH net-next v18 08/15] net: dsa: realtek: rtl8365mb: refactor PVID handling Mieczyslaw Nalewaj
2026-12-01 23:55   ` [PATCH net-next v18 09/15] net: dsa: realtek: rtl8365mb: use raw VID for PVID on family D Mieczyslaw Nalewaj
2026-12-01 23:55   ` [PATCH net-next v18 10/15] net: dsa: realtek: rtl8365mb: add family D SDS13 PCS support Mieczyslaw Nalewaj
2026-12-02 23:58     ` netdev-bot+sashiko
2026-12-01 23:56   ` [PATCH net-next v18 11/15] net: dsa: realtek: rtl8365mb: refactor L2 MAC handling Mieczyslaw Nalewaj
2026-12-01 23:56   ` [PATCH net-next v18 12/15] net: dsa: realtek: rtl8365mb: make L2/LUT access work on family D Mieczyslaw Nalewaj
2026-12-02 23:58     ` netdev-bot+sashiko
2026-12-01 23:56   ` [PATCH net-next v18 13/15] net: dsa: realtek: rtl8365mb: refactor QoS priority handling Mieczyslaw Nalewaj
2026-12-01 23:56   ` [PATCH net-next v18 14/15] net: dsa: realtek: rtl8365mb: use PCP numbering on family D Mieczyslaw Nalewaj
2026-12-01 23:56   ` [PATCH net-next v18 15/15] net: dsa: realtek: rtl8365mb: add support for RTL8367S-VB Mieczyslaw Nalewaj
2026-12-02 23:58     ` 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=179625593152.3146.8730462280005903743@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=alvin.sipraga@analog.com \
    --cc=andrew@lunn.ch \
    --cc=contact@c127.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fabianotassotti@gmail.com \
    --cc=gabonpivovich@gmail.com \
    --cc=gusfmora@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kuncy7@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=luizluca@gmail.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=namiltd@yahoo.com \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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