From: sashiko-bot@kernel.org
To: "Louis-Alexis Eyraud" <louisalexis.eyraud@collabora.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v4 10/10] net: stmmac: mediatek: add support for MT8189 SoC
Date: Wed, 04 Nov 2026 10:12:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-197067@kernel.org> (raw)
In-Reply-To: <20261103-dwmac-mediatek-mt8189-v4-10-c86c14fc50f4@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] net: stmmac: mediatek: rgmii_delay_max applied to MII/RMII fallback delays
- [Low] net: stmmac: mediatek: wrong delay logged in mediatek_dwmac_config_dt()
--
commit 05a1a870b144ad38c76a76fcfec8bbabb47b798b
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
net: stmmac: mediatek: add support for MT8189 SoC
This series refactors internal RX/TX clock delay handling in the MediaTek
DWMAC driver to support standard RGMII delay properties and adds support for
the MT8189 SoC.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> index 30ae0dba7fffd..07d0c186ab655 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
[ ... ]
> @@ -434,24 +492,56 @@ static int mediatek_dwmac_config_dt(struct mediatek_dwmac_plat_data *plat)
> return PTR_ERR(plat->peri_regmap);
> }
>
> - if (!of_property_read_u32(plat->np, "mediatek,tx-delay-ps", &tx_delay_ps)) {
> - if (tx_delay_ps < plat->variant->tx_delay_max) {
> - mac_delay->tx_delay = tx_delay_ps;
> - } else {
> - dev_err(plat->dev, "Invalid TX clock delay: %dps\n", tx_delay_ps);
> - return -EINVAL;
> - }
> + of_property_read_u32(plat->np, "mediatek,tx-delay-ps", &tx_delay_ps);
> + if (tx_delay_ps >= plat->variant->mii_delay_max) {
> + dev_err(plat->dev, "Invalid TX clock delay: %dps\n",
> + tx_delay_ps);
> + return -EINVAL;
> }
>
> - if (!of_property_read_u32(plat->np, "mediatek,rx-delay-ps", &rx_delay_ps)) {
> - if (rx_delay_ps < plat->variant->rx_delay_max) {
> - mac_delay->rx_delay = rx_delay_ps;
> - } else {
> - dev_err(plat->dev, "Invalid RX clock delay: %dps\n", rx_delay_ps);
> - return -EINVAL;
> - }
> + /* Read RGMII TX internal delay standard property */
> + if (of_property_read_u32(plat->np, "tx-internal-delay-ps",
> + &rgmii_tx_delay_ps)) {
> + /*
> + * standard property value not available, fallback on vendor
> + * value instead
> + */
> + rgmii_tx_delay_ps = tx_delay_ps;
> }
>
> + if (rgmii_tx_delay_ps >= plat->variant->rgmii_delay_max) {
> + dev_err(plat->dev, "Invalid RGMII TX clock delay: %dps\n",
> + rgmii_tx_delay_ps);
> + return -EINVAL;
> + }
> +
> + of_property_read_u32(plat->np, "mediatek,rx-delay-ps", &rx_delay_ps);
> + if (rx_delay_ps >= plat->variant->mii_delay_max) {
> + dev_err(plat->dev, "Invalid RX clock delay: %dps\n",
> + rx_delay_ps);
> + return -EINVAL;
> + }
> +
> + /* Read RGMII RX internal delay standard property */
> + if (of_property_read_u32(plat->np, "rx-internal-delay-ps",
> + &rgmii_rx_delay_ps)) {
> + /*
> + * standard property value not available, fallback on vendor
> + * value instead
> + */
> + rgmii_rx_delay_ps = rx_delay_ps;
> + }
> +
> + if (rgmii_rx_delay_ps >= plat->variant->rgmii_delay_max) {
[Severity: Medium]
In drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c, when
mediatek_dwmac_probe() calls mediatek_dwmac_config_dt(), will checking
rgmii_tx_delay_ps and rgmii_rx_delay_ps against
plat->variant->rgmii_delay_max unconditionally reject valid MII and RMII
configurations on SoCs where mii_delay_max is larger than rgmii_delay_max?
On MT2712, MT2712_MII_DELAY_MAX is 17600ps while MT2712_RGMII_DELAY_MAX is
5440ps:
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c:
#define MT2712_MII_DLY_STAGE_DIV 550 /* 550ps per stage */
#define MT2712_MII_DELAY_MAX 17600 /* 32 x 550ps */
#define MT2712_RGMII_DLY_STAGE_DIV 170 /* 170ps per stage */
#define MT2712_RGMII_DELAY_MAX 5440 /* 32 x 170ps */
When a board uses MII or RMII mode and specifies mediatek,tx-delay-ps or
mediatek,rx-delay-ps in the range [5440, 17600) without the RGMII-specific
tx-internal-delay-ps or rx-internal-delay-ps properties, rgmii_tx_delay_ps
and rgmii_rx_delay_ps fall back to tx_delay_ps and rx_delay_ps and then fail
the plat->variant->rgmii_delay_max check with -EINVAL.
Should the rgmii_delay_max checks only be enforced when the PHY interface
is in RGMII mode?
> + dev_err(plat->dev, "Invalid RGMII RX clock delay: %dps\n",
> + rgmii_tx_delay_ps);
> + return -EINVAL;
> + }
[Severity: Low]
In mediatek_dwmac_config_dt(), when rgmii_rx_delay_ps >=
plat->variant->rgmii_delay_max, dev_err() passes rgmii_tx_delay_ps instead
of rgmii_rx_delay_ps. Should this log rgmii_rx_delay_ps instead?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103-dwmac-mediatek-mt8189-v4-0-c86c14fc50f4@collabora.com?part=10
prev parent reply other threads:[~2026-11-04 10:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 10:12 [PATCH net-next v4 00/10] net/stmmac: Add Mediatek MT8189 support Louis-Alexis Eyraud
2026-11-03 10:12 ` [PATCH net-next v4 01/10] dt-bindings: net: mediatek-dwmac: fix unit in rx/tx delay property description Louis-Alexis Eyraud
2026-11-03 10:12 ` [PATCH net-next v4 02/10] dt-bindings: net: mediatek-dwmac: deprecate rx/tx delay vendor properties Louis-Alexis Eyraud
2026-11-04 10:55 ` Krzysztof Kozlowski
2026-11-03 10:12 ` [PATCH net-next v4 03/10] dt-bindings: net: mediatek-dwmac: add support for MT8189 SoC Louis-Alexis Eyraud
2026-11-04 10:57 ` Krzysztof Kozlowski
2026-11-03 10:12 ` [PATCH net-next v4 04/10] net: stmmac: mediatek: simplify TX/RX delay handling in mt8195_set_delay Louis-Alexis Eyraud
2026-11-03 10:12 ` [PATCH net-next v4 05/10] net: stmmac: mediatek: simplify TX/RX delay handling in mt2712_set_delay Louis-Alexis Eyraud
2026-11-03 10:12 ` [PATCH net-next v4 06/10] net: stmmac: mediatek: use standard internal delay properties Louis-Alexis Eyraud
2026-11-04 10:12 ` sashiko-bot
2026-11-03 10:12 ` [PATCH net-next v4 07/10] net: stmmac: mediatek: add RX/TX delay stage divider in platform data Louis-Alexis Eyraud
2026-11-03 10:12 ` [PATCH net-next v4 08/10] net: stmmac: mediatek: add PERI_ETH_CTRLx register offset " Louis-Alexis Eyraud
2026-11-04 10:12 ` sashiko-bot
2026-11-03 10:12 ` [PATCH net-next v4 09/10] net: stmmac: mediatek: add support for TX clock output enable feature Louis-Alexis Eyraud
2026-11-03 10:12 ` [PATCH net-next v4 10/10] net: stmmac: mediatek: add support for MT8189 SoC Louis-Alexis Eyraud
2026-11-04 10:12 ` sashiko-bot [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=sashiko-outbox-197067@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=louisalexis.eyraud@collabora.com \
--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.