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/1383…%40yahoo.com