Skip to content

Commit 7e740aa

Browse files
committed
add broadcom-wl driver for older macbooks
1 parent 555e8a8 commit 7e740aa

22 files changed

Lines changed: 1187 additions & 0 deletions

Config.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ menu "System"
9494
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/network/qualcomm/rmtfs/Config.in"
9595
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/network/qualcomm/tqftpserv/Config.in"
9696
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/network/r8125/Config.in"
97+
source "$BR2_EXTERNAL_BATOCERA_PATH/package/batocera/network/broadcom-wl/Config.in"
9798
endmenu
9899

99100
menu "Device trees"

batocera-Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
- Light gun support for PS3 (up to 2 players)
2626
- initial Intel A770 GPU support
2727
- Enabled libretro-yabasanshiro for platform RK3399
28+
- Macbook 2013 wifi driver (broadcom-wl) - v6.30.223.271
29+
- Patches leveraged from Arch Linux - thanks :-)
2830
- force feedback for Nintendo controllers (requires linux kernel 5.16 or later)
2931
### Changed
3032
- move to pipewire wireplumber audio

package/batocera/core/batocera-system/Config.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@ config BR2_PACKAGE_BATOCERA_SYSTEM
318318

319319
select BR2_PACKAGE_RTL8189ES if BR2_PACKAGE_BATOCERA_TARGET_S905 || BR2_PACKAGE_BATOCERA_TARGET_S905GEN2 || BR2_PACKAGE_BATOCERA_TARGET_S905GEN3
320320

321+
# older macbook wifi
322+
select BR2_PACKAGE_BROADCOM_WL if BR2_PACKAGE_BATOCERA_TARGET_X86_64_ANY
323+
321324
# ethernet
322325
select BR2_PACKAGE_R8125 if BR2_PACKAGE_BATOCERA_TARGET_X86_ANY
323326

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Description: Fixing null pointer crash
2+
3+
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773713
4+
Bug-Ubuntu: https://launchpad.net/bugs/1415880
5+
Last-Update: 2015-08-18
6+
7+
---
8+
wl/sys/wl_linux.c | 2 +-
9+
1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+
diff --git a/src/wl/sys/wl_linux.c b/src/wl/sys/wl_linux.c
12+
index 860b935..295156f 100644
13+
--- a/src/wl/sys/wl_linux.c
14+
+++ b/src/wl/sys/wl_linux.c
15+
@@ -2157,8 +2157,8 @@ wl_start(struct sk_buff *skb, struct net_device *dev)
16+
wlif = WL_DEV_IF(dev);
17+
wl = WL_INFO(dev);
18+
19+
+ skb->prev = NULL;
20+
if (WL_ALL_PASSIVE_ENAB(wl) || (WL_RTR() && WL_CONFIG_SMP())) {
21+
- skb->prev = NULL;
22+
23+
TXQ_LOCK(wl);
24+
25+
--
26+
1.9.1
27+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Since Linux 4.3, rdtscl() is no longer available and native_read_tsc()
2+
is renamed to rdtsc(). Move the macro contents in-line and call the
3+
new function. References:
4+
5+
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=fe47ae6e1a5005b2e82f7eab57b5c3820453293a
6+
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=4ea1636b04dbd66536fa387bae2eea463efc705b
7+
8+
diff -ru a/src/shared/linux_osl.c b/src/shared/linux_osl.c
9+
--- a/src/shared/linux_osl.c 2015-09-19 01:47:15.000000000 +0300
10+
+++ b/src/shared/linux_osl.c 2015-11-21 15:20:30.585902518 +0200
11+
@@ -932,7 +932,11 @@
12+
uint cycles;
13+
14+
#if defined(__i386__)
15+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0)
16+
+ cycles = (u32)rdtsc();
17+
+#else
18+
rdtscl(cycles);
19+
+#endif
20+
#else
21+
cycles = 0;
22+
#endif
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
Since Linux 4.7, the enum ieee80211_band is no longer used
2+
3+
This shall cause no problem's since both enums ieee80211_band
4+
and nl80211_band were added in the same commit:
5+
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=13ae75b103e07304a34ab40c9136e9f53e06475c
6+
7+
This patch refactors the references of IEEE80211_BAND_* to NL80211_BAND_*
8+
9+
Reference:
10+
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit?id=57fbcce37be7c1d2622b56587c10ade00e96afa3
11+
12+
--- a/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:57:36.159340297 -0500
13+
+++ b/src/wl/sys/wl_cfg80211_hybrid.c 2016-06-13 11:58:18.442323435 -0500
14+
@@ -236,7 +236,7 @@
15+
#endif
16+
17+
#define CHAN2G(_channel, _freq, _flags) { \
18+
- .band = IEEE80211_BAND_2GHZ, \
19+
+ .band = NL80211_BAND_2GHZ, \
20+
.center_freq = (_freq), \
21+
.hw_value = (_channel), \
22+
.flags = (_flags), \
23+
@@ -245,7 +245,7 @@
24+
}
25+
26+
#define CHAN5G(_channel, _flags) { \
27+
- .band = IEEE80211_BAND_5GHZ, \
28+
+ .band = NL80211_BAND_5GHZ, \
29+
.center_freq = 5000 + (5 * (_channel)), \
30+
.hw_value = (_channel), \
31+
.flags = (_flags), \
32+
@@ -379,7 +379,7 @@
33+
};
34+
35+
static struct ieee80211_supported_band __wl_band_2ghz = {
36+
- .band = IEEE80211_BAND_2GHZ,
37+
+ .band = NL80211_BAND_2GHZ,
38+
.channels = __wl_2ghz_channels,
39+
.n_channels = ARRAY_SIZE(__wl_2ghz_channels),
40+
.bitrates = wl_g_rates,
41+
@@ -387,7 +387,7 @@
42+
};
43+
44+
static struct ieee80211_supported_band __wl_band_5ghz_a = {
45+
- .band = IEEE80211_BAND_5GHZ,
46+
+ .band = NL80211_BAND_5GHZ,
47+
.channels = __wl_5ghz_a_channels,
48+
.n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
49+
.bitrates = wl_a_rates,
50+
@@ -395,7 +395,7 @@
51+
};
52+
53+
static struct ieee80211_supported_band __wl_band_5ghz_n = {
54+
- .band = IEEE80211_BAND_5GHZ,
55+
+ .band = NL80211_BAND_5GHZ,
56+
.channels = __wl_5ghz_n_channels,
57+
.n_channels = ARRAY_SIZE(__wl_5ghz_n_channels),
58+
.bitrates = wl_a_rates,
59+
@@ -1876,8 +1876,8 @@
60+
wdev->wiphy->max_num_pmkids = WL_NUM_PMKIDS_MAX;
61+
#endif
62+
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC);
63+
- wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
64+
- wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_a;
65+
+ wdev->wiphy->bands[NL80211_BAND_2GHZ] = &__wl_band_2ghz;
66+
+ wdev->wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_a;
67+
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
68+
wdev->wiphy->cipher_suites = __wl_cipher_suites;
69+
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(__wl_cipher_suites);
70+
@@ -2000,7 +2000,7 @@
71+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
72+
freq = ieee80211_channel_to_frequency(notif_bss_info->channel,
73+
(notif_bss_info->channel <= CH_MAX_2G_CHANNEL) ?
74+
- IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ);
75+
+ NL80211_BAND_2GHZ : NL80211_BAND_5GHZ);
76+
#else
77+
freq = ieee80211_channel_to_frequency(notif_bss_info->channel);
78+
#endif
79+
@@ -2116,7 +2116,7 @@
80+
return err;
81+
}
82+
chan = wf_chspec_ctlchan(chanspec);
83+
- band = (chan <= CH_MAX_2G_CHANNEL) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
84+
+ band = (chan <= CH_MAX_2G_CHANNEL) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ;
85+
freq = ieee80211_channel_to_frequency(chan, band);
86+
channel = ieee80211_get_channel(wiphy, freq);
87+
cfg80211_ibss_joined(ndev, (u8 *)&wl->bssid, channel, GFP_KERNEL);
88+
@@ -2250,10 +2250,10 @@
89+
join_params->params.chanspec_list[0] =
90+
ieee80211_frequency_to_channel(chan->center_freq);
91+
92+
- if (chan->band == IEEE80211_BAND_2GHZ) {
93+
+ if (chan->band == NL80211_BAND_2GHZ) {
94+
chanspec |= WL_CHANSPEC_BAND_2G;
95+
}
96+
- else if (chan->band == IEEE80211_BAND_5GHZ) {
97+
+ else if (chan->band == NL80211_BAND_5GHZ) {
98+
chanspec |= WL_CHANSPEC_BAND_5G;
99+
}
100+
else {
101+
@@ -2885,7 +2885,7 @@
102+
103+
if (phy == 'n' || phy == 'a' || phy == 'v') {
104+
wiphy = wl_to_wiphy(wl);
105+
- wiphy->bands[IEEE80211_BAND_5GHZ] = &__wl_band_5ghz_n;
106+
+ wiphy->bands[NL80211_BAND_5GHZ] = &__wl_band_5ghz_n;
107+
}
108+
109+
return err;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
From d3f93542326a06d920c6eb89b703384290d37b8b Mon Sep 17 00:00:00 2001
2+
From: Alberto Milone <alberto.milone@canonical.com>
3+
Date: Fri, 2 Sep 2016 17:35:34 +0200
4+
Subject: [PATCH 1/1] Add support for Linux 4.8
5+
6+
Orginal author: Krzysztof Kolasa
7+
---
8+
src/wl/sys/wl_cfg80211_hybrid.c | 22 ++++++++++++++++++++++
9+
1 file changed, 22 insertions(+)
10+
11+
diff --git a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
12+
index 2fc71fe..ec5e472 100644
13+
--- a/src/wl/sys/wl_cfg80211_hybrid.c
14+
+++ b/src/wl/sys/wl_cfg80211_hybrid.c
15+
@@ -2388,8 +2388,16 @@ wl_bss_connect_done(struct wl_cfg80211_priv *wl, struct net_device *ndev,
16+
s32 err = 0;
17+
18+
if (wl->scan_request) {
19+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
20+
+ struct cfg80211_scan_info info = {
21+
+ .aborted = true,
22+
+ };
23+
+ WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
24+
+ cfg80211_scan_done(wl->scan_request, &info);
25+
+#else
26+
WL_DBG(("%s: Aborting scan\n", __FUNCTION__));
27+
cfg80211_scan_done(wl->scan_request, true);
28+
+#endif
29+
wl->scan_request = NULL;
30+
}
31+
32+
@@ -2490,7 +2498,14 @@ wl_notify_scan_status(struct wl_cfg80211_priv *wl, struct net_device *ndev,
33+
34+
scan_done_out:
35+
if (wl->scan_request) {
36+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
37+
+ struct cfg80211_scan_info info = {
38+
+ .aborted = false,
39+
+ };
40+
+ cfg80211_scan_done(wl->scan_request, &info);
41+
+#else
42+
cfg80211_scan_done(wl->scan_request, false);
43+
+#endif
44+
wl->scan_request = NULL;
45+
}
46+
rtnl_unlock();
47+
@@ -2909,7 +2924,14 @@ s32 wl_cfg80211_down(struct net_device *ndev)
48+
s32 err = 0;
49+
50+
if (wl->scan_request) {
51+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
52+
+ struct cfg80211_scan_info info = {
53+
+ .aborted = true,
54+
+ };
55+
+ cfg80211_scan_done(wl->scan_request, &info);
56+
+#else
57+
cfg80211_scan_done(wl->scan_request, true);
58+
+#endif
59+
wl->scan_request = NULL;
60+
}
61+
62+
--
63+
2.7.4
64+

0 commit comments

Comments
 (0)