From: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Richard Cochran <richardcochran@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Biao Huang <biao.huang@mediatek.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: maxime.chevallier@bootlin.com, rmk+kernel@armlinux.org.uk,
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,
Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
Subject: [PATCH net-next 5/6] net: stmmac: mediatek: add support for TX deallocation adjustment feature
Date: Tue, 07 Jul 2026 10:21:23 +0200 [thread overview]
Message-ID: <20260707-dwmac-mediatek-mt8189-v1-5-17f345eaaca3@collabora.com> (raw)
In-Reply-To: <20260707-dwmac-mediatek-mt8189-v1-0-17f345eaaca3@collabora.com>
The MT8189 SoC has in the Ethernet control 0 register from the
peripheral configuration (pericfg) additional bits to adjust the TX
deallocation.
In preparation of MT8189 SoC support, add its definition, use in the
set_delay_v2 callback, and a support flag in the platform data.
Signed-off-by: Louis-Alexis Eyraud <louisalexis.eyraud@collabora.com>
---
.../net/ethernet/stmicro/stmmac/dwmac-mediatek.c | 25 ++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
index bcc0baef3f71..6b0a42b5839f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
@@ -37,7 +37,8 @@
#define ETH_FINE_DLY_RXC BIT(0)
/* Peri Configuration register for mt8189 */
-#define MT8189_CTRL0_TXC_OUT_OP BIT(20)
+#define MT8189_CTRL0_TXC_OUT_OP BIT(20)
+#define MT8189_CTRL0_DLY_GTXC_STAGE_FINE GENMASK(11, 6)
/* Peri Configuration register for mt8195 */
#define MT8195_PERI_ETH_CTRL_BASE 0xFD0
@@ -103,6 +104,7 @@ struct mediatek_dwmac_variant {
u32 peri_eth_ctrl_offset;
u8 dma_bit_mask;
bool use_out_op;
+ bool use_stage_fine;
};
/* list of clocks required for mac */
@@ -326,9 +328,12 @@ static void delay_stage2ps_v2(struct mediatek_dwmac_plat_data *plat)
static int set_delay_v2(struct mediatek_dwmac_plat_data *plat)
{
- u32 gtxc_delay_val = 0, delay_val = 0, rmii_delay_val = 0;
struct mac_delay_struct *mac_delay = &plat->mac_delay;
u32 reg_offset = plat->variant->peri_eth_ctrl_offset;
+ u32 gtxc_delay_mask = 0;
+ u32 gtxc_delay_val = 0;
+ u32 rmii_delay_val = 0;
+ u32 delay_val = 0;
delay_ps2stage_v2(plat);
@@ -402,6 +407,9 @@ static int set_delay_v2(struct mediatek_dwmac_plat_data *plat)
gtxc_delay_val |= FIELD_PREP(MT8195_DLY_GTXC_STAGES, mac_delay->tx_delay);
gtxc_delay_val |= FIELD_PREP(MT8195_DLY_GTXC_INV, mac_delay->tx_inv);
+ if (plat->variant->use_stage_fine)
+ gtxc_delay_val |= MT8189_CTRL0_DLY_GTXC_STAGE_FINE;
+
delay_val |= FIELD_PREP(MT8195_DLY_RXC_ENABLE, !!mac_delay->rx_delay);
delay_val |= FIELD_PREP(MT8195_DLY_RXC_STAGES, mac_delay->rx_delay);
delay_val |= FIELD_PREP(MT8195_DLY_RXC_INV, mac_delay->rx_inv);
@@ -412,12 +420,17 @@ static int set_delay_v2(struct mediatek_dwmac_plat_data *plat)
return -EINVAL;
}
+ gtxc_delay_mask = MT8195_RGMII_TXC_PHASE_CTRL |
+ MT8195_DLY_GTXC_INV |
+ MT8195_DLY_GTXC_ENABLE |
+ MT8195_DLY_GTXC_STAGES;
+
+ if (plat->variant->use_stage_fine)
+ gtxc_delay_mask |= MT8189_CTRL0_DLY_GTXC_STAGE_FINE;
+
regmap_update_bits(plat->peri_regmap,
reg_offset + MT8195_PERI_ETH_CTRL0,
- MT8195_RGMII_TXC_PHASE_CTRL |
- MT8195_DLY_GTXC_INV |
- MT8195_DLY_GTXC_ENABLE |
- MT8195_DLY_GTXC_STAGES,
+ gtxc_delay_mask,
gtxc_delay_val);
regmap_write(plat->peri_regmap,
reg_offset + MT8195_PERI_ETH_CTRL1,
--
2.55.0
next prev parent reply other threads:[~2026-07-07 8:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 8:21 [PATCH net-next 0/6] net/stmmac: Add Mediatek MT8189 support Louis-Alexis Eyraud
2026-07-07 8:21 ` [PATCH net-next 1/6] dt-bindings: net: mediatek-dwmac: add support for MT8189 SoC Louis-Alexis Eyraud
2026-07-07 12:42 ` Andrew Lunn
2026-07-07 8:21 ` [PATCH net-next 2/6] net: stmmac: mediatek: add PERI_ETH_CTRLx register offset in platform data Louis-Alexis Eyraud
2026-07-07 8:55 ` Maxime Chevallier
2026-07-07 12:45 ` Andrew Lunn
2026-07-07 8:21 ` [PATCH net-next 3/6] net: stmmac: mediatek: rename MT2712 and MT8195 variant methods Louis-Alexis Eyraud
2026-07-07 9:05 ` Maxime Chevallier
2026-07-07 8:21 ` [PATCH net-next 4/6] net: stmmac: mediatek: add support for TX clock output enable feature Louis-Alexis Eyraud
2026-07-07 8:21 ` Louis-Alexis Eyraud [this message]
2026-07-07 9:11 ` [PATCH net-next 5/6] net: stmmac: mediatek: add support for TX deallocation adjustment feature Maxime Chevallier
2026-07-07 8:21 ` [PATCH net-next 6/6] 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=20260707-dwmac-mediatek-mt8189-v1-5-17f345eaaca3@collabora.com \
--to=louisalexis.eyraud@collabora.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=biao.huang@mediatek.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=kernel@collabora.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=matthias.bgg@gmail.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robh@kernel.org \
/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