Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add broadcom-wl driver for older macbooks #7735

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ menu "System"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/network/qualcomm/rmtfs/Config.in"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/network/qualcomm/tqftpserv/Config.in"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/network/r8125/Config.in"
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/network/broadcom-wl/Config.in"
endmenu

menu "Device trees"
Expand Down
2 changes: 2 additions & 0 deletions batocera-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
- Light gun support for PS3 (up to 2 players)
- initial Intel A770 GPU support
- Enabled libretro-yabasanshiro for platform RK3399
- Macbook 2013 wifi driver (broadcom-wl) - v6.30.223.271
- Patches leveraged from Arch Linux - thanks :-)
- force feedback for Nintendo controllers (requires linux kernel 5.16 or later)
- Added wayland + sway support for single board computer (SBC)
- Automatically recenter 16:9 bezels for a better rendition on 16:10 and 5:3 screens (SteamDeck and other handheld devices)
Expand Down
3 changes: 3 additions & 0 deletions package/batocera/core/batocera-system/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,9 @@ config BR2_PACKAGE_BATOCERA_SYSTEM

select BR2_PACKAGE_RTL8189ES if BR2_PACKAGE_BATOCERA_TARGET_S905 || BR2_PACKAGE_BATOCERA_TARGET_S905GEN2 || BR2_PACKAGE_BATOCERA_TARGET_S905GEN3

# older macbook wifi
select BR2_PACKAGE_BROADCOM_WL if BR2_PACKAGE_BATOCERA_TARGET_X86_64_ANY

# ethernet
select BR2_PACKAGE_R8125 if BR2_PACKAGE_BATOCERA_TARGET_X86_ANY

Expand Down
27 changes: 27 additions & 0 deletions package/batocera/network/broadcom-wl/001-null-pointer-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Description: Fixing null pointer crash

Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773713
Bug-Ubuntu: https://launchpad.net/bugs/1415880
Last-Update: 2015-08-18

---
wl/sys/wl_linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
index 860b935..295156f 100644
--- a/src/wl/sys/wl_linux.c
+++ b/src/wl/sys/wl_linux.c
@@ -2157,8 +2157,8 @@ wl_start(struct sk_buff *skb, struct net_device *dev)
wlif = WL_DEV_IF(dev);
wl = WL_INFO(dev);

+ skb->prev = NULL;
if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
- skb->prev = NULL;

TXQ_LOCK(wl);

--
1.9.1

22 changes: 22 additions & 0 deletions package/batocera/network/broadcom-wl/002-rdtscl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Since Linux 4.3, rdtscl() is no longer available and native_read_tsc()
is renamed to rdtsc(). Move the macro contents in-line and call the
new function. References:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=fe47ae6e1a5005b2e82f7eab57b5c3820453293a
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=4ea1636b04dbd66536fa387bae2eea463efc705b

diff -ru a/src/shared/linux_osl.c b/src/shared/linux_osl.c
--- a/src/shared/linux_osl.c 2015-09-19 01:47:15.000000000 +0300
+++ b/src/shared/linux_osl.c 2015-11-21 15:20:30.585902518 +0200
@@ -932,7 +932,11 @@
uint cycles;

#if defined(__i386__)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
+ cycles = (u32)rdtsc();
+#else
rdtscl(cycles);
+#endif
#else
cycles = 0;
#endif
109 changes: 109 additions & 0 deletions package/batocera/network/broadcom-wl/003-linux47.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
Since Linux 4.7, the enum ieee80211_band is no longer used

This shall cause no problem's since both enums ieee80211_band
and nl80211_band were added in the same commit:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c

This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*

Reference:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3

--- a/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:57:36.159340297 -0500
+++ b/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:58:18.442323435 -0500
@@ -236,7 +236,7 @@
#endif

#define CHAN2G(_channel, _freq, _flags) { \
- .band = IEEE80211_BAND_2GHZ, \
+ .band = NL80211_BAND_2GHZ, \
.center_freq = (_freq), \
.hw_value = (_channel), \
.flags = (_flags), \
@@ -245,7 +245,7 @@
}

#define CHAN5G(_channel, _flags) { \
- .band = IEEE80211_BAND_5GHZ, \
+ .band = NL80211_BAND_5GHZ, \
.center_freq = 5000 + (5 * (_channel)), \
.hw_value = (_channel), \
.flags = (_flags), \
@@ -379,7 +379,7 @@
};

static struct ieee80211_supported_band __wl_band_2ghz = {
- .band = IEEE80211_BAND_2GHZ,
+ .band = NL80211_BAND_2GHZ,
.channels = __wl_2ghz_channels,
.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
.bitrates = wl_g_rates,
@@ -387,7 +387,7 @@
};

static struct ieee80211_supported_band __wl_band_5ghz_a = {
- .band = IEEE80211_BAND_5GHZ,
+ .band = NL80211_BAND_5GHZ,
.channels = __wl_5ghz_a_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
.bitrates = wl_a_rates,
@@ -395,7 +395,7 @@
};

static struct ieee80211_supported_band __wl_band_5ghz_n = {
- .band = IEEE80211_BAND_5GHZ,
+ .band = NL80211_BAND_5GHZ,
.channels = __wl_5ghz_n_channels,
.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
.bitrates = wl_a_rates,
@@ -1876,8 +1876,8 @@
wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
#endif
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
- wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a;
+ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
+ wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a;
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
wdev->wiphy->cipher_suites = __wl_cipher_suites;
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
@@ -2000,7 +2000,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ?
- IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
+ NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
#else
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
#endif
@@ -2116,7 +2116,7 @@
return err;
}
chan = wf_chspec_ctlchan(chanspec);
- band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
+ band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
freq = ieee80211_channel_to_frequency(chan, band);
channel = ieee80211_get_channel(wiphy, freq);
cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
@@ -2250,10 +2250,10 @@
join_params->params.chanspec_list[0] =
ieee80211_frequency_to_channel(chan->center_freq);

- if (chan->band == IEEE80211_BAND_2GHZ) {
+ if (chan->band == NL80211_BAND_2GHZ) {
chanspec |= WL_CHANSPEC_BAND_2G;
}
- else if (chan->band == IEEE80211_BAND_5GHZ) {
+ else if (chan->band == NL80211_BAND_5GHZ) {
chanspec |= WL_CHANSPEC_BAND_5G;
}
else {
@@ -2885,7 +2885,7 @@

if (phy == 'n' || phy == 'a' || phy == 'v') {
wiphy = wl_to_wiphy(wl);
- wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
+ wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
}

return err;
64 changes: 64 additions & 0 deletions package/batocera/network/broadcom-wl/004-linux48.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From d3f93542326a06d920c6eb89b703384290d37b8b Mon Sep 17 00:00:00 2001
From: Alberto Milone <alberto.milone@canonical.com>
Date: Fri, 2 Sep 2016 17:35:34 +0200
Subject: [PATCH 1/1] Add support for Linux 4.8

Orginal author: Krzysztof Kolasa
---
src/wl/sys/wl_cfg80211_hybrid.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
index 2fc71fe..ec5e472 100644
--- a/src/wl/sys/wl_cfg80211_hybrid.c
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
@@ -2388,8 +2388,16 @@ wl_bss_connect_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
s32 err = 0;

if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = true,
+ };
+ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
cfg80211_scan_done(wl->scan_request, true);
+#endif
wl->scan_request = NULL;
}

@@ -2490,7 +2498,14 @@ wl_notify_scan_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,

scan_done_out:
if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = false,
+ };
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
cfg80211_scan_done(wl->scan_request, false);
+#endif
wl->scan_request = NULL;
}
rtnl_unlock();
@@ -2909,7 +2924,14 @@ s32 wl_cfg80211_down(struct net_device *ndev)
s32 err = 0;

if (wl->scan_request) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
+ struct cfg80211_scan_info info = {
+ .aborted = true,
+ };
+ cfg80211_scan_done(wl->scan_request, &info);
+#else
cfg80211_scan_done(wl->scan_request, true);
+#endif
wl->scan_request = NULL;
}

--
2.7.4

Loading