Bug 193121 - brcmfmac working extremely poorly on MacBookPro13,*
Summary: brcmfmac working extremely poorly on MacBookPro13,*
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: drivers_network-wireless@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-22 10:19 UTC by Ronald
Modified: 2020-08-03 15:15 UTC (History)
65 users (show)

See Also:
Kernel Version: 4.8.0, 4.9.4, 4.9.5
Tree: Mainline
Regression: No


Attachments
Output of 'lspci -vvnn' (3.61 KB, application/octet-stream)
2017-01-22 10:19 UTC, Ronald
Details
Output from 'iw list' (2.82 KB, text/plain)
2017-01-22 10:20 UTC, Ronald
Details
Output from 'modinfo brcmfmac' (4.02 KB, text/plain)
2017-01-22 10:21 UTC, Ronald
Details
Output from dmesg after building brcmfmac with CONFIG_BRCMDBG=y and setting debug to 0x7fffffff (17.47 KB, application/gzip)
2017-01-22 10:24 UTC, Ronald
Details
dmesg output of "insmod brcmfmac debug=0xd416" with Linux 4.13-rc1 (22.22 KB, application/gzip)
2017-07-26 13:26 UTC, Daniel Roschka
Details
attachment-17819-0.html (4.03 KB, text/html)
2018-05-25 08:25 UTC, Satya Arjunan
Details
brcmfmac43602-pcie.txt working on macbook 13.3 (5.96 KB, text/plain)
2019-11-02 16:41 UTC, Simon Siebert
Details
NVRAM captured via VFIO trace of Windows BRCM driver (5.95 KB, text/plain)
2020-02-19 03:34 UTC, sonal.santan
Details
FW captured via VFIO trace of Windows BRCM driver (337.41 KB, application/octet-stream)
2020-02-19 03:35 UTC, sonal.santan
Details
Modified brcmfmac43602-pcie file from the captured NVRAM VFIO trace (5.89 KB, text/plain)
2020-07-24 21:27 UTC, Andy Holst
Details
A few more boardflags modifications to brcmfmac43602-pcie.txt configuration (6.01 KB, text/plain)
2020-07-25 02:35 UTC, Andy Holst
Details
Remodified the brcmfmac43602-pcie.txt file for testing out 2.4/5 Ghz band (5.91 KB, text/plain)
2020-07-26 02:46 UTC, Andy Holst
Details

Description Ronald 2017-01-22 10:19:17 UTC
Created attachment 252761 [details]
Output of 'lspci -vvnn'

The late 2016 MBP has a Broadcom 43602 rev2 wireless controller. The brcmfmac module is loaded correctly, but the resulting wifi has several issues:

* Extremely poor reception
  ------------------------

  Have to be within about 10 feet of the AP to get any signal; at 5 feet distance iwconfig shows

  wlp3s0    IEEE 802.11  ESSID:"..."
            Mode:Managed  Frequency:2.437 GHz  Access Point: ...
            Bit Rate=24 Mb/s   Tx-Power=31 dBm
            Retry short limit:7   RTS thr:off   Fragment thr:off
            Power Management:on
            Link Quality=37/70  Signal level=-73 dBm
            Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
            Tx excessive retries:16  Invalid misc:0   Missed beacon:0

* No 5GHz Band
  ------------

  Only 2.4GHz is present - see attached 'iw list' output.

* Wifi stops working after some time
  ----------------------------------

  After 10 - 20 min the wifi stops working, losing the connection altogether. Turning wifi off for several minutes and then turning it back on usually works. Might be a thermal issue?


As mentioned, the controller is a BCM43602 - from 'lspci -nn':
  03:00.0 Network controller [0280]: Broadcom Limited BCM43602 802.11ac Wireless LAN SoC [14e4:43ba] (rev 02)
Detailed 'lspci -vvnn' output is attached.

The firmware is the latest, I believe:
-rw-r--r--. 1 root root 595472 Dec  5 08:39 /lib/firmware/brcm/brcmfmac43602-pcie.ap.bin
-rw-r--r--. 1 root root 635449 Dec  5 08:39 /lib/firmware/brcm/brcmfmac43602-pcie.bin
Comment 1 Ronald 2017-01-22 10:20:41 UTC
Created attachment 252771 [details]
Output from 'iw list'
Comment 2 Ronald 2017-01-22 10:21:27 UTC
Created attachment 252781 [details]
Output from 'modinfo brcmfmac'
Comment 3 Ronald 2017-01-22 10:24:36 UTC
Created attachment 252791 [details]
Output from dmesg after building brcmfmac with CONFIG_BRCMDBG=y and setting debug to 0x7fffffff
Comment 4 Daniel Roschka 2017-01-22 11:38:27 UTC
Same issue with MacBookPro13,2 as well (as it's obviously the same wifi chipset ;-)).
Comment 5 Bernhard Froemel 2017-02-24 18:20:22 UTC
Same issues with MacBookPro13,3. Could be firmware related, like on the MBP 2015:

https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/commit/brcm/brcmfmac43602-pcie.bin?id=ea1178515b8852a5ead23b165b4609ef2b49f36c
Comment 6 Daniel Roschka 2017-02-24 21:15:51 UTC
As I assume the same I contacted Arend van Spriel (who works at Broadcom and fixed it last time) a few weeks back with the request to help, but I got no response so far. :-(
Comment 7 Daniel Roschka 2017-04-28 23:32:41 UTC
revinfo shows a different chip revision compared to the chip in the MacBookPro12,1 (https://bugzilla.kernel.org/show_bug.cgi?id=100201#c21), whose proper function got fixed by a firmware update. So still certainly possible that it's something firmware related.

cat /sys/kernel/debug/brcmfmac/0000\:02\:00.0/revinfo

vendorid: 0x14e4
deviceid: 0x4318
radiorev: 0.13.32.105
chipnum: 43602 (aa52)
chiprev: 2
chippkg: 1
corerev: 49
boardid: 0x061b
boardvendor: 0x14e4
boardrev: P421
driverrev: 7.35.177.61
ucoderev: 0
bus: 0
phytype: 11
phyrev: 18
anarev: 0
nvramrev: 00000000
Comment 8 Daniel Roschka 2017-07-26 13:26:06 UTC
Created attachment 257709 [details]
dmesg output of "insmod brcmfmac debug=0xd416" with Linux 4.13-rc1

dmesg output of "insmod brcmfmac debug=0xd416" with Linux 4.13-rc1

During the captured trace multiple tries to connect to one of the Wi-Fi networks in range happened, but failed, even though the AP was only ~1m away. While the MacBookPro in question only detects a few Wi-Fi networks, a random, cheap Android device detects around a dozen.
Comment 9 Arend van Spriel 2017-07-28 22:13:41 UTC
(In reply to Daniel Roschka from comment #8)
> Created attachment 257709 [details]
> dmesg output of "insmod brcmfmac debug=0xd416" with Linux 4.13-rc1

So the dmesg shows:

[29270.808720] brcmfmac: brcmf_cfg80211_reg_notifier Enter: initiator=1, alpha=DE
[29270.809184] brcmfmac: brcmf_fil_iovar_data_get ifidx=0, name=country, len=12
[29270.809186] brcmutil: data
[29270.809189] 00000000: 58 30 00 00 00 00 00 00 58 30 00 ff              X0......X0..
[29270.809192] brcmfmac: brcmf_translate_country_code No country codes configured for device

The country code X0 is apparently stored in the device itself. Now this country needs to be supported by the firmware we released to linux-firmware and my guess is that it does not.
Comment 10 Daniel Roschka 2017-08-04 06:42:57 UTC
@Arend: So how to proceed? Can you provide a firmware with such support?
Comment 11 Luis Castillo 2017-09-01 09:34:41 UTC
Dear @Arend,
Could you make a patch, please? All MacbookPro13 users will be extremely grateful to you.

Many thanks in advance.
All the best,
Luis.
Comment 12 Dmitry Sboychakov 2017-09-01 17:29:41 UTC
Totally agree with @Luis!
@Arend, please make a patch, we all will be very thankful!
If you need any additional/debug info  - just give us a sign)
Comment 13 stefan.langenmaier+kernel 2017-09-07 14:40:38 UTC
The same chip is also in the MacbookPro14,2.
Comment 14 Olli Salo 2017-09-25 17:37:40 UTC
@Arend, one more extra grateful Macbook Pro user here, should you be able to provide us with the firmware. You'd save us from using Macos when we could be using Linux. :D
Comment 15 Diogenes Rettori 2017-10-19 12:59:25 UTC
Aaaand another one here willing to have decent wifi.
Comment 16 Jeff YANG 2017-10-28 08:40:56 UTC
Another 14,2 user, who's loving running Linux kernel on mac, is also expecting this firmware update. Thanks and 谢谢
Comment 17 Slobodan Pejić 2017-11-01 21:26:59 UTC
MacbookPro14,3 is also affected by this issue.
Comment 18 Andrew 2017-11-08 01:15:08 UTC
MacBookPro14,2 with 4.13.10 (fedora 26) also experiencing limited WIFI sensitivity and only wireless-n on BRCM43206 rev2 wireless-AC capable hardware. Please find a fix. 

Firmware installed but this does not fix problem.
https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/plain/brcm/brcmfmac43602-pcie.bin has been installed in /lib/firmware/brcm/ and mac was rebooted. Problem persists.
Comment 19 Satya Arjunan 2018-01-15 01:11:37 UTC
Macbook Pro 14,2 user. Please fix this showstopper bug for the recent Macbook Pros.
Comment 20 Paul Muster 2018-03-07 13:43:53 UTC
Can you please share a timeframe in which you may fix that issue?
This would really help a lot! 

Thanks @Arend!
Comment 21 Craig Errington 2018-04-10 05:56:53 UTC
Is there anything we can do to push this forward? This is essentially the showstopper from running Linux on a pretty wide variety of Apple laptops.
Comment 22 Bernhard Froemel 2018-04-10 06:21:25 UTC
Maybe there are "political reasons" why this is not moving forward? Arend: please do not reply to this bug report with more information if this is the case! :)

On the other hand, if something can be done outside the firmware, any hints or pointers  (other than reverse engineering the OSX drivers) would be highly appreciated!
Comment 23 Olli Salo 2018-04-14 11:40:17 UTC
Hello guys. I was in correspondence with Arend some time ago and got this answer (and permission to post his reply to this forum):

======= snip ==========

The firmware update is not an easy task as it updates regulatory data in firmware it means a full verification cycle is required to assure the power levels stay within regulatory limits. This is always a hard sell for us as there is no return of investment for the engineering costs involved. Hence we release fullmac firmware that has been verified in running projects. Sadly the 43602 in the MacBook does not use a fullmac driver architecture so there is no fullmac firmware available. I have forwarded your request, but no high hopes we can resolve this.

Regards,
Arend

======= snip ===========

I decided to sell my Macbook Pro and started using a Dell laptop instead with Linux working on it like a charm.
Comment 24 Patrick Max 2018-04-16 08:43:03 UTC
Are there any updates?

Is there any workaround?
Comment 25 Andrey Arapov 2018-05-10 21:56:39 UTC
Ok, I am really tired of using a usb wifi dongle, so I was digging a bit deeper and here is what I've got.

Changing ccode=X0 to 0 and regrev=15 to 0 in the firmware seems like improving things a little and makes the connection more usable:

- instantly connecting to the WiFi;
- link quality=70/70 (Max!);
- connections is stable, no disconnects;
- I've got stable 50 Mbps download and 20 Mbps upload (my ISP allows 200/20 Max as per my contract);
- The latency gets higher as I am downloading things, but otherwise it is as low as it should be;
- still no 5GHz ... not sure why, maybe some hints what can be changed in the FW ? I've tried many things already...;


--- 8.8.8.8 ping statistics ---
100 packets transmitted, 100 received, 0% packet loss, time 99154ms
rtt min/avg/max/mdev = 8.548/12.201/70.152/8.757 ms


Here is the FW diff:

# radiff2 -r /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig /lib/firmware/brcm/brcmfmac43602-pcie.bin
wx 3000 @ 0x0007c82f
wx 3000 @ 0x0007c839

# radiff2 -x /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig /lib/firmware/brcm/brcmfmac43602-pcie.bin
  offset     0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF    0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
0x00000000  80f140b882f1a4b982f1b0b982f1bcb9 ..@.............   80f140b882f1a4b982f1b0b982f1bcb9 ..@.............
0x00000010  82f1cbb982f1dab982f1e9b982f1f8b9 ................   82f1cbb982f1dab982f1e9b982f1f8b9 ................
...
0x0007c820! 30643a66343a33650063636f64653d58 0d:f4:3e.ccode=X   30643a66343a33650063636f64653d30 0d:f4:3e.ccode=0
0x0007c830! 30007265677265763d31350061613267 0.regrev=15.aa2g   00007265677265763d30000061613267 ..regrev=0..aa2g
0x0007c840  3d3700616135673d370061676267303d =7.aa5g=7.agbg0=   3d3700616135673d370061676267303d =7.aa5g=7.agbg0=
0x0007c850  37310061676267313d37310061676267 71.agbg1=71.agbg   37310061676267313d37310061676267 71.agbg1=71.agbg
...


HW: MacBookPro14,3
Linux kernel: 4.16.8
WiFi card: Broadcom Limited BCM43602 802.11ac Wireless LAN SoC (rev 02)

Hope that workaround helps someone, until we get a proper FW, or a non-Apple replacement, finally :-)

Kind regards,
Andrey Arapov
Comment 26 Andrey Arapov 2018-05-11 11:24:26 UTC
Switching the txpower from 31 dBm down to 10 dBm (iwconfig wlp3s0 txpower 10dBm) appears to be also helping even with the non-modified FW.

I have also found the following posts which are still valid https://bugzilla.kernel.org/show_bug.cgi?id=103201

> Adrian Bjugård 2015-09-02 11:57:39 UTC:

> Also 5 GHz doesn't work, and the correct physical MAC address isn't
> recognised properly, everyone with this card (14e4:43ba) gets assigned the
> MAC address 00:90:4c:0d:f4:3e. Even by spoofing MAC address, it isn't
> possible to have two users of this card in the vicinity of each other.


> Arend van Spriel 2015-09-05 13:15:05 UTC:

> This issue has been root caused as a firmware issue. We are preparing a new
> firmware release to linux-firmware repo.

I am wondering whether we could extract the necessary FW from macOS, anyone has any pointers?

Kind regards,
Andrey Arapov
Comment 27 Ronald 2018-05-13 00:41:15 UTC
This is very interesting! I played around with the ccode and regrev values a bit, and it looks like the ccode modification isn't necessary: just changing the regrev to any single-digit value is enough. Also, in the `strings` output I saw 'ccode=%c%c' so I'm thinking the ccode, if modified, should probably be set to something like 'US' rather than a number.

Secondly, the interface still isn't very stable for me: it seems to get stuck very often (e.g. a download will proceed in bursts), and (probably as a consequence) it ends up dropping the wireless connection every now and then.

As to using the FW from MacOS, I strongly doubt that'll work - the FW's tend to be very different for different OS'.
Comment 28 jacooba9 2018-05-24 20:17:12 UTC
Hi! I'm new here, but I was wondering if someone could tell me the location of the firmware file I need to edit to get wifi working.

It seems like the easiest fix is either to change regrev in the firmware, or to just lower the tx-power to 10. Do I need to do both? Which is better? (And how can I tell?)

Thank you!
Comment 29 Alex Kennedy 2018-05-25 06:43:46 UTC
A(In reply to Arend van Spriel from comment #9)
> [29270.808720] brcmfmac: brcmf_cfg80211_reg_notifier Enter: initiator=1,
> alpha=DE
> [29270.809184] brcmfmac: brcmf_fil_iovar_data_get ifidx=0, name=country,
> len=12
> [29270.809186] brcmutil: data
> [29270.809189] 00000000: 58 30 00 00 00 00 00 00 58 30 00 ff             
> X0......X0..
> [29270.809192] brcmfmac: brcmf_translate_country_code No country codes
> configured for device
> 
> The country code X0 is apparently stored in the device itself. Now this
> country needs to be supported by the firmware we released to linux-firmware
> and my guess is that it does not.

Hey Arend,

Thank you so much for this example and explanation. I just wanted to add my plea of help to this bug as well, although I am sure you have been fighting for us as best you can.

Thank you!
Comment 30 Ronald 2018-05-25 06:56:39 UTC
The full path of the firmware file in question is: /lib/firmware/brcm/brcmfmac43602-pcie.bin . As to regrev vs power vs both: try them out for yourself and report back here.
Comment 31 Satya Arjunan 2018-05-25 08:25:28 UTC
Created attachment 276179 [details]
attachment-17819-0.html

I can confirm Andrey's workaround to set ccode=X0 to 0 and regrev=15 to 0
in the firmware gives stable connection.
The other option, "sudo iwconfig wlp2s0 txpower 10dBm" works well too with
the original firmware.

HW: MacBookPro14,2
Kernel: 4.15.0-22-generic

Satya

On 11 May 2018 at 06:56, <bugzilla-daemon@bugzilla.kernel.org> wrote:

> https://bugzilla.kernel.org/show_bug.cgi?id=193121
>
> Andrey Arapov (andrey.arapov@nixaid.com) changed:
>
>            What    |Removed                     |Added
> ------------------------------------------------------------
> ----------------
>                  CC|                            |andrey.arapov@nixaid.com
>
> --- Comment #25 from Andrey Arapov (andrey.arapov@nixaid.com) ---
> Ok, I am really tired of using a usb wifi dongle, so I was digging a bit
> deeper
> and here is what I've got.
>
> Changing ccode=X0 to 0 and regrev=15 to 0 in the firmware seems like
> improving
> things a little and makes the connection more usable:
>
> - instantly connecting to the WiFi;
> - link quality=70/70 (Max!);
> - connections is stable, no disconnects;
> - I've got stable 50 Mbps download and 20 Mbps upload (my ISP allows
> 200/20 Max
> as per my contract);
> - The latency gets higher as I am downloading things, but otherwise it is
> as
> low as it should be;
> - still no 5GHz ... not sure why, maybe some hints what can be changed in
> the
> FW ? I've tried many things already...;
>
>
> --- 8.8.8.8 ping statistics ---
> 100 packets transmitted, 100 received, 0% packet loss, time 99154ms
> rtt min/avg/max/mdev = 8.548/12.201/70.152/8.757 ms
>
>
> Here is the FW diff:
>
> # radiff2 -r /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig
> /lib/firmware/brcm/brcmfmac43602-pcie.bin
> wx 3000 @ 0x0007c82f
> wx 3000 @ 0x0007c839
>
> # radiff2 -x /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig
> /lib/firmware/brcm/brcmfmac43602-pcie.bin
>   offset     0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF    0 1 2 3 4
> 5 6
> 7 8 9 A B C D E F 0123456789ABCDEF
> 0x00000000  80f140b882f1a4b982f1b0b982f1bcb9 ..@.............
> 80f140b882f1a4b982f1b0b982f1bcb9 ..@.............
> 0x00000010  82f1cbb982f1dab982f1e9b982f1f8b9 ................
> 82f1cbb982f1dab982f1e9b982f1f8b9 ................
> ...
> 0x0007c820! 30643a66343a33650063636f64653d58 0d:f4:3e.ccode=X
> 30643a66343a33650063636f64653d30 0d:f4:3e.ccode=0
> 0x0007c830! 30007265677265763d31350061613267 0.regrev=15.aa2g
> 00007265677265763d30000061613267 ..regrev=0..aa2g
> 0x0007c840  3d3700616135673d370061676267303d =7.aa5g=7.agbg0=
> 3d3700616135673d370061676267303d =7.aa5g=7.agbg0=
> 0x0007c850  37310061676267313d37310061676267 71.agbg1=71.agbg
> 37310061676267313d37310061676267 71.agbg1=71.agbg
> ...
>
>
> HW: MacBookPro14,3
> Linux kernel: 4.16.8
> WiFi card: Broadcom Limited BCM43602 802.11ac Wireless LAN SoC (rev 02)
>
> Hope that workaround helps someone, until we get a proper FW, or a
> non-Apple
> replacement, finally :-)
>
> Kind regards,
> Andrey Arapov
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 32 jacooba9 2018-06-05 18:40:16 UTC
When try to open /lib/firmware/brcm/brcmfmac43602-pcie.bin in vim, it appears to be gibberish. Am I doing something wrong? Is this the right file? Is there another way to edit .bin files? Never done this before. Any guidance would be appreciated! Thanks!
Comment 33 Ronald 2018-06-05 21:35:14 UTC
(In reply to jacooba9 from comment #32)
> When try to open /lib/firmware/brcm/brcmfmac43602-pcie.bin in vim, it
> appears to be gibberish. Am I doing something wrong? Is this the right file?
> Is there another way to edit .bin files? Never done this before. Any
> guidance would be appreciated! Thanks!

You want to use an editor capable of handling binary files: one such editor is 'bvi'.
Comment 34 jacooba9 2018-06-05 21:39:35 UTC
Thanks, Ill give that a try!
Comment 35 alex.zerah 2018-06-11 14:22:16 UTC
Hi everyone, i just installed ubuntu 18.04 on my macbook pro 15" 2017 with touchbar. I try "bvi /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig" in the terminal but the file seems empty. I don't  what to do.
Comment 36 LF Chen 2018-06-11 14:38:36 UTC
(In reply to alex.zerah from comment #35)
> Hi everyone, i just installed ubuntu 18.04 on my macbook pro 15" 2017 with
> touchbar. I try "bvi /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig" in the
> terminal but the file seems empty. I don't  what to do.


The driver doesn't have the '.orig' extension, it is just named "brcmfmac43602-pcie.bin". And the '.orig' is used to back up the original driver.
Comment 37 mcgi5sr2 2018-06-11 16:11:14 UTC
Has anyone tried changing the country code to US or another country code. We had a similar issue with broadcom chips on Sony android devices that were only detecting 2.4Ghz networks that was resolved by setting a real country code. Unfortunately I am not in a position to test it for the firmware here but would certainly think it worth attempting.

https://review.carbonrom.org/#/c/6681/1/configs/wifi/bcmdhd.cal

I believe that 00 is the code for `world` a brief google isn't showing me the list I would hope for though
Comment 38 Martin Ghosal 2018-06-16 22:15:27 UTC
attempted to change X0 to 00 and it did not work out. all networking features have gone down now
Comment 39 JR Boyens 2018-06-25 08:24:22 UTC
I've done a bit of work in this area, but really to no avail.

I've ccode=0,regrev=0 works the best, but it isn't great. ccode=XV,regrev=1 has a stronger signal for me, but still has significant drop-out problems. I tried as many combos as I could as well as checking the macOS and Windows drivers/firmwares for specific pieces that may work.

I have not been able to get 5Ghz channels to activate no matter what I've chosen.
Comment 40 Ben Walsh 2018-06-25 08:55:04 UTC
FWIW I've seen problems with the wifi of this machine when running Windows 10 on it installed through BootCamp - problems I've never had when running Mac OS X against the exact same wifi router at almost the same times. I'll document the problems more fully if it'll be useful. Given Apple appear to have thrown considerable weight behind users running Windows on this hardware, perhaps pushing for fixes to problems which can be also be demonstrated under Windows will have more success, while also fixing the problems on Linux.
Comment 41 jakeabeck 2018-06-29 15:49:13 UTC
It would be a big help if someone could post the modified binary file with regrev=0 and ccode=0 (or whatever you have working). If you cant upload the file, could you just open it in sublime and post the text encoding? I’m really struggling with editing the file and getting it to work at all. Please and thank you!
Comment 42 jacooba9 2018-06-30 03:08:22 UTC
the code with regrev=0 and ccode=0  is strictly worse for me: wouldn't connect at all (regardless of the tx-power). 

Anyone have this happen and find a solution?
Comment 43 David Mortals 2018-07-03 03:08:57 UTC
Thanks, FYI, "sudo iwconfig wlp2s0 txpower 10dBm" works well (2.4G only) with
the original firmware (Ubuntu 18.04 + v4.17 custom build kernel) on MacBook Pro 2018 with touchbar.
Comment 44 Aleksei Nosachev 2018-07-04 20:07:45 UTC
In Dell's reddit community to avoid BSODs people are encouraged using a bit more fresh firmware. Tried it already, but seems like it have some differences in init/settings with the linux one. Maybe it is possible to copy only the proprietary part of it.
Currently used version: 7.35.177.61 (r598657) FWID 01-ea662a8c
Attached version: 7.35.240.55 (r609579) FWID 01-89725025
https://www.dell.com/support/home/us/en/04/Drivers/DriversDetails?driverId=JKRJ9
The firmware itself resides in Drivers/WinThresh/WL/x64/43602a1rtecdc.bin
Comment 45 VA 2018-07-10 12:39:49 UTC
Not working with the default value of 31 dBm at home, I have to set it to either 10 or 11 dBm.
At work, where the AP signal strength is poor, it works with the default 31 dBm and only close to AP.
May it be like the driver's number-to-signalstrength value is not linear to real dBm?
Comment 46 sxnguyen 2018-08-19 06:52:25 UTC
Andrey,
Thank you for your works on this.  It seems like it works out well for you... However, when I change my ccode to 0 and regrev to 15 wifi does not start.  Some other people on this thread also reported the same issue.  I can only lower the txpower as the work-around.  However, I cannot connect to most of the wifi as it is too weak.  I really want to get your work-around (modifying the firmware) to work.
Do you have any ideas?
I'm using 
HW: MacBookPro14,3
Linux kernel: 4.17.x (Fedora 28)
WiFi card: Broadcom Limited BCM43602 802.11ac Wireless LAN SoC (rev 02)
Thank you again.


(In reply to Andrey Arapov from comment #25)
> Ok, I am really tired of using a usb wifi dongle, so I was digging a bit
> deeper and here is what I've got.
> 
> Changing ccode=X0 to 0 and regrev=15 to 0 in the firmware seems like
> improving things a little and makes the connection more usable:
> 
> - instantly connecting to the WiFi;
> - link quality=70/70 (Max!);
> - connections is stable, no disconnects;
> - I've got stable 50 Mbps download and 20 Mbps upload (my ISP allows 200/20
> Max as per my contract);
> - The latency gets higher as I am downloading things, but otherwise it is as
> low as it should be;
> - still no 5GHz ... not sure why, maybe some hints what can be changed in
> the FW ? I've tried many things already...;
> 
> 
> --- 8.8.8.8 ping statistics ---
> 100 packets transmitted, 100 received, 0% packet loss, time 99154ms
> rtt min/avg/max/mdev = 8.548/12.201/70.152/8.757 ms
> 
> 
> Here is the FW diff:
> 
> # radiff2 -r /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig
> /lib/firmware/brcm/brcmfmac43602-pcie.bin
> wx 3000 @ 0x0007c82f
> wx 3000 @ 0x0007c839
> 
> # radiff2 -x /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig
> /lib/firmware/brcm/brcmfmac43602-pcie.bin
>   offset     0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF    0 1 2 3 4 5
> 6 7 8 9 A B C D E F 0123456789ABCDEF
> 0x00000000  80f140b882f1a4b982f1b0b982f1bcb9 ..@.............  
> 80f140b882f1a4b982f1b0b982f1bcb9 ..@.............
> 0x00000010  82f1cbb982f1dab982f1e9b982f1f8b9 ................  
> 82f1cbb982f1dab982f1e9b982f1f8b9 ................
> ...
> 0x0007c820! 30643a66343a33650063636f64653d58 0d:f4:3e.ccode=X  
> 30643a66343a33650063636f64653d30 0d:f4:3e.ccode=0
> 0x0007c830! 30007265677265763d31350061613267 0.regrev=15.aa2g  
> 00007265677265763d30000061613267 ..regrev=0..aa2g
> 0x0007c840  3d3700616135673d370061676267303d =7.aa5g=7.agbg0=  
> 3d3700616135673d370061676267303d =7.aa5g=7.agbg0=
> 0x0007c850  37310061676267313d37310061676267 71.agbg1=71.agbg  
> 37310061676267313d37310061676267 71.agbg1=71.agbg
> ...
> 
> 
> HW: MacBookPro14,3
> Linux kernel: 4.16.8
> WiFi card: Broadcom Limited BCM43602 802.11ac Wireless LAN SoC (rev 02)
> 
> Hope that workaround helps someone, until we get a proper FW, or a non-Apple
> replacement, finally :-)
> 
> Kind regards,
> Andrey Arapov
Comment 47 Brian Tarricone 2018-08-29 00:36:59 UTC
I've had a bit more luck with this.

I was a little baffled by the fact that I could see some of my neighbors' 5GHz networks, but not mine.  Output of `sudo iw list | grep -A 15 Frequencies:` gives me a bunch of 5GHz channels, though fewer than I'd expect.

My router was set to automatically pick a channel, and happened to pick something (5580 MHz) not in the list the driver was reporting as supported.  So I manually forced my router to something in the range listed as supported by the driver, and now I can successfully connect to my 5GHz network.

I imagine regulatory domain does matter, so perhaps also ensure that 'crda' is installed, and then you can `iw reg get` and `iw reg set $COUNTRY_CODE` to set yours properly.

For reference, I'm running Debian buster with their stock 4.17.17-1 kernel, with firmware-brcm8-20180518-1 installed.
Comment 48 Brian Tarricone 2018-08-29 00:38:47 UTC
Actually -- and sorry for the noise -- I just had my grep command not printing out everything it should have been printing out, so the higher frequencies are indeed listed by the driver.

But still, maybe despite what the driver supports, it's still having trouble working with some frequencies, so I'd suggest playing around with the channel on the AP.
Comment 49 sxnguyen 2018-09-03 19:47:14 UTC
I found the issue I had with modifying the firmware directly.  I need to change the ccode from X0 to 0. and regrev from 15 to 0. 
So the string would look like this:
=========
ccode=0..regrev=0..aa2g
=========
Once I reboot, I can connect to my wifi without using "sudo iwconfig <> txpower 10dbm" anymore.

My link quality sadly is not 70/70 like Andrey reported. 

I hope this helps someone who wants to modify the firmware directly..

Regards,

(In reply to sxnguyen from comment #46)
> Andrey,
> Thank you for your works on this.  It seems like it works out well for
> you... However, when I change my ccode to 0 and regrev to 15 wifi does not
> start.  Some other people on this thread also reported the same issue.  I
> can only lower the txpower as the work-around.  However, I cannot connect to
> most of the wifi as it is too weak.  I really want to get your work-around
> (modifying the firmware) to work.
> Do you have any ideas?
> I'm using 
> HW: MacBookPro14,3
> Linux kernel: 4.17.x (Fedora 28)
> WiFi card: Broadcom Limited BCM43602 802.11ac Wireless LAN SoC (rev 02)
> Thank you again.
> 
> 
> (In reply to Andrey Arapov from comment #25)
> > Ok, I am really tired of using a usb wifi dongle, so I was digging a bit
> > deeper and here is what I've got.
> > 
> > Changing ccode=X0 to 0 and regrev=15 to 0 in the firmware seems like
> > improving things a little and makes the connection more usable:
> > 
> > - instantly connecting to the WiFi;
> > - link quality=70/70 (Max!);
> > - connections is stable, no disconnects;
> > - I've got stable 50 Mbps download and 20 Mbps upload (my ISP allows 200/20
> > Max as per my contract);
> > - The latency gets higher as I am downloading things, but otherwise it is
> as
> > low as it should be;
> > - still no 5GHz ... not sure why, maybe some hints what can be changed in
> > the FW ? I've tried many things already...;
> > 
> > 
> > --- 8.8.8.8 ping statistics ---
> > 100 packets transmitted, 100 received, 0% packet loss, time 99154ms
> > rtt min/avg/max/mdev = 8.548/12.201/70.152/8.757 ms
> > 
> > 
> > Here is the FW diff:
> > 
> > # radiff2 -r /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig
> > /lib/firmware/brcm/brcmfmac43602-pcie.bin
> > wx 3000 @ 0x0007c82f
> > wx 3000 @ 0x0007c839
> > 
> > # radiff2 -x /lib/firmware/brcm/brcmfmac43602-pcie.bin.orig
> > /lib/firmware/brcm/brcmfmac43602-pcie.bin
> >   offset     0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF    0 1 2 3 4
> 5
> > 6 7 8 9 A B C D E F 0123456789ABCDEF
> > 0x00000000  80f140b882f1a4b982f1b0b982f1bcb9 ..@.............  
> > 80f140b882f1a4b982f1b0b982f1bcb9 ..@.............
> > 0x00000010  82f1cbb982f1dab982f1e9b982f1f8b9 ................  
> > 82f1cbb982f1dab982f1e9b982f1f8b9 ................
> > ...
> > 0x0007c820! 30643a66343a33650063636f64653d58 0d:f4:3e.ccode=X  
> > 30643a66343a33650063636f64653d30 0d:f4:3e.ccode=0
> > 0x0007c830! 30007265677265763d31350061613267 0.regrev=15.aa2g  
> > 00007265677265763d30000061613267 ..regrev=0..aa2g
> > 0x0007c840  3d3700616135673d370061676267303d =7.aa5g=7.agbg0=  
> > 3d3700616135673d370061676267303d =7.aa5g=7.agbg0=
> > 0x0007c850  37310061676267313d37310061676267 71.agbg1=71.agbg  
> > 37310061676267313d37310061676267 71.agbg1=71.agbg
> > ...
> > 
> > 
> > HW: MacBookPro14,3
> > Linux kernel: 4.16.8
> > WiFi card: Broadcom Limited BCM43602 802.11ac Wireless LAN SoC (rev 02)
> > 
> > Hope that workaround helps someone, until we get a proper FW, or a
> non-Apple
> > replacement, finally :-)
> > 
> > Kind regards,
> > Andrey Arapov
Comment 50 Rasmus 2018-11-15 08:27:20 UTC
With ccode and regrev set to 0 I can see some networks, with ccode set to EU and regrev to 66 I think I can see all 2.4GHz networks. However, still with a very weak signal and changing txpower does nothing to fix that.
I also can't get 5GHz to work at all.

Is it possible to extract some usable things from the Windows driver?
If I remember correctly there was a project to support Windows wifi drivers a long time ago.
Comment 51 Simon Siebert 2019-11-02 12:22:10 UTC
I had some success on a 13,3 Macbook using the bcm43602 chipset by adding the 
brcmfmac43602-pcie.txt to /lib/firmware/brcm on kernel 5.4 .

I first used files from different chips as a basis for the content, enabling the device to see 5ghz and in the end to establish a stable connection with my 5Ghz network.

I used the textfiles found in the windows driver package for Broadcom BCM94350ZAE DW1820A, changing device ids and macaddress to the values of my device.
Comment 52 Simon Siebert 2019-11-02 16:41:15 UTC
Created attachment 285753 [details]
brcmfmac43602-pcie.txt working on macbook 13.3

The mentioned text file. I removed the macaddress of my device and replaced it with xx:xx:xx:xx:xx:xx . For usage I think you have to replace it with the macaddress of your device.
Comment 53 Andrey Arapov 2019-11-06 12:01:12 UTC
Hi Simon,

I have tried what you have suggested and voila!
Everything is working, 2GHz, 5GHz wireless networks.
Now I can finally get rid of my USB Wi-Fi dongle!

Much thank you for sharing this finding and making life easier :-)


I have also figured that the brcmfmac43602-pcie.bin driver has a hardcoded mac address in Linux:

# strings /lib/firmware/brcm/brcmfmac43602-pcie.bin |grep macaddr=
macaddr=%s
macaddr=00:90:4c:0d:f4:3e

So brcmfmac43602-pcie.txt file can be unique and everyone can start using their wifi card by simply placing it to their /lib/firmware/brcm/ directory, reloading the brcmfmac driver.

I guess the next step would be figuring a legal way of shipping that file along with the linux-firmware package so everyone can finally get their wifi adapter working.

Does anyone know who is able making this into a linux-firmware package?


Kind Regards,
Andrey Arapov
Comment 54 Daniel Roschka 2019-11-06 16:31:23 UTC
While 5Ghz WiFi networks seem to work with this txt file, I can't get 2.4Ghz networks to work with it on my MacBookPro13,2.
Comment 55 Simon Siebert 2019-11-07 11:47:03 UTC

I also experienced some 2,4Ghz not connecting successfully, while others work fine.

I think there is still some modification of the parameters needed to find an optimal configuration and I will definitely do this at some point.

Unfortunately documentation for the parameters is not that good and the only method currently available to me is trial and error.

@Andrey: Great to hear that this works for you
Comment 56 IggyPop 2019-11-22 02:02:08 UTC
I created an account just to say thanks to you Simon and Andrey. It is working great for me (on 5GHz, haven't tried 2.4GHz).
Comment 57 domhnall.tilliere 2019-11-30 17:57:43 UTC
Thanks for the driver config, it does seem to help, but I have one problem I’m hoping ya‘lol can help with:

I can get the config to apply with an installed OS by restarting the machine, but that’s not very graceful. Plus, I also want to apply this config during an install, so restart isn’t viable.

How exactly do I go about “ reloading the brcmfmac driver”. Please ELI5

Thanks for your help :)
Comment 58 Simon Siebert 2019-12-06 10:34:03 UTC
@domhnall.tilliere@gmail.com

rmmod brcmfmac && modprobe brcmfmac
Comment 59 adityaxavier 2019-12-18 13:27:10 UTC
I tried the txt file you attached, however I could not get 5Ghz to work at all..

It gave me error saying clm blob is not found and hence it disabled some bands.

I am not sure how I need to extract them from Catalina..
Comment 60 adityaxavier 2019-12-19 07:57:39 UTC
@mail@simonsiebert.de

I found the problem.. It seems the problem is because of Region.. Many 5GHz channels are disabled and my Wi-Fi Network was part of that, so could not even see it.

I tried setting iw reg set 00, and even though it enables it I was not able to see the networks. I guess I need to turn it off and on again ?
Comment 61 IggyPop 2019-12-19 16:09:50 UTC
I’m not sure that it’ll work. You may have better luck modifying the driver file.
Comment 62 nonylus 2020-01-02 07:32:47 UTC
Thank you all so much for the research and solutions!
I was finally able to connect to my WiFi with my MacBookPro14.2

Distribution: 

$ uname -a
Linux caribou-MacBookPro 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ lspci -nn -d 14e4:
02:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM43602 802.11ac Wireless LAN SoC [14e4:43ba] (rev 02)

____________________
First section of the text file: brcmfmac43602-pcie.txt

boardrev=0x1101

sromrev=11
boardtype=0x073e
vendid=0x14e4
devid=0x43ba

macaddr=00:90:4c:0d:f4:3e

ccode=0
regrev=1
_______________________

So for new 2020 comers, here's what I did to solve the issue (I first had to reinstall the WiFi driver)
I solved my initial issue by reinstalling the WiFi driver for my chip using this article:
https://askubuntu.com/questions/55868/installing-broadcom-wireless-drivers

1. How I was able to reinstall the proper WiFi driver if you experience the No WiFi Adapter is available issue in Settings>WiFi
sudo apt-get purge bcmwl-kernel-source
sudo apt update
sudo update-pciids
sudo apt install firmware-b43-installer
sudo reboot


2. How I resolved connectivity issues
- Downloaded brcmfmac43602-pcie.txt here: https://bugzilla.kernel.org/attachment.cgi?id=285753
- Opened in Text Editor
- Changed the following lines:
macaddr=xx:xx:xx:xx:xx:xx
ccode=X3
regrev=15

to

macaddr=00:90:4c:0d:f4:3e
ccode=0
regrev=1

In Terminal:
sudo cp ~/Downloads/brcmfmac43602-pcie.txt /lib/firmware/brcm/
sudo reboot


Et voila le travail! I'm now writing this from my MacBook Pro connected on WiFi :)
So far great speeds and latency:

Download: 270Mbps
Latency Unloaded: 2ms
Latency Loaded :15 ms
Upload Speed: 180 Mbps

Happy New Year everyone!
Comment 63 Andy Holst 2020-01-11 16:41:18 UTC
The WIFI drivers worked just fine for me on MacBookPro13,3 with Linux Mint 19.3 and Linux kernel version 5.4.6; I needed to download the brcmfmac43602-pcie.txt from https://bugzilla.kernel.org/attachment.cgi?id=285753 and setup macaddr properly with help of the command 'ifconfig -a wlp3s0' and copy the modified file to /lib/firmware/brcm/brcmfmac43602-pcie.txt destination; after an 'sudo rmmod brcmfmac && sudo modprobe brcmfmac' it worked so I could connect to an 5G router with good speed and latency.

For more system info go to https://termbin.com/ozy4
Comment 64 sonal.santan 2020-02-19 03:34:08 UTC
Created attachment 287497 [details]
NVRAM captured via VFIO trace of Windows BRCM driver

I have a MacBookPro14,3 which I have been using with Ubuntu 18.04 and 5.3 kernel. WiFi has poor performance even with brcmfmac43602-pcie.txt from https://bugzilla.kernel.org/attachment.cgi?id=285753.

I validated Broadcom drivers shipped with Apple's BootCamp on a Windows VM running on this Macbook. The Broadcom WiFi device was assigned to Windows VM via PCIe pass through and it worked great in that environment. I then setup vfio_region_write tracing to capture FW and NVRAM from Windows environment which yielded the attached files. Sadly they do not seem to work with Linux brcmfmac drivers. I see FW initialization error. 

I am attaching them here in case someone who is knowledgeable about BRCM WiFi drivers would like to take a look.
Comment 65 sonal.santan 2020-02-19 03:35:52 UTC
Created attachment 287499 [details]
FW captured via VFIO trace of Windows BRCM driver

If you would like to learn more about the setup I used to capture this let me know.
Comment 66 Christian Stewart 2020-05-19 16:45:56 UTC
I have two different identical MacBooks with BCM43602 on Kernel 5.6.13 with brcmfmac. One of them works perfectly, and is stable, fast, etc. The other barely connects, often doesn't work at all, has numerous dmesg errors about brcmfmac, and has poor performance and reception quality.

How can this be possible? Identical software images, different performance?

I really wish Broadcom would get their act together and support their own hardware. This is pretty bad to have such poor performance on the mainline driver with a relatively recent (5 yrs) set of hardware.

Note this happens both with and without the firmware configuration .txt.

Is there any further information on fixing this? Thanks.
Comment 67 sonal.santan 2020-05-26 00:25:11 UTC
(In reply to sonal.santan from comment #65)
> Created attachment 287499 [details]
> FW captured via VFIO trace of Windows BRCM driver
> 
> If you would like to learn more about the setup I used to capture this let
> me know.

https://github.com/sonals/macbookpro14-3/blob/master/doc/MMIOTrace.rst
Comment 68 Jordan De Sotle 2020-05-26 19:04:46 UTC
(In reply to nonylus from comment #62)
> Thank you all so much for the research and solutions!
> I was finally able to connect to my WiFi with my MacBookPro14.2
> 
> Distribution: 
> 
> $ uname -a
> Linux caribou-MacBookPro 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14
> 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
> 
> $ lspci -nn -d 14e4:
> 02:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM43602
> 802.11ac Wireless LAN SoC [14e4:43ba] (rev 02)
> 
> ____________________
> First section of the text file: brcmfmac43602-pcie.txt
> 
> boardrev=0x1101
> 
> sromrev=11
> boardtype=0x073e
> vendid=0x14e4
> devid=0x43ba
> 
> macaddr=00:90:4c:0d:f4:3e
> 
> ccode=0
> regrev=1
> _______________________
> 
> So for new 2020 comers, here's what I did to solve the issue (I first had to
> reinstall the WiFi driver)
> I solved my initial issue by reinstalling the WiFi driver for my chip using
> this article:
> https://askubuntu.com/questions/55868/installing-broadcom-wireless-drivers
> 
> 1. How I was able to reinstall the proper WiFi driver if you experience the
> No WiFi Adapter is available issue in Settings>WiFi
> sudo apt-get purge bcmwl-kernel-source
> sudo apt update
> sudo update-pciids
> sudo apt install firmware-b43-installer
> sudo reboot
> 
> 
> 2. How I resolved connectivity issues
> - Downloaded brcmfmac43602-pcie.txt here:
> https://bugzilla.kernel.org/attachment.cgi?id=285753
> - Opened in Text Editor
> - Changed the following lines:
> macaddr=xx:xx:xx:xx:xx:xx
> ccode=X3
> regrev=15
> 
> to
> 
> macaddr=00:90:4c:0d:f4:3e
> ccode=0
> regrev=1
> 
> In Terminal:
> sudo cp ~/Downloads/brcmfmac43602-pcie.txt /lib/firmware/brcm/
> sudo reboot
> 
> 
> Et voila le travail! I'm now writing this from my MacBook Pro connected on
> WiFi :)
> So far great speeds and latency:
> 
> Download: 270Mbps
> Latency Unloaded: 2ms
> Latency Loaded :15 ms
> Upload Speed: 180 Mbps
> 
> Happy New Year everyone!

Wow. Very helpful. Ive been searching for days and this finally did it for me!
Comment 69 Andreas 2020-07-02 15:11:58 UTC
I found multiple newer firmware releases from the Dell support for "Dell Wireless 1820A / 1830" 

linux-firmware-1.187.1:
Nov 10 2015 06:38:10 version 7.35.177.61 (r598657) FWID 01-ea662a8c

9350_Network_Driver_98WFD_WN32_1.400.31.0_A00
in WLAN/Drivers/Win8X/WL/x64/43602a1rtecdc.bin:
Version: 7.35.240.19 CRC: 6d04f9f7 Date: Fri 2015-05-29 04:50:00 PDT Ucode Ver: 986.118 FWID: 01-62050ded

9550_Network_Driver_8Y3XG_WN32_1.566.0.0_A05
in Drivers/WinThresh/WL/x64/43602a1rtecdc.bin:
Version: 7.35.240.55 CRC: 4334b56c Date: Mon 2016-01-04 18:13:51 PST Ucode Ver: 986.120 FWID: 01-89725025

DW1820A_1830_WiFi_Win10_x64_1.566.0.2_SETUP_ZPE
in 43602a1rtecdc.bin:
Version: 7.35.240.62 (r726950) CRC: 81df8a3c Date: Tue 2017-10-17 04:03:47 PDT Ucode Ver: 986.120 FWID: 01-404d345a




Loading firmware 7.35.240.62 works, but unloading gives a general protection fault:

[ 2765.148420] usbcore: registered new interface driver brcmfmac
[ 2765.255773] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43602-pcie for chip BCM43602/2
[ 2765.265047] brcmfmac 0000:03:00.0: Direct firmware load for brcm/brcmfmac43602-pcie.Apple Inc.-MacBookPro14,3.txt failed with error -2
[ 2765.265099] brcmfmac 0000:03:00.0: Direct firmware load for brcm/brcmfmac43602-pcie.txt failed with error -2
[ 2765.546944] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43602-pcie for chip BCM43602/2
[ 2765.547004] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[ 2765.547882] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43602/2 wl0: Oct 17 2017 04:02:28 version 7.35.240.62 (r726950) FWID 01-404d345a
[ 2765.590383] brcmfmac 0000:03:00.0 wlp3s0: renamed from wlan0
[ 2930.411458] usbcore: deregistering interface driver brcmfmac
[ 2930.491263] general protection fault, probably for non-canonical address 0xf5202d798fe1c129: 0000 [#1] SMP PTI
[ 2930.491266] CPU: 7 PID: 41344 Comm: rmmod Tainted: P           OE     5.6.0-1018-oem #18-Ubuntu
[ 2930.491267] Hardware name: Apple Inc. MacBookPro14,3/Mac-XYZ, BIOS 207.0.0.0.0 04/24/2020
[ 2930.491278] RIP: 0010:brcmf_fil_bsscfg_data_set+0x1f/0x130 [brcmfmac]
[ 2930.491280] Code: ec e0 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41 55 49 89 f5 41 54 41 89 cc 53 48 89 fb 48 83 ec 18 <48> 8b 07 48 89 55 c8 4c 8d b0 80 01 00 00 48 89 45 d0 4c 89 f7 e8
[ 2930.491281] RSP: 0018:ffffc0802e40bcb0 EFLAGS: 00010282
[ 2930.491283] RAX: 0000000000000000 RBX: f5202d798fe1c129 RCX: 0000000000000006
[ 2930.491284] RDX: ffffc0802e40bd02 RSI: ffffffffc160867c RDI: f5202d798fe1c129
[ 2930.491285] RBP: ffffc0802e40bcf0 R08: 0000000000000000 R09: ffffffffa2b1d100
[ 2930.491286] R10: ffff9e72759bd300 R11: 0000000000000001 R12: 0000000000000006
[ 2930.491287] R13: ffffffffc160867c R14: 0000000000000000 R15: dead000000000100
[ 2930.491288] FS:  00007f48da3a3540(0000) GS:ffff9e72eedc0000(0000) knlGS:0000000000000000
[ 2930.491289] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2930.491290] CR2: 0000563e7715fc40 CR3: 00000001d7834005 CR4: 00000000003606e0
[ 2930.491291] Call Trace:
[ 2930.491300]  brcmf_p2p_set_discover_state+0x6b/0x90 [brcmfmac]
[ 2930.491307]  brcmf_p2p_cancel_remain_on_channel.part.0+0x19/0x30 [brcmfmac]
[ 2930.491314]  brcmf_p2p_detach+0x26/0x70 [brcmfmac]
[ 2930.491321]  brcmf_detach+0xe5/0x100 [brcmfmac]
[ 2930.491330]  brcmf_pcie_remove+0x78/0x110 [brcmfmac]
[ 2930.491333]  pci_device_remove+0x3e/0xb0
[ 2930.491336]  device_release_driver_internal+0xf0/0x1d0
[ 2930.491338]  driver_detach+0x4c/0x8f
[ 2930.491340]  bus_remove_driver+0x5c/0xd0
[ 2930.491342]  driver_unregister+0x31/0x50
[ 2930.491345]  pci_unregister_driver+0x40/0x90
[ 2930.491354]  brcmf_pcie_exit+0x2d/0x30 [brcmfmac]
[ 2930.491365]  brcmf_core_exit+0x1f/0x9b0 [brcmfmac]
[ 2930.491375]  brcmfmac_module_exit+0x9/0x21 [brcmfmac]
[ 2930.491378]  __x64_sys_delete_module+0x147/0x2b0
[ 2930.491381]  ? exit_to_usermode_loop+0xea/0x160
[ 2930.491383]  do_syscall_64+0x57/0x1b0
[ 2930.491386]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 2930.491388] RIP: 0033:0x7f48da4efa3b
[ 2930.491390] Code: 73 01 c3 48 8b 0d 55 84 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 25 84 0c 00 f7 d8 64 89 01 48
[ 2930.491391] RSP: 002b:00007fff128b2778 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
[ 2930.491392] RAX: ffffffffffffffda RBX: 000055de65d47520 RCX: 00007f48da4efa3b
[ 2930.491394] RDX: 000000000000000a RSI: 0000000000000800 RDI: 000055de65d47588
[ 2930.491395] RBP: 00007fff128b27d8 R08: 0000000000000000 R09: 0000000000000000
[ 2930.491396] R10: 00007f48da56bac0 R11: 0000000000000206 R12: 00007fff128b29b0
[ 2930.491397] R13: 00007fff128b37c2 R14: 000055de65d452a0 R15: 000055de65d47520
[ 2930.491398] Modules linked in: brcmfmac(-) rfcomm cmac algif_hash overlay algif_skcipher af_alg bnep binfmt_misc nls_iso8859_1 intel_rapl_msr mei_hdcp apple_ib_als(OE) snd_hda_codec_hdmi snd_hda_codec_generic intel_rapl_common ledtrig_audio industrialio_triggered_buffer x86_pkg_temp_thermal kfifo_buf industrialio snd_usb_audio intel_powerclamp apple_ib_tb(OE) snd_hda_intel snd_intel_dspcfg snd_hda_codec coretemp uvcvideo snd_usbmidi_lib snd_hda_core snd_seq_midi brcmutil applesmc ax88179_178a snd_seq_midi_event videobuf2_vmalloc usbnet snd_rawmidi snd_hwdep videobuf2_memops kvm_intel mii videobuf2_v4l2 kvm snd_pcm videobuf2_common cfg80211 snd_seq intel_cstate videodev intel_rapl_perf hci_uart snd_seq_device input_leds joydev mc btqca btrtl btbcm btintel snd_timer mei_me mei snd 8250_dw soundcore bluetooth sbs ecdh_generic apple_gmux sbshc ecc mac_hid apple_bl sch_fq_codel apple_ibridge(OE) parport_pc ppdev lp parport ip_tables x_tables autofs4 zfs(PO) zunicode(PO) zavl(PO) icp(PO)
[ 2930.491426]  zcommon(PO) znvpair(PO) spl(O) zlua(PO) dm_crypt hid_generic usbhid hid spi_pxa2xx_platform dw_dmac dw_dmac_core amdgpu crct10dif_pclmul crc32_pclmul amd_iommu_v2 gpu_sched ghash_clmulni_intel i2c_algo_bit ttm aesni_intel drm_kms_helper crypto_simd syscopyarea cryptd sysfillrect glue_helper sysimgblt nvme i2c_i801 fb_sys_fops intel_lpss_pci cec intel_lpss nvme_core rc_core idma64 virt_dma drm thunderbolt applespi(OE) video [last unloaded: brcmfmac]
[ 2930.491442] ---[ end trace df3481628c70ae1d ]---
[ 2930.491449] RIP: 0010:brcmf_fil_bsscfg_data_set+0x1f/0x130 [brcmfmac]
[ 2930.491451] Code: ec e0 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41 55 49 89 f5 41 54 41 89 cc 53 48 89 fb 48 83 ec 18 <48> 8b 07 48 89 55 c8 4c 8d b0 80 01 00 00 48 89 45 d0 4c 89 f7 e8
[ 2930.491452] RSP: 0018:ffffc0802e40bcb0 EFLAGS: 00010282
[ 2930.491453] RAX: 0000000000000000 RBX: f5202d798fe1c129 RCX: 0000000000000006
[ 2930.491454] RDX: ffffc0802e40bd02 RSI: ffffffffc160867c RDI: f5202d798fe1c129
[ 2930.491455] RBP: ffffc0802e40bcf0 R08: 0000000000000000 R09: ffffffffa2b1d100
[ 2930.491456] R10: ffff9e72759bd300 R11: 0000000000000001 R12: 0000000000000006
[ 2930.491457] R13: ffffffffc160867c R14: 0000000000000000 R15: dead000000000100
[ 2930.491459] FS:  00007f48da3a3540(0000) GS:ffff9e72eedc0000(0000) knlGS:0000000000000000
[ 2930.491460] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2930.491461] CR2: 0000563e7715fc40 CR3: 00000001d7834005 CR4: 00000000003606e0
Comment 70 Ernst 2020-07-09 13:35:08 UTC
Hi Andrey and others,

Unfortunately, for me the workaround doesn't work. :( Have a MBP14.2 with 5.4.0-40-generic kernel. I put the txt-file with correct macaddress in relevant directory /lib/firmware/brcm/ and reloaded brcmfmac driver, but to no avail. Haven't tried fiddling with the bin-file yet, though.

I can see my wifi, but connection doesn't work. Instead I am being prompted to reenter password (although I'm a 100% sure, it's the correct one). This is what ~$ dmesg | grep brcmfmac returns:

[  465.693044] usbcore: registered new interface driver brcmfmac
[  465.801029] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43602-pcie for chip BCM43602/2
[  465.801474] brcmfmac 0000:02:00.0: Direct firmware load for brcm/brcmfmac43602-pcie.Apple Inc.-MacBookPro14,2.txt failed with error -2
[  466.009367] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43602-pcie for chip BCM43602/2
[  466.009429] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[  466.010318] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43602/2 wl0: Nov 10 2015 06:38:10 version 7.35.177.61 (r598657) FWID 01-ea662a8c
[  466.083959] brcmfmac 0000:02:00.0 wlp2s0: renamed from wlan0

And logs additionally say:

wlp2s0: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="M46yoah" auth_failures=1 duration=10 reason=CONN_FAILED (sender: wpa_supplicant)
wlp2s0: CTRL-EVENT-ASSOC-REJECT bssid=00:00:00:00:00:00 status_code=16 (sender: wpa_supplicant)

Can anybody help? Would be much appreciated. <3
Ernst

@mail@simonsiebert.de
@danielroschka+kernel@phoenitydawn.de
@andrey.arapov@nixaid.com

(In reply to Andrey Arapov from comment #53)
> Hi Simon,
> 
> I have tried what you have suggested and voila!
> Everything is working, 2GHz, 5GHz wireless networks.
> Now I can finally get rid of my USB Wi-Fi dongle!
> 
> Much thank you for sharing this finding and making life easier :-)
> 
> 
> I have also figured that the brcmfmac43602-pcie.bin driver has a hardcoded
> mac address in Linux:
> 
> # strings /lib/firmware/brcm/brcmfmac43602-pcie.bin |grep macaddr=
> macaddr=%s
> macaddr=00:90:4c:0d:f4:3e
> 
> So brcmfmac43602-pcie.txt file can be unique and everyone can start using
> their wifi card by simply placing it to their /lib/firmware/brcm/ directory,
> reloading the brcmfmac driver.
> 
> I guess the next step would be figuring a legal way of shipping that file
> along with the linux-firmware package so everyone can finally get their wifi
> adapter working.
> 
> Does anyone know who is able making this into a linux-firmware package?
> 
> 
> Kind Regards,
> Andrey Arapov
Comment 71 Andy Holst 2020-07-24 21:24:50 UTC
(In reply to sonal.santan from comment #64)
> Created attachment 287497 [details]
> NVRAM captured via VFIO trace of Windows BRCM driver
> 
> I have a MacBookPro14,3 which I have been using with Ubuntu 18.04 and 5.3
> kernel. WiFi has poor performance even with brcmfmac43602-pcie.txt from
> https://bugzilla.kernel.org/attachment.cgi?id=285753.
> 
> I validated Broadcom drivers shipped with Apple's BootCamp on a Windows VM
> running on this Macbook. The Broadcom WiFi device was assigned to Windows VM
> via PCIe pass through and it worked great in that environment. I then setup
> vfio_region_write tracing to capture FW and NVRAM from Windows environment
> which yielded the attached files. Sadly they do not seem to work with Linux
> brcmfmac drivers. I see FW initialization error. 
> 
> I am attaching them here in case someone who is knowledgeable about BRCM
> WiFi drivers would like to take a look.

Thank you for your contribution with the generated NVRAM VFIO trace broadcom 43602 Windows text file. I tested your configuration file and removed some parts of it and added the swctrlmap_5g and swctrlmapext_5g keys with their respective values from https://bugzilla.kernel.org/show_bug.cgi?id=193121#c52 to get the 5 Ghz band working and the the double download speed from 40 Mbit/s up to 80 Mbit/s compared to the 'original' brcmfmac43602-pcie.txt configuration.

https://github.com/Dunedan/mbp-2016-linux/issues/47#issuecomment-663737153
Comment 72 Andy Holst 2020-07-24 21:27:45 UTC
Created attachment 290545 [details]
Modified brcmfmac43602-pcie file from the captured NVRAM VFIO trace
Comment 73 Andy Holst 2020-07-25 02:35:33 UTC
Created attachment 290553 [details]
A few more boardflags modifications to brcmfmac43602-pcie.txt configuration

Did a few more boardflags modifications to be similar to the original the NVRAM VFIO trace for the brcmfmac 43602 driver generated by Sonal Santan.

Need to figure out what values needs to be set for swctrlmap_2g and swctrlmapext_2g so the 2 Ghz band setup can work along with the fast and stable 5 Ghz band setup.
Comment 74 Andy Holst 2020-07-26 02:46:09 UTC
Created attachment 290569 [details]
Remodified the brcmfmac43602-pcie.txt file for testing out 2.4/5 Ghz band

Ok, I am going at the right direction, I did compare the brcmfmac43602-pcie.txt configuration file generated by the NVRAM VFIO trace and compared the hex values for the boardflags2 and boardflags3 keys with the original brcmfmac43602-pcie.bin file when none configuration is set. I can confirm that the boardflags3 is the one 'deciding' if 2.4Ghz band and 5Ghz band is going to be used.

The original boardflags2 and boardflags3 hex values from the original brcmfmac43602-pcie.bin without configuration is:

boardflags2=0x00000002
boardflags3=0x00000003

With this configuration along with the NVRAM VFIO trace file data, the 2 Ghz band connection works just fine during boot or through the `sudo rmmod brcmfmac && sudo modprobe brcmfmac` command. By setting the boardflags3 to 0x00000300 the 5 Ghz band works very well with 60/80 Mbits internet download connection.

The last piece of the puzzle if possible is to figure out what combination needs to be set for boardflags3 to enable 2.4/5 Ghz band at the same time, 0x00000303 did not do it, it only enabled 5Ghz band, anyone want to try to brute force the combination? :)

So either use boardflags3 hex value 0x00000300 for 5 Ghz band (0x00000303) or 0x00000003 for 2 Ghz band and use the proper `sudo rmmod brcmfmac && sudo modprobe brcmfmac` command after the change to the brcmfmac43602-pcie.txt for it to take effect.
Comment 75 Diego Ortiz 2020-08-03 15:09:37 UTC
Hey guys sorry if this isn’t the right place to ask this but, i would like to install debian on my macbook pro 13,2. I also have windows installed on bootcamp and since i’ve started a career on backend web development i need to have linux installed for deployment. So idk exactly where to start, i been reading a lot of incompatibilities with the wifi card, the sound, etc. So im kinda lost.
Comment 76 djullier 2020-08-03 15:15:42 UTC
Hello,

Thank you for your e-mail. I am out of the office until March 10 and will not have access to
my e-mail during that period.


For operational matters, please contact Mission Control, +800 00 724 000.

Best regards
Dominique Jullier

Note You need to log in before you can comment on or make changes to this bug.