Bug 98011 - Broadcom 43341 sdio wireless card lacks wireless 5GHz support on brcmfmac module
Summary: Broadcom 43341 sdio wireless card lacks wireless 5GHz support on brcmfmac module
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: All Linux
: P1 low
Assignee: Arend van Spriel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-09 16:01 UTC by Francesco Bonanno
Modified: 2017-08-27 01:35 UTC (History)
7 users (show)

See Also:
Kernel Version: 4.1-rc2
Tree: Mainline
Regression: No


Attachments
dmesg for the broadcom 43341 card, using brcmfmac and firmware from linux-firmware + T200TA nvram (3.56 KB, text/plain)
2015-05-09 16:01 UTC, Francesco Bonanno
Details
compiling brcmfmac with debug (9.02 KB, text/x-log)
2015-05-31 14:01 UTC, Francesco Bonanno
Details
revinfo (319 bytes, text/plain)
2015-06-01 13:43 UTC, Francesco Bonanno
Details
dmesg + /sys/kernel/debug/brcmfmac/mmc1:0001:1/revinfo (227.50 KB, text/x-log)
2015-07-10 22:25 UTC, Francesco Bonanno
Details

Description Francesco Bonanno 2015-05-09 16:01:31 UTC
Created attachment 176301 [details]
dmesg for the broadcom 43341 card, using brcmfmac and firmware from linux-firmware + T200TA nvram

I am running a linux distribution on my Asus Transformer Book T200TA (Ubuntu x86_64 in this case). The wireless chip is a sdio Broadcom 43341 : https://www.broadcom.com/products/Wireless-LAN/802.11-Wireless-LAN-Solutions/BCM43341 . 

It is seen as a bcm43340 as the wireless part of the chipset is similar. Really, it is working but only on 2.4 GHz with the firmware loaded contained into linux-firmware, brcmfmac43340-sdio.bin . Anyway I have had extracted the firmware also from the OEM copy of windows 8.1 preinstalled on the device, specific for the 43341. brcmfmac can load it too, and with it the wireless card can see the 5GHz wireless networks; but I can not connect to any network even if it is a 2.4 or 5GHz network.

The device is a wireless 2.4/5GHz, bluetooth 4.0, nfc card and fm receiver. I imagine that it will be hard to get working nfc and the fm receiver, but at least it should work as 2.4/5GHz wireless card and bluetooth card.

I am going to open another bug report for the bluetooth part. Please feel free to request everything it is needed if there is the possibility to fix this problem.
Comment 1 Arend van Spriel 2015-05-26 08:18:51 UTC
Can you provide a dump of debugfs entry, ie.:

# cd /sys/kernel/debug/brcmfmac/*
# cat revinfo
Comment 2 Francesco Bonanno 2015-05-26 11:08:55 UTC
I do not have brcmfmac under /sys/kernel/debug and so also revinfo.
Comment 3 Arend van Spriel 2015-05-31 07:10:32 UTC
(In reply to Francesco Bonanno from comment #2)
> I do not have brcmfmac under /sys/kernel/debug and so also revinfo.

The brcmfmac driver needs to be build with CONFIG_BRCMDBG selected in .config.
Comment 4 Francesco Bonanno 2015-05-31 14:01:13 UTC
Created attachment 178411 [details]
compiling brcmfmac with debug
Comment 5 Francesco Bonanno 2015-05-31 14:03:30 UTC
Comment on attachment 178411 [details]
compiling brcmfmac with debug

I was compiling the driver, while I got an error from the compiler.
Comment 6 Arend van Spriel 2015-06-01 09:06:07 UTC
What build steps did you do. I would expect these:

1. make M=drivers/net/wireless/brcm80211 clean
2. make menuconfig
#enable BRCMDBG
3. make modules_prepare
4. make M=drivers/net/wireless/brcm80211 modules
Comment 7 Francesco Bonanno 2015-06-01 13:43:05 UTC
Created attachment 178471 [details]
revinfo

Sorry, I was compiling the brcmfmac module without the brcmutil module, I have noticed this later. Meanwhile I have upgraded the kernel from the rc5 to the rc6.
So I have put in the attachment the output from the revinfo.
Comment 8 Arend van Spriel 2015-07-10 21:18:06 UTC
can you create a log while doing 'modprobe brcmfmac debug=0x1416'?
Comment 9 Francesco Bonanno 2015-07-10 22:25:03 UTC
Created attachment 182391 [details]
dmesg + /sys/kernel/debug/brcmfmac/mmc1:0001:1/revinfo

But really the wireless card it's working. https://www.kernel.org/pub/linux/kernel/projects/backports/2015/06/ it seems that with both of the backports of June (and the new mainline kernel, the 4.2rc1) the card works as expected. I can see and connect also to the 5GHz wireless networks. Now, I have (and I imagine all the owners of this broadcom product) only this bug: https://bugzilla.kernel.org/show_bug.cgi?id=98021 related to the bluetooth part of the device and a strange behavior of the driver. Sometimes at startup it is not loaded fine, so I have to restart (sometimes more than once) to get it working, and not I can not load or reload the driver at runtime but only at startup. But I imagine that this requires another bug report.
Comment 10 Marcin Mielniczuk 2015-09-11 12:16:46 UTC
Francesco,

How did you convince the kernel to use the 43341 firmware instead of 43340?
Comment 11 Francesco Bonanno 2015-09-12 16:29:32 UTC
The devices are so much similar, so the 43341 is seen as the 43340. I have renamed the firmware so the brcmfmac was capable of injecting the binary and (apart from the uart bt) it is working. I suggest to use at the moment, if there is not a way to diversify one from each other, a script to ask the user only once if the chip is a 43341 or a 43340, or, because the kernel knows the model of the hw where it is working (as one example, in installation phase the hostname suggested was for me *-T200T*), to use a firmware instead of another. For example my T200TA is using for sure a 43341 and surely the X205TA (both asus) as documented here: https://wiki.debian.org/InstallingDebianOn/Asus/X205TA . Maybe it will be a possible temporary workaround, with the hope of the differentiation of the two chips in the future.
Comment 12 Ferry Toth 2017-06-08 23:01:11 UTC
On Intel Edison with 4.11 I have 2.4 and 5GHz working fine. That is with using firmware (a newer version exists on kernel.org) + calibration file. Files needs to be renamed as mentioned after boot in dmesg.
Comment 13 Francesco Bonanno 2017-08-27 01:35:40 UTC
Hi guys! It passed a while, but I want to share with you the fix. After fetching the nvram from the efivars (the txt file loaded with the binary blob to understand), just edit it, the line with the "ccode". The value is a "XV". Well, just change it to a valid regional code (00 the world regulator or other local regional codes like IT, US...) and unloading and loading the module (or rebooting), will make the chip work also in 5GHz band. 

Tested the whole thing on Linux 4.12 x86_64, generic and lowlatency, with the standard linux-firmware equipment, however I expect it to work also on linux upper and lower the 4.12 (above the 4.0 surely), for every architecture.

I think there should be a firmware utility at this point, that gets automatically the nvram from efivars and automatically change the necessary parts, according to the variant of the brcmfmac/smac chip tried to load, or when the system is booted in legacy mode:

A) Videoprint a message "You should reboot in EFI/UEFI mode"

B) The firmware-linux repo (and so also the packages of the distros) has to provide a basic working nvram with the blob. The efi enabled ones can contribute to collect the nvram configs in txts files, and so they can be shipped with linux-firmware. Can be installed/used the config according to some params (the name/model of the board/pc Linux is running on, manually passed at linux-firmware installion time/module brcmfmac/smac loaded)

At least, I can provide the nvram for the ASUS T200TA and improve it (experimenting with it, passing the working configurations when something is improved).

I hope this will be helpful!

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