🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16348

Re: [PATCH net-next v5 10/10] net: stmmac: mediatek: add support for MT8189 SoC

#16348
From: netdev-bot+sashiko
Date: Sat, 14 Nov 2026 14:52
134 lines
13346 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

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

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

- [Medium] For MT8189, mt8189_gmac_variant sets .mac_txclk_out_en = true
  (line 465).
- [Low] This patch makes the driver use a 180 ps step and a 5760 ps limit
  (MT8189_MII_DLY_STAGE_DIV / MT8189_MII_DELAY_MAX / MT8189_RGMII_*) for…

--

net: stmmac: mediatek: add support for MT8189 SoC

This adds MT8189 support to dwmac-mediatek. It reuses the MT8195
interface and delay helpers, with a pericfg offset of 0x270 and 180ps
delay stages. It also enables the TX clock output feature for this SoC.

> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> index 1a0ab95dfbf0e..ce232313014d2 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
> @@ -42,8 +42,15 @@
>  #define MT2712_RGMII_DELAY_MAX		5440 /* 32 x 170ps */
>  
>  /* Peri Configuration register for mt8189 */
> +#define MT8189_PERI_ETH_CTRL_OFFSET	0x270
> +
>  #define MT8189_CTRL0_TXC_OUT_OP_EN	BIT(20)
>  
> +#define MT8189_MII_DLY_STAGE_DIV	180  /* 180ps per stage */
> +#define MT8189_MII_DELAY_MAX		5760 /* 32 x 180ps */
> +#define MT8189_RGMII_DLY_STAGE_DIV	180  /* 180ps per stage */
> +#define MT8189_RGMII_DELAY_MAX		5760 /* 32 x 180ps */

[Severity: Low]
This isn't a bug, but should the DT binding document these MT8189
values?

Documentation/devicetree/bindings/net/mediatek-dwmac.yaml already
accepts mediatek,mt8189-gmac. The descriptions of mediatek,tx-delay-ps
and mediatek,rx-delay-ps give a step and range only for MT2712 and
MT8188/MT8195:

      For MT8188/MT8195 RGMII/RMII/MII interface, Allowed value need to be a multiple of 290,
      or will round down. Range 0~31*290.

With this patch, mediatek_dwmac_config_dt() rejects MT8189 TX/RX
delays >= 5760ps with -EINVAL:

    if (tx_delay_ps >= plat->variant->mii_delay_max) {

Smaller values are rounded down to multiples of 180ps. The binding does
not describe either rule.

Could the binding get a matching line, for example "For MT8189
RGMII/RMII/MII interface, Allowed value need to be a multiple of 180, or
will round down. Range 0~31*180."?

> +
>  /* Peri Configuration register for mt8195 */
>  #define MT8195_PERI_ETH_CTRL_OFFSET	0xFD0
>  

[ ... ]

> @@ -440,6 +451,20 @@ static int mt8195_set_delay(struct mediatek_dwmac_plat_data *plat)
>  	return 0;
>  }
>  
> +static const struct mediatek_dwmac_variant mt8189_gmac_variant = {
> +	.dwmac_set_phy_interface = mt8195_set_interface,
> +	.dwmac_set_delay = mt8195_set_delay,
> +	.clk_list = mt8189_dwmac_clk_l,
> +	.num_clks = ARRAY_SIZE(mt8189_dwmac_clk_l),
> +	.dma_bit_mask = 35,
> +	.mii_delay_max = MT8189_MII_DELAY_MAX,
> +	.rgmii_delay_max = MT8189_RGMII_DELAY_MAX,
> +	.mii_delay_stage_div = MT8189_MII_DLY_STAGE_DIV,
> +	.rgmii_delay_stage_div = MT8189_RGMII_DLY_STAGE_DIV,
> +	.peri_eth_ctrl_offset = MT8189_PERI_ETH_CTRL_OFFSET,
> +	.mac_txclk_out_en = true,

[Severity: Medium]
Is it safe to enable TXC output in every interface mode?

mt8195_set_interface() sets the bit whenever mac_txclk_out_en is true.
It does not check phy_intf_sel or plat->rmii_rxc:

    if (plat->variant->mac_txclk_out_en)
        intf_val |= MT8189_CTRL0_TXC_OUT_OP_EN;

In MII mode the PHY drives TX_CLK, so TXC is an input to the MAC.

On MT8189 the binding forbids mediatek,rmii-clk-from-mac, so in RMII
mode the reference clock always comes from the PHY. Without
mediatek,rmii-rxc, that clock arrives on TXC. The driver says so in
mt8195_set_delay():

    /* the rmii reference clock from outside is connected
     * to TXC pin, the reference clock will be adjusted
     * by TXC delay macro circuit.
     */

The previous patch in the series describes this bit as enabling "the TX
clock signal output". If that means the TXC pad output driver, could
the MAC end up driving a line the PHY is already driving, in MII mode
and in RMII mode with the reference clock on TXC?

The register is rewritten on every resume through mediatek_dwmac_init(),
so the setting persists.

The bit might be gated by ETH_INTF_SEL in hardware. Without a datasheet
that can't be confirmed from the tree. Should the bit be set only in
RGMII modes, where the MAC sources TXC? Or could the commit message
explain why it is harmless in MII and RMII?

> +};
> +
>  static const struct mediatek_dwmac_variant mt8195_gmac_variant = {
>  	.dwmac_set_phy_interface = mt8195_set_interface,
>  	.dwmac_set_delay = mt8195_set_delay,

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110-dwmac-mediatek-mt8189-v5-0-7d99d6292962%40collabora.com
Technical Details
Message-ID: <179466793724.2199510.14479564782627569884@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363316-linux-kernel-netdev=dewy.ru
References: <20261110-dwmac-mediatek-mt8189-v5-10-7d99d6292962@collabora.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363316-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v5 10/10] net: stmmac: mediatek: add support for
 MT8189 SoC
Date: Sat, 14 Nov 2026 14:52:17 +0000
Organization: Usenet Network
Message-ID: <179466793724.2199510.14479564782627569884@kernel.org>
References: <20261110-dwmac-mediatek-mt8189-v5-10-7d99d6292962@collabora.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1591973"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:SHYeS+LjAQ46gF/WsvGExCSyT68= sha256:Tmq+kH0ZoLzSpqCBbbC0FRChQJhXKHLei7q/KwvLZtU=
	sha1:UJ1edhGfSov1C3YGeyXdR4oTKjE= sha256:fQvmyTajsextq9eUJ7uRfVsXnRh4i7/bN7PlMyBxwlg=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 94ED0114838; Sat, 14 Nov 2026 17:53:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.3
X-Spam-Status: No, score=-2.3 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id TJ5UBop--OLZ;
	Sat, 14 Nov 2026 17:53:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-363316-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id F34EA11482E; Sat, 14 Nov 2026 17:53:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 1782F477B8; Sat, 14 Nov 2026 14:52:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794667945;
	b=Yw7OZxP3f+xfjzCUfvLChH8r1gmEAnuuvlN61Id6Hytu6AVHBxmvGvy0lazlhWhfhg3c
	 JalC7H2jDBBlZ9dpj8TQfrioU1qAo4J4Wc4ikma67RWuBzC40/1malD4GOeDhjAlkoHue
	 INXmFCooEy+IAiEbo6/gslwLNtnMSFdjxF4MSIT1DHrGQoibpWT7hQWHQL1DvYgFBRKtj
	 vaWrrLsjPcOObSYMowLWZUFpj9nrI4Z8bpeaH6/J8gN72jxqI8F3WQc7WqLwqWsSHOk8p
	 dGsLI/EmT+PbR0B795CE9zDgBKHO3SGMrTRDhew7rNo+OWjHzQCkFOYfs/XkU1o68ag==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794667945;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=Stxf2y23tK03Or3qwqdcinc2HKFkBV1bom0qiF7Nr58=;
	b=pgGJIW5N2p4agtNMe+5CJanJKAz8ci5j+Sa3pWBuSVOdC/VGlfqzVQmt5TYitNdKrEx7
	 u4fJCtKQIUEWaSbN1i0JIVi2yVYyynNJj/t8USVVtx6oTX/k75kDSL3Z0OjPyaH2G8ouc
	 bY3egHSKpVke5NPArxeUDDVje3LLpg1FD1S72YTHpXXiaIm6SKVmm1jbsMfI5b5EVZMCf
	 3TKVrPJnvWs4PyLwuvV193pG27XM34F9ht1wxBD1tiP73kd/MG0vDoBW0gjk76Aj3QyL0
	 EoKm0GrF5VyJq7tIXU7lVL14CeSvq8xHOYKJ8Gbz/lkhKAty1bgxdXSzbQdkGGd8oGA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PFXHjot7;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 03AE1606A89D;
	Sat, 14 Nov 2026 14:52:25 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PFXHjot7
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794667939;
	b=lv/jbMbHfZ3yVpvUTWcpaeAxxafMPLBMpPKv7oFs8sVtH2hpNfZqDPW8mqQLcwb7RgKV
	 2JKY7YbNalVb+33uzjkP5fVPyZ0SbssarVQ+XTkFKCfqaqwXWkN2l+lrDeS7XsytjIaw9
	 Km/7QXF8MCos3Iem5dSR9cjafGv6XWpPmRYdC8GeSrPESPpmsevsG3F/JhODWH/djPZYG
	 FdIJhJoC4fOYtSTpUhWdaBUu8tiofAo0vTIVb9Rx+jZQxtWrRUM0aPIYRKm2w7HwDndPB
	 AuFtcstWXYN1GxKTzvXYZqGjssEziA7LBCgx1KcOXalAsEkpjA6sUNkLVhsEhzZecWQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794667939;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=Stxf2y23tK03Or3qwqdcinc2HKFkBV1bom0qiF7Nr58=;
	b=aXPI+hbh1yF2s7GQwxIUMp6lSsHfgBJEpOn/IZwf0Ub26sLsfqYOiywuz6kMCjXmLO+7
	 tzQotmeUGIuSknoBTzQHeOPy9z9SLV8PDf51l/qnOTJNld3zF4S5Gjs7mbnonIvMP0/VW
	 jJR+jb5h98JlGxR4KRFKLnmuL0FlTgkkonBHftqcAy9xrjfT6kSeIK2e22GfYqWeezun7
	 NEzH03lCkgNfyFMTf80U8qVmhZcCW8TSgf+Gnt391CJWm3Bdj6X53wtWu9iDjc7yKiMKd
	 7U5YujOsqIMRJls+zgtdKHqErd/2mHs1CsFZRMiz2J10x9pWTKPsRFZRlMBZQ/kaa0w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=PFXHjot7;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BF44606A893;
	Sat, 14 Nov 2026 14:52:19 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A86361F000C5;
	Sat, 14 Nov 2026 14:52:17 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794667938;
	bh=Stxf2y23tK03Or3qwqdcinc2HKFkBV1bom0qiF7Nr58=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=PFXHjot7jHhbH0wVpsH/dOqFlEpConntW10wMrQxFlE6gwzevH0vEV+JaA9CM/6vE
	 VJPgqTj24yWRZ6RYDm6PqLufq0THLOtgDNxU08nkLMiJGc/v6GzpUB9tQWQwDCX/88
	 M2x8W7t0z5Oom0tQfhZCYlfScTsk+/WB3WIX0u/bUstXu+qjHIuToJ84aN1xJDOJ0+
	 b66j+lMjMVR27YP9kSPw3ye3sgpTmOuFm9Q+LYarKMojzXFUTIzV9IHHI+DePWInfM
	 5cJdzIHwIaz0ruCexbjkzuEQkX2ckKXAla0ojtZ79WnAQmWpi5WbkVJUfiSj0omxtQ
	 uuG/YAkmp6iLQ==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, kuba@kernel.org,
 pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
 richardcochran@gmail.com, matthias.bgg@gmail.com,
 angelogioacchino.delregno@collabora.com, biao.huang@mediatek.com,
 maxime.chevallier@bootlin.com, mcoquelin.stm32@gmail.com,
 alexandre.torgue@foss.st.com, edumazet@kernel.org, kernel@collabora.com,
 netdev@vger.kernel.org, devicetree@vger.kernel.org,
 linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
 linux-mediatek@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com
X-In-Reply-To: <20261110-dwmac-mediatek-mt8189-v5-10-7d99d6292962@collabora.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list