From 738294315e3a136a76a41623108a0f0e581c3fe1 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 19 Jan 2024 14:48:05 +0100 Subject: [PATCH] mediatek: fix WED + wifi reset The WLAN + WED reset sequence relies on being able to receive interrupts from the card, in order to synchronize individual steps with the firmware. When WED is stopped, leave interrupts running and rely on the driver turning off unwanted ones. WED DMA also needs to be disabled before resetting. Signed-off-by: Felix Fietkau (cherry picked from commit 2c5b3bee38eb0d76f5afe90f9969b73e19d28685) --- ...ernet-mtk_eth_soc-fix-WED-wifi-reset.patch | 49 +++++++++++++++++++ ...eth_soc-handle-dma-buffer-size-soc-.patch} | 0 ...ppe-Change-PPE-entries-number-to-16.patch} | 0 ...eth_soc-implement-.-get-set-_pausep.patch} | 0 ...tk_wed-move-dlm-a-dedicated-dts-node.patch | 4 +- 5 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 target/linux/generic/backport-5.15/753-v6.9-net-ethernet-mtk_eth_soc-fix-WED-wifi-reset.patch rename target/linux/generic/backport-5.15/{752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch => 754-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch} (100%) rename target/linux/generic/backport-5.15/{752-29-v6.10-net-ethernet-mtk_ppe-Change-PPE-entries-number-to-16.patch => 754-29-v6.10-net-ethernet-mtk_ppe-Change-PPE-entries-number-to-16.patch} (100%) rename target/linux/generic/backport-5.15/{752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch => 754-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch} (100%) diff --git a/target/linux/generic/backport-5.15/753-v6.9-net-ethernet-mtk_eth_soc-fix-WED-wifi-reset.patch b/target/linux/generic/backport-5.15/753-v6.9-net-ethernet-mtk_eth_soc-fix-WED-wifi-reset.patch new file mode 100644 index 0000000000..71ae446033 --- /dev/null +++ b/target/linux/generic/backport-5.15/753-v6.9-net-ethernet-mtk_eth_soc-fix-WED-wifi-reset.patch @@ -0,0 +1,49 @@ +From: Felix Fietkau +Date: Thu, 18 Jan 2024 12:51:32 +0100 +Subject: [PATCH] net: ethernet: mtk_eth_soc: fix WED + wifi reset + +The WLAN + WED reset sequence relies on being able to receive interrupts from +the card, in order to synchronize individual steps with the firmware. +When WED is stopped, leave interrupts running and rely on the driver turning +off unwanted ones. +WED DMA also needs to be disabled before resetting. + +Fixes: f78cd9c783e0 ("net: ethernet: mtk_wed: update mtk_wed_stop") +Signed-off-by: Felix Fietkau +--- + +--- a/drivers/net/ethernet/mediatek/mtk_wed.c ++++ b/drivers/net/ethernet/mediatek/mtk_wed.c +@@ -1073,13 +1073,13 @@ mtk_wed_dma_disable(struct mtk_wed_devic + static void + mtk_wed_stop(struct mtk_wed_device *dev) + { ++ mtk_wed_dma_disable(dev); + mtk_wed_set_ext_int(dev, false); + + wed_w32(dev, MTK_WED_WPDMA_INT_TRIGGER, 0); + wed_w32(dev, MTK_WED_WDMA_INT_TRIGGER, 0); + wdma_w32(dev, MTK_WDMA_INT_MASK, 0); + wdma_w32(dev, MTK_WDMA_INT_GRP2, 0); +- wed_w32(dev, MTK_WED_WPDMA_INT_MASK, 0); + + if (!mtk_wed_get_rx_capa(dev)) + return; +@@ -1092,7 +1092,6 @@ static void + mtk_wed_deinit(struct mtk_wed_device *dev) + { + mtk_wed_stop(dev); +- mtk_wed_dma_disable(dev); + + wed_clr(dev, MTK_WED_CTRL, + MTK_WED_CTRL_WDMA_INT_AGENT_EN | +@@ -2604,9 +2603,6 @@ mtk_wed_irq_get(struct mtk_wed_device *d + static void + mtk_wed_irq_set_mask(struct mtk_wed_device *dev, u32 mask) + { +- if (!dev->running) +- return; +- + mtk_wed_set_ext_int(dev, !!mask); + wed_w32(dev, MTK_WED_INT_MASK, mask); + } diff --git a/target/linux/generic/backport-5.15/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch b/target/linux/generic/backport-5.15/754-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch similarity index 100% rename from target/linux/generic/backport-5.15/752-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch rename to target/linux/generic/backport-5.15/754-25-v6.10-net-ethernet-mtk_eth_soc-handle-dma-buffer-size-soc-.patch diff --git a/target/linux/generic/backport-5.15/752-29-v6.10-net-ethernet-mtk_ppe-Change-PPE-entries-number-to-16.patch b/target/linux/generic/backport-5.15/754-29-v6.10-net-ethernet-mtk_ppe-Change-PPE-entries-number-to-16.patch similarity index 100% rename from target/linux/generic/backport-5.15/752-29-v6.10-net-ethernet-mtk_ppe-Change-PPE-entries-number-to-16.patch rename to target/linux/generic/backport-5.15/754-29-v6.10-net-ethernet-mtk_ppe-Change-PPE-entries-number-to-16.patch diff --git a/target/linux/generic/backport-5.15/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch b/target/linux/generic/backport-5.15/754-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch similarity index 100% rename from target/linux/generic/backport-5.15/752-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch rename to target/linux/generic/backport-5.15/754-30-v6.10-net-ethernet-mtk_eth_soc-implement-.-get-set-_pausep.patch diff --git a/target/linux/mediatek/patches-5.15/944-net-ethernet-mtk_wed-move-dlm-a-dedicated-dts-node.patch b/target/linux/mediatek/patches-5.15/944-net-ethernet-mtk_wed-move-dlm-a-dedicated-dts-node.patch index abb6591b7d..0701743ffb 100644 --- a/target/linux/mediatek/patches-5.15/944-net-ethernet-mtk_wed-move-dlm-a-dedicated-dts-node.patch +++ b/target/linux/mediatek/patches-5.15/944-net-ethernet-mtk_wed-move-dlm-a-dedicated-dts-node.patch @@ -22,7 +22,7 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/mediatek/mtk_wed.c +++ b/drivers/net/ethernet/mediatek/mtk_wed.c -@@ -1322,6 +1322,24 @@ mtk_wed_rro_alloc(struct mtk_wed_device +@@ -1321,6 +1321,24 @@ mtk_wed_rro_alloc(struct mtk_wed_device struct device_node *np; int index; @@ -47,7 +47,7 @@ Signed-off-by: Lorenzo Bianconi index = of_property_match_string(dev->hw->node, "memory-region-names", "wo-dlm"); if (index < 0) -@@ -1338,6 +1356,7 @@ mtk_wed_rro_alloc(struct mtk_wed_device +@@ -1337,6 +1355,7 @@ mtk_wed_rro_alloc(struct mtk_wed_device return -ENODEV; dev->rro.miod_phys = rmem->base; -- 2.30.2