kernel: Mediatek: fix EEE registers init
authorQingfang Deng <dqfext@gmail.com>
Sat, 8 Mar 2025 18:00:14 +0000 (02:00 +0800)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 31 Mar 2025 09:21:28 +0000 (10:21 +0100)
commit324f234966fe7b910c7f25b69334e54591098c18
tree5152f29f9534abf5c8706cd3471f23f521e688f1
parent88234a03bc645d327016cc807c35972fcb6834eb
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>
12 files changed:
target/linux/generic/backport-6.6/753-v6.15-net-ethernet-mediatek-add-EEE-support.patch
target/linux/generic/hack-6.6/730-net-ethernet-mtk_eth_soc-add-hw-dump-for-forced-rese.patch
target/linux/generic/pending-6.6/702-net-ethernet-mtk_eth_soc-enable-threaded-NAPI.patch
target/linux/generic/pending-6.6/730-net-ethernet-mtk_eth_soc-reset-all-TX-queues-on-DMA-.patch
target/linux/generic/pending-6.6/732-00-net-ethernet-mtk_eth_soc-compile-out-netsys-v2-code-.patch
target/linux/generic/pending-6.6/732-01-net-ethernet-mtk_eth_soc-work-around-issue-with-send.patch
target/linux/generic/pending-6.6/733-01-net-ethernet-mtk_eth_soc-use-napi_build_skb.patch
target/linux/generic/pending-6.6/734-net-ethernet-mediatek-enlarge-DMA-reserve-buffer.patch
target/linux/generic/pending-6.6/735-net-ethernet-mtk_eth_soc-fix-memory-corruption-durin.patch
target/linux/generic/pending-6.6/737-net-ethernet-mtk_eth_soc-add-paths-and-SerDes-modes-.patch
target/linux/generic/pending-6.6/738-01-net-ethernet-mtk_eth_soc-reduce-rx-ring-size-for-older.patch
target/linux/generic/pending-6.6/738-02-net-ethernet-mtk_eth_soc-do-not-enable-page-pool-sta.patch