[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]

[Description]
Refactor and sync kernel/wifi from Openwrt

[Release-log]
N/A

diff --git a/recipes-wifi/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch b/recipes-wifi/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
index 5f853a4..3f85428 100644
--- a/recipes-wifi/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
+++ b/recipes-wifi/linux-mt76/files/patches/3001-mt76-add-wed-tx-support.patch
@@ -1,18 +1,18 @@
-From 457a54d92f80cb1a24cbde87e7bf2b49a65d4321 Mon Sep 17 00:00:00 2001
+From fd87002de206b299e0962d2935c5f3ab0813cfa0 Mon Sep 17 00:00:00 2001
 From: Sujuan Chen <sujuan.chen@mediatek.com>
-Date: Sun, 12 Jun 2022 16:38:45 +0800
-Subject: [PATCH 3001/3011] mt76 add wed tx support
+Date: Fri, 25 Nov 2022 10:38:53 +0800
+Subject: [PATCH 3001/3010] mt76 add wed tx support
 
 Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
 ---
  mt76_connac.h |  1 +
  mt7915/mac.c  | 11 +++++++----
  mt7915/main.c |  4 ++--
- mt7915/mmio.c | 12 ++++++++++--
- 4 files changed, 20 insertions(+), 8 deletions(-)
+ mt7915/mmio.c |  5 +++--
+ 4 files changed, 13 insertions(+), 8 deletions(-)
 
 diff --git a/mt76_connac.h b/mt76_connac.h
-index 0915eb5..9a46887 100644
+index 8ba883b0..f70987dd 100644
 --- a/mt76_connac.h
 +++ b/mt76_connac.h
 @@ -116,6 +116,7 @@ struct mt76_connac_sta_key_conf {
@@ -24,10 +24,10 @@
  struct mt76_connac_fw_txp {
  	__le16 flags;
 diff --git a/mt7915/mac.c b/mt7915/mac.c
-index 5a809c2..20e5b70 100644
+index dc4c6eb3..d07bf790 100644
 --- a/mt7915/mac.c
 +++ b/mt7915/mac.c
-@@ -858,9 +858,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
+@@ -890,9 +890,9 @@ u32 mt7915_wed_init_buf(void *ptr, dma_addr_t phys, int token_id)
  
  	txp->token = cpu_to_le16(token_id);
  	txp->nbuf = 1;
@@ -39,7 +39,7 @@
  }
  
  static void
-@@ -976,6 +976,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+@@ -1008,6 +1008,7 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
  	LIST_HEAD(free_list);
  	void *end = data + len;
  	bool v3, wake = false;
@@ -47,7 +47,7 @@
  	u16 total, count = 0;
  	u32 txd = le32_to_cpu(free->txd);
  	__le32 *cur_info;
-@@ -1031,12 +1032,14 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
+@@ -1063,12 +1064,14 @@ mt7915_mac_tx_free(struct mt7915_dev *dev, void *data, int len)
  			txwi = mt76_token_release(mdev, msdu, &wake);
  			if (!txwi)
  				continue;
@@ -65,10 +65,10 @@
  
  static void
 diff --git a/mt7915/main.c b/mt7915/main.c
-index 2b4e122..f9b2c1e 100644
+index 83b97d23..2d237abf 100644
 --- a/mt7915/main.c
 +++ b/mt7915/main.c
-@@ -1466,14 +1466,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
+@@ -1505,14 +1505,14 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
  	if (!mtk_wed_device_active(wed))
  		return -ENODEV;
  
@@ -86,19 +86,19 @@
  
  	ctx->dev = NULL;
 diff --git a/mt7915/mmio.c b/mt7915/mmio.c
-index 63b66e4..f76f896 100644
+index fef4b126..7a50aa11 100644
 --- a/mt7915/mmio.c
 +++ b/mt7915/mmio.c
-@@ -10,7 +10,7 @@
- #include "mac.h"
+@@ -11,7 +11,7 @@
  #include "../trace.h"
+ #include "../dma.h"
  
 -static bool wed_enable;
 +static bool wed_enable = true;
  module_param(wed_enable, bool, 0644);
+ MODULE_PARM_DESC(wed_enable, "Enable Wireless Ethernet Dispatch support");
  
- static const u32 mt7915_reg[] = {
-@@ -575,7 +575,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
+@@ -580,7 +580,7 @@ static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
  	dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
  
  	spin_lock_bh(&dev->mt76.token_lock);
@@ -107,39 +107,7 @@
  	spin_unlock_bh(&dev->mt76.token_lock);
  
  	/* MT_TXD5_TX_STATUS_HOST (MPDU format) has higher priority than
-@@ -606,6 +606,9 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
- 
- 		wed->wlan.pci_dev = pci_dev;
- 		wed->wlan.bus_type = MTK_WED_BUS_PCIE;
-+		wed->wlan.base = (void __iomem *)ioremap(
-+				 pci_resource_start(pci_dev, 0),
-+				 pci_resource_len(pci_dev, 0));
- 		wed->wlan.wpdma_int = pci_resource_start(pci_dev, 0) +
- 				      MT_INT_WED_SOURCE_CSR;
- 		wed->wlan.wpdma_mask = pci_resource_start(pci_dev, 0) +
-@@ -616,6 +619,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
- 				     MT_TXQ_WED_RING_BASE;
- 		wed->wlan.wpdma_txfree = pci_resource_start(pci_dev, 0) +
- 					 MT_RXQ_WED_RING_BASE;
-+		wed->wlan.phy_base = pci_resource_start(pci_dev, 0);
- 	} else {
- 		struct platform_device *plat_dev = pdev_ptr;
- 		struct resource *res;
-@@ -626,10 +630,13 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
- 
- 		wed->wlan.platform_dev = plat_dev;
- 		wed->wlan.bus_type = MTK_WED_BUS_AXI;
-+		wed->wlan.base = (void __iomem *)ioremap(res->start,
-+				 resource_size(res));
- 		wed->wlan.wpdma_int = res->start + MT_INT_SOURCE_CSR;
- 		wed->wlan.wpdma_mask = res->start + MT_INT_MASK_CSR;
- 		wed->wlan.wpdma_tx = res->start + MT_TXQ_WED_RING_BASE;
- 		wed->wlan.wpdma_txfree = res->start + MT_RXQ_WED_RING_BASE;
-+		wed->wlan.phy_base = res->start;
- 	}
- 	wed->wlan.nbuf = 4096;
- 	wed->wlan.tx_tbit[0] = is_mt7915(&dev->mt76) ? 4 : 30;
-@@ -645,6 +652,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+@@ -783,6 +783,7 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
  
  	*irq = wed->irq;
  	dev->mt76.dma_dev = wed->dev;