mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	Fix mt76 for kernel 6.6
This commit is contained in:
		
							parent
							
								
									a4ee56638a
								
							
						
					
					
						commit
						17be7c5d69
					
				
					 4 changed files with 111 additions and 68 deletions
				
			
		| 
						 | 
				
			
			@ -1,16 +1,16 @@
 | 
			
		|||
include $(TOPDIR)/rules.mk
 | 
			
		||||
 | 
			
		||||
PKG_NAME:=mt76
 | 
			
		||||
PKG_RELEASE=5
 | 
			
		||||
PKG_RELEASE=1
 | 
			
		||||
 | 
			
		||||
PKG_LICENSE:=GPLv2
 | 
			
		||||
PKG_LICENSE_FILES:=
 | 
			
		||||
 | 
			
		||||
PKG_SOURCE_URL:=https://github.com/openwrt/mt76
 | 
			
		||||
PKG_SOURCE_PROTO:=git
 | 
			
		||||
PKG_SOURCE_DATE:=2023-05-13
 | 
			
		||||
PKG_SOURCE_VERSION:=969b7b5ebd129068ca56e4b0d831593a2f92382f
 | 
			
		||||
PKG_MIRROR_HASH:=d28869591d1cb9a967b72f5cd8215c7b2c3388b7b31147b7b18c797018ab8ffb
 | 
			
		||||
PKG_SOURCE_DATE:=2024-01-18
 | 
			
		||||
PKG_SOURCE_VERSION:=f77188160441d5f77f08dd517632ae3f60c653b0
 | 
			
		||||
PKG_MIRROR_HASH:=133a5e44624fe1933c893ee0b8ac75a847753f3490c26518c2ed9798f9ef53e0
 | 
			
		||||
 | 
			
		||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
 | 
			
		||||
PKG_USE_NINJA:=0
 | 
			
		||||
| 
						 | 
				
			
			@ -264,22 +264,37 @@ endef
 | 
			
		|||
 | 
			
		||||
define KernelPackage/mt7922-firmware
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  DEPENDS+=+kmod-mt7921-common
 | 
			
		||||
  TITLE:=MediaTek MT7922 firmware
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/mt792x-common
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  TITLE:=MediaTek MT792x wireless driver common code
 | 
			
		||||
  HIDDEN:=1
 | 
			
		||||
  DEPENDS+=+kmod-mt76-connac +@DRIVER_11AX_SUPPORT
 | 
			
		||||
  FILES:= $(PKG_BUILD_DIR)/mt792x-lib.ko
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/mt792x-usb
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  TITLE:=MediaTek MT792x wireless driver USB code
 | 
			
		||||
  HIDDEN:=1
 | 
			
		||||
  DEPENDS+=+kmod-mt792x-common +kmod-mt76-usb +@DRIVER_11AX_SUPPORT
 | 
			
		||||
  FILES:= $(PKG_BUILD_DIR)/mt792x-usb.ko
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/mt7921-common
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  TITLE:=MediaTek MT7615 wireless driver common code
 | 
			
		||||
  TITLE:=MediaTek MT7921 wireless driver common code
 | 
			
		||||
  HIDDEN:=1
 | 
			
		||||
  DEPENDS+=+kmod-mt76-connac +kmod-mt7921-firmware +@DRIVER_11AX_SUPPORT
 | 
			
		||||
  DEPENDS+=+kmod-mt792x-common +kmod-mt7921-firmware +@DRIVER_11AX_SUPPORT +kmod-hwmon-core
 | 
			
		||||
  FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921-common.ko
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/mt7921u
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  TITLE:=MediaTek MT7921U wireless driver
 | 
			
		||||
  DEPENDS+=+kmod-mt76-usb +kmod-mt7921-common
 | 
			
		||||
  DEPENDS+=+kmod-mt792x-usb +kmod-mt7921-common
 | 
			
		||||
  FILES:= $(PKG_BUILD_DIR)/mt7921/mt7921u.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoProbe,mt7921u)
 | 
			
		||||
endef
 | 
			
		||||
| 
						 | 
				
			
			@ -300,6 +315,38 @@ define KernelPackage/mt7921e
 | 
			
		|||
  AUTOLOAD:=$(call AutoProbe,mt7921e)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/mt7996e
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  TITLE:=MediaTek MT7996E wireless driver
 | 
			
		||||
  DEPENDS+=@PCI_SUPPORT +kmod-mt76-connac +kmod-hwmon-core
 | 
			
		||||
  FILES:= $(PKG_BUILD_DIR)/mt7996/mt7996e.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoProbe,mt7996e)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/mt7925-common
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  TITLE:=MediaTek MT7925 wireless driver common code
 | 
			
		||||
  HIDDEN:=1
 | 
			
		||||
  DEPENDS+=+kmod-mt792x-common +@DRIVER_11AX_SUPPORT +kmod-hwmon-core
 | 
			
		||||
  FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925-common.ko
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/mt7925u
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  TITLE:=MediaTek MT7925U wireless driver
 | 
			
		||||
  DEPENDS+=+kmod-mt792x-usb +kmod-mt7925-common
 | 
			
		||||
  FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925u.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoProbe,mt7921u)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define KernelPackage/mt7925e
 | 
			
		||||
  $(KernelPackage/mt76-default)
 | 
			
		||||
  TITLE:=MediaTek MT7925e wireless driver
 | 
			
		||||
  DEPENDS+=@PCI_SUPPORT +kmod-mt7925-common
 | 
			
		||||
  FILES:= $(PKG_BUILD_DIR)/mt7925/mt7925e.ko
 | 
			
		||||
  AUTOLOAD:=$(call AutoProbe,mt7921e)
 | 
			
		||||
endef
 | 
			
		||||
 | 
			
		||||
define Package/mt76-test
 | 
			
		||||
  SECTION:=devel
 | 
			
		||||
  CATEGORY:=Development
 | 
			
		||||
| 
						 | 
				
			
			@ -390,6 +437,12 @@ ifdef CONFIG_PACKAGE_kmod-mt7915e
 | 
			
		|||
    NOSTDINC_FLAGS += -DCONFIG_MT798X_WMAC
 | 
			
		||||
  endif
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_PACKAGE_kmod-mt792x-common
 | 
			
		||||
  PKG_MAKE_FLAGS += CONFIG_MT792x_LIB=m
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_PACKAGE_kmod-mt792x-usb
 | 
			
		||||
  PKG_MAKE_FLAGS += CONFIG_MT792x_USB=m
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_PACKAGE_kmod-mt7921-common
 | 
			
		||||
  PKG_MAKE_FLAGS += CONFIG_MT7921_COMMON=m
 | 
			
		||||
endif
 | 
			
		||||
| 
						 | 
				
			
			@ -402,6 +455,18 @@ endif
 | 
			
		|||
ifdef CONFIG_PACKAGE_kmod-mt7921e
 | 
			
		||||
  PKG_MAKE_FLAGS += CONFIG_MT7921E=m
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_PACKAGE_kmod-mt7996e
 | 
			
		||||
  PKG_MAKE_FLAGS += CONFIG_MT7996E=m
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_PACKAGE_kmod-mt7925-common
 | 
			
		||||
  PKG_MAKE_FLAGS += CONFIG_MT7925_COMMON=m
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_PACKAGE_kmod-mt7925u
 | 
			
		||||
  PKG_MAKE_FLAGS += CONFIG_MT7925U=m
 | 
			
		||||
endif
 | 
			
		||||
ifdef CONFIG_PACKAGE_kmod-mt7925e
 | 
			
		||||
  PKG_MAKE_FLAGS += CONFIG_MT7925E=m
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
define Build/Compile
 | 
			
		||||
	+$(KERNEL_MAKE) $(PKG_JOBS) \
 | 
			
		||||
| 
						 | 
				
			
			@ -579,9 +644,15 @@ $(eval $(call KernelPackage,mt7981-firmware))
 | 
			
		|||
$(eval $(call KernelPackage,mt7986-firmware))
 | 
			
		||||
$(eval $(call KernelPackage,mt7921-firmware))
 | 
			
		||||
$(eval $(call KernelPackage,mt7922-firmware))
 | 
			
		||||
$(eval $(call KernelPackage,mt792x-common))
 | 
			
		||||
$(eval $(call KernelPackage,mt792x-usb))
 | 
			
		||||
$(eval $(call KernelPackage,mt7921-common))
 | 
			
		||||
$(eval $(call KernelPackage,mt7925-common))
 | 
			
		||||
$(eval $(call KernelPackage,mt7921u))
 | 
			
		||||
$(eval $(call KernelPackage,mt7921s))
 | 
			
		||||
$(eval $(call KernelPackage,mt7921e))
 | 
			
		||||
$(eval $(call KernelPackage,mt7925u))
 | 
			
		||||
$(eval $(call KernelPackage,mt7925e))
 | 
			
		||||
$(eval $(call KernelPackage,mt7996e))
 | 
			
		||||
$(eval $(call KernelPackage,mt76))
 | 
			
		||||
$(eval $(call BuildPackage,mt76-test))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,59 +0,0 @@
 | 
			
		|||
From ed0b9c38becdbf9379787ca0b4db557f03a31dd7 Mon Sep 17 00:00:00 2001
 | 
			
		||||
From: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
 | 
			
		||||
Date: Mon, 23 Nov 2020 10:46:37 +0800
 | 
			
		||||
Subject: [PATCH] mt76: allow VHT rate on 2.4GHz
 | 
			
		||||
 | 
			
		||||
Allow chips that support 11ac to use 256QAM on 2.4GHz
 | 
			
		||||
 | 
			
		||||
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
 | 
			
		||||
---
 | 
			
		||||
 mac80211.c | 10 +++++-----
 | 
			
		||||
 1 file changed, 5 insertions(+), 5 deletions(-)
 | 
			
		||||
 | 
			
		||||
diff --git a/mac80211.c b/mac80211.c
 | 
			
		||||
index 766681a4..06aa4228 100644
 | 
			
		||||
--- a/mac80211.c
 | 
			
		||||
+++ b/mac80211.c
 | 
			
		||||
@@ -282,7 +282,7 @@ static void mt76_init_stream_cap(struct mt76_phy *phy,
 | 
			
		||||
 void mt76_set_stream_caps(struct mt76_phy *phy, bool vht)
 | 
			
		||||
 {
 | 
			
		||||
 	if (phy->cap.has_2ghz)
 | 
			
		||||
-		mt76_init_stream_cap(phy, &phy->sband_2g.sband, false);
 | 
			
		||||
+		mt76_init_stream_cap(phy, &phy->sband_2g.sband, vht);
 | 
			
		||||
 	if (phy->cap.has_5ghz)
 | 
			
		||||
 		mt76_init_stream_cap(phy, &phy->sband_5g.sband, vht);
 | 
			
		||||
 	if (phy->cap.has_6ghz)
 | 
			
		||||
@@ -349,13 +349,13 @@ mt76_init_sband(struct mt76_phy *phy, struct mt76_sband *msband,
 | 
			
		||||
 
 | 
			
		||||
 static int
 | 
			
		||||
 mt76_init_sband_2g(struct mt76_phy *phy, struct ieee80211_rate *rates,
 | 
			
		||||
-		   int n_rates)
 | 
			
		||||
+		   int n_rates, bool vht)
 | 
			
		||||
 {
 | 
			
		||||
 	phy->hw->wiphy->bands[NL80211_BAND_2GHZ] = &phy->sband_2g.sband;
 | 
			
		||||
 
 | 
			
		||||
 	return mt76_init_sband(phy, &phy->sband_2g, mt76_channels_2ghz,
 | 
			
		||||
 			       ARRAY_SIZE(mt76_channels_2ghz), rates,
 | 
			
		||||
-			       n_rates, true, false);
 | 
			
		||||
+			       n_rates, true, vht);
 | 
			
		||||
 }
 | 
			
		||||
 
 | 
			
		||||
 static int
 | 
			
		||||
@@ -508,7 +508,7 @@ int mt76_register_phy(struct mt76_phy *phy, bool vht,
 | 
			
		||||
 		return ret;
 | 
			
		||||
 
 | 
			
		||||
 	if (phy->cap.has_2ghz) {
 | 
			
		||||
-		ret = mt76_init_sband_2g(phy, rates, n_rates);
 | 
			
		||||
+		ret = mt76_init_sband_2g(phy, rates, n_rates, vht);
 | 
			
		||||
 		if (ret)
 | 
			
		||||
 			return ret;
 | 
			
		||||
 	}
 | 
			
		||||
@@ -691,7 +691,7 @@ int mt76_register_device(struct mt76_dev *dev, bool vht,
 | 
			
		||||
 		return ret;
 | 
			
		||||
 
 | 
			
		||||
 	if (phy->cap.has_2ghz) {
 | 
			
		||||
-		ret = mt76_init_sband_2g(phy, rates, n_rates);
 | 
			
		||||
+		ret = mt76_init_sband_2g(phy, rates, n_rates, vht);
 | 
			
		||||
 		if (ret)
 | 
			
		||||
 			return ret;
 | 
			
		||||
 	}
 | 
			
		||||
							
								
								
									
										31
									
								
								6.6/package/kernel/mt76/patches/001-kernel-6.6.patch
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								6.6/package/kernel/mt76/patches/001-kernel-6.6.patch
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,31 @@
 | 
			
		|||
diff --git a/mac80211.c b/mac80211.c
 | 
			
		||||
index cc9e9ff1..9b29340d 100644
 | 
			
		||||
--- a/mac80211.c
 | 
			
		||||
+++ b/mac80211.c
 | 
			
		||||
@@ -4,7 +4,11 @@
 | 
			
		||||
  */
 | 
			
		||||
 #include <linux/sched.h>
 | 
			
		||||
 #include <linux/of.h>
 | 
			
		||||
+#if LINUX_VERSION_IS_LESS(6,6,0)
 | 
			
		||||
 #include <net/page_pool.h>
 | 
			
		||||
+#else
 | 
			
		||||
+#include <net/page_pool/helpers.h>
 | 
			
		||||
+#endif
 | 
			
		||||
 #include "mt76.h"
 | 
			
		||||
 
 | 
			
		||||
 #define CHAN2G(_idx, _freq) {			\
 | 
			
		||||
diff --git a/mt76.h b/mt76.h
 | 
			
		||||
index d2ead585..bb9002d8 100644
 | 
			
		||||
--- a/mt76.h
 | 
			
		||||
+++ b/mt76.h
 | 
			
		||||
@@ -15,6 +15,10 @@
 | 
			
		||||
 #include <linux/average.h>
 | 
			
		||||
 #include <linux/soc/mediatek/mtk_wed.h>
 | 
			
		||||
 #include <net/mac80211.h>
 | 
			
		||||
+#if LINUX_VERSION_IS_GEQ(6,6,0)
 | 
			
		||||
+#include <net/page_pool/helpers.h>
 | 
			
		||||
+#endif
 | 
			
		||||
+
 | 
			
		||||
 #include "util.h"
 | 
			
		||||
 #include "testmode.h"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								build.sh
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								build.sh
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -778,7 +778,7 @@ if [ "$OMR_KERNEL" = "6.6" ]; then
 | 
			
		|||
	echo "# CONFIG_PACKAGE_kmod-button-hotplug is not set" >> ".config"
 | 
			
		||||
	echo "# CONFIG_PACKAGE_kmod-cryptodev is not set" >> ".config"
 | 
			
		||||
	# Remove for now packages that doesn't compile
 | 
			
		||||
	rm -rf package/kernel/mt76
 | 
			
		||||
	#rm -rf package/kernel/mt76
 | 
			
		||||
	rm -rf package/kernel/rtl8812au-ct
 | 
			
		||||
	# Remove not needed patches
 | 
			
		||||
	rm -f package/kernel/mac80211/patches/build/200-Revert-wifi-iwlwifi-Use-generic-thermal_zone_get_tri.patch
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue