xx_vv_immortalwrt/target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch
Qingfang Deng 324f234966 kernel: Mediatek: fix EEE registers init
After booting, a "transmit queue 0 timed out" warning followed by a
register dump was observed. The dump indicates that mtk_hw_init() does
not initialize the EEECR during probe. This occurs because the
netdev is allocated in mtk_add_mac(), which is called after
mtk_hw_init(). Consequently, the EEECR register remains uninitialized
until a reset is triggered, causing mtk_hw_init() to run again with a
valid netdev, at which point the register is finally set.

To address this, instead of modifying the probe sequence, latch the Tx
LPI enable state and timer value, and move the EEECR register
initialization to mtk_mac_link_up() to ensure proper setup when the
interface comes up.

Additionally, the splat reveals that LPI functionality is controlled by
the MAC_MCR_EEE bits in the MCR register. Update mtk_set_eee() to
modify these bits accordingly.

Fixes: d8315d5358d5 ("kernel: backport Mediatek SoC EEE support")
Fixes: edddbaf79ccf ("kernel: Mediatek: set default EEE Tx LPI timer")
Signed-off-by: Qingfang Deng <dqfext@gmail.com>
2025-03-31 10:21:28 +01:00

45 lines
1.6 KiB
Diff

From: Chad Monroe <chad@monroe.io>
Date: Mon, 16 Sep 2024 19:29:03 -0700
Subject: [PATCH] net: ethernet: mediatek: increase QDMA RESV_BUF size
Increase QDMA RESV_BUF from 2K to 3K for netsys v2 to match Mediatek SDK[1].
This helps reduce the possibility of Ethernet transmit timeouts.
[1]: https://git01.mediatek.com/plugins/gitiles/openwrt/feeds/mtk-openwrt-feeds/+/19d8456c3051e5f6dabf42fa770916a2126ea4bf
Signed-off-by: Chad Monroe <chad@monroe.io>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++++--
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -271,6 +271,7 @@
#define MTK_WCOMP_EN BIT(24)
#define MTK_RESV_BUF (0x80 << 16)
#define MTK_MUTLI_CNT (0x4 << 12)
+#define MTK_RESV_BUF_MASK (0xff << 16)
#define MTK_LEAKY_BUCKET_EN BIT(11)
/* QDMA Flow Control Register */
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -3319,12 +3319,14 @@ static int mtk_start_dma(struct mtk_eth
MTK_TX_BT_32DWORDS | MTK_NDP_CO_PRO |
MTK_RX_2B_OFFSET | MTK_TX_WB_DDONE;
- if (mtk_is_netsys_v2_or_greater(eth))
+ if (mtk_is_netsys_v2_or_greater(eth)) {
+ val &= ~MTK_RESV_BUF_MASK;
val |= MTK_MUTLI_CNT | MTK_RESV_BUF |
MTK_WCOMP_EN | MTK_DMAD_WR_WDONE |
MTK_CHK_DDONE_EN | MTK_LEAKY_BUCKET_EN;
- else
+ } else {
val |= MTK_RX_BT_32DWORDS;
+ }
mtk_w32(eth, val, reg_map->qdma.glo_cfg);
mtk_w32(eth,