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 v3 7/9] net: stmmac: mediatek: use TX clock phase shift in RGMII mode with 1Gbps speed
Date: Sat, 17 Oct 2026 10:32:17 +0000 [thread overview]
Message-ID: <sashiko-outbox-175461@kernel.org> (raw)
In-Reply-To: <20261016-dwmac-mediatek-mt8189-v3-7-25daf2bbcf35@collabora.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: stmmac: mediatek: TX clock inversion is unintentionally cleared at 1Gbps
--
commit 1240293d7bdcca392029932327a2063871dd1b83
Author: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
net: stmmac: mediatek: use TX clock phase shift in RGMII mode with 1Gbps speed
This patch introduces a callback to set the TX clock phase shift in the RGMII
mode for 1Gbps speeds on MT8195. Because the hardware delay macro circuit can
be affected by external factors, the new logic overrides the delay settings
with a more stable 2ns fixed delay after link speed negotiation.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> index 7dd46cd5a49e1..4b2d5280f7030 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
[ ... ]
> @@ -430,9 +433,65 @@ static int mt8195_set_delay(struct mediatek_dwmac_plat_data *plat)
> return 0;
> }
>
> +static void mt8195_fix_mac_speed(void *priv, phy_interface_t interface,
> + int speed, unsigned int mode)
> +{
> + struct mediatek_dwmac_plat_data *priv_plat = priv;
> + const struct mediatek_dwmac_variant *variant;
> + struct mac_delay_struct *mac_delay;
> + u32 tx_delay_stage_val, reg_offset;
> + u32 reg_val = 0;
> +
> + if (!priv_plat)
> + return;
> +
> + mac_delay = &priv_plat->mac_delay;
> + variant = priv_plat->variant;
> +
> + if (!mac_delay->tx_delay ||
> + (interface != PHY_INTERFACE_MODE_RGMII &&
> + interface != PHY_INTERFACE_MODE_RGMII_RXID))
> + return;
> +
> + /*
> + * When link speed is 1Gbps with RGMII interface, and a TX internal
> + * delay needs to be applied on MAC, prefer to override the delay
> + * settings with a 2ns fixed delay which is controlled by
> + * RGMII_TXC_PHASE_CTRL. Otherwise, fallback to HW delay macro circuit
> + * for 10/100Mbps link speeds.
> + */
> + if (speed == SPEED_1000) {
> + reg_val = MT8195_RGMII_TXC_PHASE_CTRL;
[Severity: Medium]
When the link negotiates to 1Gbps and a non-zero tx_delay is configured, does
this omit the MT8195_DLY_GTXC_INV bit from reg_val?
Because the update mask in the regmap_update_bits() call includes
MT8195_DLY_GTXC_INV, omitting it here will forcefully clear the clock
inversion bit in the hardware register.
If tx_delay is 0 but tx_inv is true, the function returns early and preserves
the inversion bit set during probe. Is it intended that clock inversion at
1Gbps is dropped only when a non-zero TX delay is configured?
> + } else {
> + if (variant->tx_rgmii_delay_stage_div) {
> + tx_delay_stage_val = mac_delay->tx_delay /
> + variant->tx_rgmii_delay_stage_div;
> + } else {
> + tx_delay_stage_val = 0;
> + }
> +
> + reg_val |= FIELD_PREP(MT8195_DLY_GTXC_ENABLE,
> + !!tx_delay_stage_val);
> + reg_val |= FIELD_PREP(MT8195_DLY_GTXC_STAGES,
> + tx_delay_stage_val);
> + reg_val |= FIELD_PREP(MT8195_DLY_GTXC_INV,
> + mac_delay->tx_inv);
> + }
> +
> + reg_offset = variant->peri_eth_ctrl_offset + MT8195_PERI_ETH_CTRL0;
> + regmap_update_bits(priv_plat->peri_regmap,
> + reg_offset,
> + MT8195_RGMII_TXC_PHASE_CTRL |
> + MT8195_DLY_GTXC_ENABLE |
> + MT8195_DLY_GTXC_INV |
> + MT8195_DLY_GTXC_STAGES,
> + reg_val);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261016-dwmac-mediatek-mt8189-v3-0-25daf2bbcf35@collabora.com?part=7
next prev parent reply other threads:[~2026-10-17 10:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 10:31 [PATCH net-next v3 0/9] net/stmmac: Add Mediatek MT8189 support Louis-Alexis Eyraud
2026-10-16 10:31 ` [PATCH net-next v3 1/9] dt-bindings: net: mediatek-dwmac: fix unit in rx/tx delay property description Louis-Alexis Eyraud
2026-10-16 15:33 ` Andrew Lunn
2026-10-16 10:31 ` [PATCH net-next v3 2/9] dt-bindings: net: mediatek-dwmac: add support for MT8189 SoC Louis-Alexis Eyraud
2026-10-16 15:40 ` Andrew Lunn
2026-10-16 10:31 ` [PATCH net-next v3 3/9] net: stmmac: mediatek: simplify TX/RX delay handling in mt8195_set_delay Louis-Alexis Eyraud
2026-10-16 10:31 ` [PATCH net-next v3 4/9] net: stmmac: mediatek: simplify TX/RX delay handling in mt2712_set_delay Louis-Alexis Eyraud
2026-10-17 10:32 ` sashiko-bot
2026-10-16 10:31 ` [PATCH net-next v3 5/9] net: stmmac: mediatek: add RX/TX delay stage divider in platform data Louis-Alexis Eyraud
2026-10-16 11:37 ` Maxime Chevallier
2026-10-17 10:32 ` sashiko-bot
2026-10-16 10:31 ` [PATCH net-next v3 6/9] net: stmmac: mediatek: add PERI_ETH_CTRLx register offset " Louis-Alexis Eyraud
2026-10-16 10:31 ` [PATCH net-next v3 7/9] net: stmmac: mediatek: use TX clock phase shift in RGMII mode with 1Gbps speed Louis-Alexis Eyraud
2026-10-16 11:41 ` Maxime Chevallier
2026-10-16 15:48 ` Andrew Lunn
2026-10-17 10:32 ` sashiko-bot [this message]
2026-10-16 10:31 ` [PATCH net-next v3 8/9] net: stmmac: mediatek: add support for TX clock output enable feature Louis-Alexis Eyraud
2026-10-16 10:31 ` [PATCH net-next v3 9/9] net: stmmac: mediatek: add support for MT8189 SoC Louis-Alexis Eyraud
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-175461@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.