Skip to content

Commit

Permalink
Fix mt76 for kernel 6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Feb 1, 2024
1 parent a4ee566 commit 17be7c5
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 68 deletions.
87 changes: 79 additions & 8 deletions 6.6/package/kernel/mt76/Makefile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
PKG_USE_NINJA:=0
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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) \
Expand Down Expand Up @@ -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))
59 changes: 0 additions & 59 deletions 6.6/package/kernel/mt76/patches/001-allow-vht-on-2g.patch

This file was deleted.

31 changes: 31 additions & 0 deletions 6.6/package/kernel/mt76/patches/001-kernel-6.6.patch
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 17be7c5

Please sign in to comment.