From ba9e5454712197e511427469980cdf51bee97477 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Tue, 11 Feb 2025 10:10:39 +0100 Subject: [PATCH] rtl8189fs: add support for RTL8189FTV SDIO modules Recent boards using this wireless chip: - Widora Mangopi MQ (T113s) - Orangepi Zero Plus (H5) - Xassette Asterisk (D1) The driver is still crap, as it: - compiles - loads - can do "iw scan" - but freezes the host when starting up either as sta or ap Also see: https://lists.infradead.org/pipermail/lede-dev/2018-March/011517.html No reason to add this to trunk or to any devices. Signed-off-by: Zoltan HERPAI --- package/kernel/rtl8189fs/Makefile | 60 +++++++++++++++++++ ...build-against-openwrt-backports-tree.patch | 20 +++++++ .../0002-activate-all-backport-code.patch | 30 ++++++++++ 3 files changed, 110 insertions(+) create mode 100644 package/kernel/rtl8189fs/Makefile create mode 100644 package/kernel/rtl8189fs/patches/0001-Fix-build-against-openwrt-backports-tree.patch create mode 100644 package/kernel/rtl8189fs/patches/0002-activate-all-backport-code.patch diff --git a/package/kernel/rtl8189fs/Makefile b/package/kernel/rtl8189fs/Makefile new file mode 100644 index 0000000000..072789c963 --- /dev/null +++ b/package/kernel/rtl8189fs/Makefile @@ -0,0 +1,60 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=rtl8189fs +PKG_RELEASE=1 + +PKG_LICENSE:=GPLv2 +PKG_LICENSE_FILES:= + +PKG_SOURCE_URL:=https://github.com/jwrdegoede/rtl8189ES_linux.git +PKG_MIRROR_HASH:=40dd7768896a97b04d9d7da993cd50daf3971f65173b0e6b4be90806b7c26b19 +PKG_SOURCE_PROTO:=git +PKG_SOURCE_DATE:=2025-02-07 +PKG_SOURCE_VERSION:=94cc959d56c1425fbca4f6e49e949cf58ec5dc8d + +PKG_MAINTAINER:=Zoltan HERPAI +PKG_BUILD_PARALLEL:=1 + +STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h + +include $(INCLUDE_DIR)/kernel.mk +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/rtl8189fs + SUBMENU:=Wireless Drivers + TITLE:=Realtek RTL8189FTV SDIO WiFi + DEPENDS:=+kmod-cfg80211 +kmod-mmc +@DRIVER_11N_SUPPORT + KCONFIG:= \ + CONFIG_RTL8189FS=m + FILES:=\ + $(PKG_BUILD_DIR)/8189fs.ko + AUTOLOAD:=$(call AutoProbe,8189fs) +endef + +NOSTDINC_FLAGS := \ + $(KERNEL_NOSTDINC_FLAGS) \ + -I$(PKG_BUILD_DIR) \ + -I$(PKG_BUILD_DIR)/include \ + -I$(STAGING_DIR)/usr/include/mac80211-backport \ + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211 \ + -I$(STAGING_DIR)/usr/include/mac80211/uapi \ + -include backport/backport.h \ + -Wno-error=address \ + -Wno-error=stringop-overread + +NOSTDINC_FLAGS+=-DCONFIG_LITTLE_ENDIAN +NOSTDINC_FLAGS+=-DCONFIG_CONCURRENT_MODE +NOSTDINC_FLAGS+=-DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DBUILD_OPENWRT + +define Build/Compile + +$(KERNEL_MAKE) $(PKG_JOBS) \ + M="$(PKG_BUILD_DIR)" \ + $(PKG_MAKE_FLAGS) \ + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ + CONFIG_RTL8189FS=m \ + CONFIG_RTW_LOG_LEVEL=2 \ + modules +endef + +$(eval $(call KernelPackage,rtl8189fs)) diff --git a/package/kernel/rtl8189fs/patches/0001-Fix-build-against-openwrt-backports-tree.patch b/package/kernel/rtl8189fs/patches/0001-Fix-build-against-openwrt-backports-tree.patch new file mode 100644 index 0000000000..099434615d --- /dev/null +++ b/package/kernel/rtl8189fs/patches/0001-Fix-build-against-openwrt-backports-tree.patch @@ -0,0 +1,20 @@ +From 8aa824aece160dea0d3e74b5155d6f35361b3316 Mon Sep 17 00:00:00 2001 +From: Ben Greear +Date: Fri, 9 Nov 2018 16:21:43 -0800 +Subject: [PATCH 3/4] Fix build against openwrt backports tree. + +Like breaks builds elsewhere, can fix it up later. + +Signed-off-by: Ben Greear +--- + include/linux/{wireless.h => rtl_wireless.h} | 0 + 1 file changed, 0 insertions(+), 0 deletions(-) + rename include/linux/{wireless.h => rtl_wireless.h} (100%) + +diff --git a/include/linux/wireless.h b/include/linux/rtl_wireless.h +similarity index 100% +rename from include/linux/wireless.h +rename to include/linux/rtl_wireless.h +-- +2.32.0.windows.2 + diff --git a/package/kernel/rtl8189fs/patches/0002-activate-all-backport-code.patch b/package/kernel/rtl8189fs/patches/0002-activate-all-backport-code.patch new file mode 100644 index 0000000000..0807cefae2 --- /dev/null +++ b/package/kernel/rtl8189fs/patches/0002-activate-all-backport-code.patch @@ -0,0 +1,30 @@ +--- rtl8189fs-2025.02.07~94cc959d.old/os_dep/linux/ioctl_cfg80211.c 2025-01-13 08:02:59.000000000 +0100 ++++ rtl8189fs-2025.02.07~94cc959d/os_dep/linux/ioctl_cfg80211.c 2025-02-11 01:12:10.251888443 +0100 +@@ -418,7 +418,8 @@ + ret = rtw_chbw_to_cfg80211_chan_def(wiphy, &chdef, ch, bw, offset, ht); + if (ret != _SUCCESS) + goto exit; +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 9, 0)) ++// we're on backports-6.12 ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6,3, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 9, 0)) && 0 + cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0, 0); + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19, 2)) + cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0); +@@ -4979,7 +4980,7 @@ + return ret; + } + +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)) || 1 + static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *ndev, + struct cfg80211_ap_update *params) + { +@@ -5911,7 +5912,7 @@ + #endif /*#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))*/ + + static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 13, 0)) || 1 + , struct net_device *dev + , struct cfg80211_chan_def *chandef + #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) -- 2.30.2