raspberry-pi-pcie-devices icon indicating copy to clipboard operation
raspberry-pi-pcie-devices copied to clipboard

Test Broadcom BCM94360NG 802.11ac WiFi Card

Open geerlingguy opened this issue 4 years ago • 9 comments
trafficstars

I have a Broadcom BCM94360NG 802.11ac WiFi Card which I'd like to see if I can get running on the Pi.

DSC_4321

Haven't tried any Broadcom wireless gear yet, so hopefully it's not too difficult.

geerlingguy avatar Feb 17 '21 22:02 geerlingguy

$ sudo lspci -vvvv -d 14e4:43a0
03:00.0 Network controller: Broadcom Limited BCM4360 802.11ac Wireless Network Adapter (rev 03)
	Subsystem: Apple Inc. BCM4360 802.11ac Wireless Network Adapter
	Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	Latency: 0
	Interrupt: pin A routed to IRQ 0
	Region 0: Memory at 600400000 (64-bit, non-prefetchable) [size=32K]
	Region 2: Memory at 600200000 (64-bit, non-prefetchable) [size=2M]
	Capabilities: [48] Power Management version 3
		Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
		Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=2 PME-
	Capabilities: [58] MSI: Enable- Count=1/1 Maskable- 64bit+
		Address: 0000000000000000  Data: 0000
	Capabilities: [68] Vendor Specific Information: Len=44 <?>
	Capabilities: [ac] Express (v2) Endpoint, MSI 00
		DevCap:	MaxPayload 256 bytes, PhantFunc 0, Latency L0s <4us, L1 unlimited
			ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset- SlotPowerLimit 25.000W
		DevCtl:	Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
			RlxdOrd+ ExtTag- PhantFunc- AuxPwr+ NoSnoop+
			MaxPayload 128 bytes, MaxReadReq 512 bytes
		DevSta:	CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr+ TransPend-
		LnkCap:	Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Exit Latency L0s <2us, L1 <32us
			ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp+
		LnkCtl:	ASPM Disabled; RCB 64 bytes Disabled- CommClk-
			ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
		LnkSta:	Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
		DevCap2: Completion Timeout: Range ABCD, TimeoutDis+, LTR+, OBFF Via WAKE#
		DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
		LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
			 Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
			 Compliance De-emphasis: -6dB
		LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete-, EqualizationPhase1-
			 EqualizationPhase2-, EqualizationPhase3-, LinkEqualizationRequest-
	Capabilities: [100 v1] Advanced Error Reporting
		UESta:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UEMsk:	DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
		UESvrt:	DLP+ SDES+ TLP- FCP+ CmpltTO- CmpltAbrt- UnxCmplt- RxOF+ MalfTLP+ ECRC- UnsupReq- ACSViol-
		CESta:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
		CEMsk:	RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr+
		AERCap:	First Error Pointer: 00, GenCap+ CGenEn- ChkCap+ ChkEn-
	Capabilities: [13c v1] Device Serial Number b8-09-00-ff-ff-00-00-01
	Capabilities: [150 v1] Power Budgeting <?>
	Capabilities: [160 v1] Virtual Channel
		Caps:	LPEVC=0 RefClk=100ns PATEntryBits=1
		Arb:	Fixed- WRR32- WRR64- WRR128-
		Ctrl:	ArbSelect=Fixed
		Status:	InProgress-
		VC0:	Caps:	PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
			Arb:	Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
			Ctrl:	Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
			Status:	NegoPending- InProgress-
	Capabilities: [1b0 v1] Latency Tolerance Reporting
		Max snoop latency: 0ns
		Max no snoop latency: 0ns
	Capabilities: [220 v1] #15
	Kernel driver in use: bcma-pci-bridge
	Kernel modules: bcma

geerlingguy avatar Feb 17 '21 22:02 geerlingguy

It seems like this card is very popular in the Hackintosh community, as it works on Hackintosh builds with no additional drivers or patches needed.

Information on getting it going on Linux is a little more sparse. The brcm80211 driver in the kernel doesn't mention anything about this chip.

That driver does mention:

Framework for supporting new chips, including mac80211-aware embedded chips.

geerlingguy avatar Feb 20 '21 17:02 geerlingguy

Ah but the chip itself is BCM4360, and it looks like that may be supported in that driver. The Arch Wiki states that 5GHz might not work on higher channels with this chip and that driver, though.

geerlingguy avatar Feb 20 '21 18:02 geerlingguy

Device Drivers
  > Network device support
    > Wireless LAN
      > Broadcom 43xx wireless support (mac80211 stack)

Seems like it was enabled in the default config, at least in the 5.10.y kernel.

geerlingguy avatar Feb 20 '21 19:02 geerlingguy

I rebooted; first reboot, got a kernel panic, but 2nd reboot it was clean.

$ lsmod | grep mac
mac80211              905216  1 b43
libarc4                16384  1 mac80211
brcmfmac              323584  0
brcmutil               24576  1 brcmfmac
cfg80211              860160  3 b43,brcmfmac,mac80211

But I'm not seeing the interface when running iw dev—only the built-in interface.

geerlingguy avatar Feb 20 '21 21:02 geerlingguy

Interesting... apparently you have to install a separate driver from the non-free repo (which is enabled by default on Pi OS in /etc/apt/sources.list):

sudo apt-get install broadcom-sta-*
sudo modprobe wl
echo "wl" | sudo tee -a /etc/modules

Seen here: https://unix.stackexchange.com/a/175843/16194

Problem, though—I'm booting from my compiled 5.10.16 kernel, the installable raspberrypi-kernel-headers are built for the current kernel installed via apt, 5.10.11. So the driver compilation that happens during apt install fails:

Setting up dkms (2.6.1-4) ...
Setting up broadcom-sta-dkms (6.30.223.271-10) ...
Loading new broadcom-sta-6.30.223.271 DKMS files...
It is likely that 5.10.16-v8+ belongs to a chroot's host
Building for 5.10.11-v8+, 5.10.16-v8+, 5.4.51+, 5.4.51-v7+, 5.4.51-v7l+ and 5.4.51-v8+
Building initial module for 5.10.11-v8+
Error! Bad return status for module build on kernel: 5.10.11-v8+ (aarch64)
Consult /var/lib/dkms/broadcom-sta/6.30.223.271/build/make.log for more information.
dpkg: error processing package broadcom-sta-dkms (--configure):
 installed broadcom-sta-dkms package post-installation script subprocess returned error exit status 10

geerlingguy avatar Feb 20 '21 21:02 geerlingguy

Ah... in the kernel, I may be able to use BRCMSMAC, which is used for PCIe, and was disabled by default. From the driver wiki (https://wireless.wiki.kernel.org/en/users/Drivers/brcm80211):

Location: → Device Drivers

→ Network device support
* → Wireless LAN
* * → < > Broadcom IEEE802.11n PCIe SoftMAC WLAN driver
* * → < > Broadcom IEEE802.11n embedded FullMAC WLAN driver
* * * → [ ] SDIO bus interface support for FullMAC driver
* * * → [ ] USB bus interface support for FullMAC driver
* * * → [ ] PCIE bus interface support for FullMAC driver

For the PCIe SoftMAC WLAN driver (brcmsmac) you need to enable select the BCMA bus driver as well:

Location: → Device Drivers

* * → Broadcom specific AMBA
* * * → <M> BCMA support
* * * * → [*] Support for BCMA on PCI-host bus
* ```

geerlingguy avatar Feb 20 '21 21:02 geerlingguy

But it's not showing up as a loaded module after installing it and rebooting:

$ lsmod | grep mac
brcmfmac              364544  0
brcmutil               24576  1 brcmfmac
cfg80211              860160  1 brcmfmac
$ ls /lib/modules/5.10.16-v8+/kernel/drivers/net/wireless/broadcom/brcm80211/brcmsmac/
brcmsmac.ko

Looks like it's blacklisted by default because I installed those other packages earlier... oops:

$ cat /etc/modprobe.d/broadcom-sta-common.conf
# wl module from Broadcom conflicts with ssb
# We must blacklist the following modules:
blacklist b43
blacklist b43legacy
blacklist b44
blacklist bcma
blacklist brcm80211
blacklist brcmsmac
blacklist ssb
install wl /sbin/modprobe --ignore-install wl $CMDLINE_OPTS

$ cat /etc/modprobe.d/broadcom-sta-dkms.conf 
# wl module from Broadcom conflicts with the following modules:
blacklist b43
blacklist b43legacy
blacklist b44
blacklist bcma
blacklist brcm80211
blacklist brcmsmac
blacklist ssb

geerlingguy avatar Feb 20 '21 21:02 geerlingguy

So tried a modprobe and got:

$ sudo modprobe brcmsmac

$ dmesg
...
[ 1123.881145] pci 0000:00:00.0: of_irq_parse_pci: failed with rc=-22
[ 1123.881179] pci 0000:00:00.0: enabling device (0000 -> 0002)
[ 1123.881203] pci 0000:01:00.0: enabling device (0000 -> 0002)
[ 1123.881229] pci 0000:02:01.0: enabling device (0000 -> 0002)
[ 1123.881251] bcma-pci-bridge 0000:03:00.0: enabling device (0000 -> 0002)
[ 1123.881309] bcma-pci-bridge 0000:03:00.0: bus0: Found chip with id 0x4360, rev 0x03 and package 0x00
[ 1123.881352] bcma-pci-bridge 0000:03:00.0: bus0: Core 0 found: ChipCommon (manuf 0x4BF, id 0x800, rev 0x2B, class 0x0)
[ 1123.881379] bcma-pci-bridge 0000:03:00.0: bus0: Core 1 found: IEEE 802.11 (manuf 0x4BF, id 0x812, rev 0x2A, class 0x0)
[ 1123.881421] bcma-pci-bridge 0000:03:00.0: bus0: Core 2 found: ARM CR4 (manuf 0x4BF, id 0x83E, rev 0x02, class 0x0)
[ 1123.881461] bcma-pci-bridge 0000:03:00.0: bus0: Core 3 found: PCIe Gen2 (manuf 0x4BF, id 0x83C, rev 0x01, class 0x0)
[ 1123.881486] bcma-pci-bridge 0000:03:00.0: bus0: Core 4 found: USB 2.0 Device (manuf 0x4BF, id 0x81A, rev 0x11, class 0x0)
[ 1123.914137] bcma: Unsupported SPROM revision: 11
[ 1123.914154] bcma-pci-bridge 0000:03:00.0: bus0: Invalid SPROM read from the PCIe card, trying to use fallback SPROM
[ 1123.914164] bcma-pci-bridge 0000:03:00.0: bus0: Using fallback SPROM failed (err -2)
[ 1123.914172] bcma-pci-bridge 0000:03:00.0: bus0: No SPROM available
[ 1123.919641] bcma-pci-bridge 0000:03:00.0: bus0: Bus registered
$ sudo lspci -vnn
...
03:00.0 Network controller [0280]: Broadcom Limited BCM4360 802.11ac Wireless Network Adapter [14e4:43a0] (rev 03)
	Subsystem: Apple Inc. BCM4360 802.11ac Wireless Network Adapter [106b:0117]
	Flags: bus master, fast devsel, latency 0
	Memory at 600400000 (64-bit, non-prefetchable) [size=32K]
	Memory at 600200000 (64-bit, non-prefetchable) [size=2M]
	Capabilities: [48] Power Management version 3
	Capabilities: [58] MSI: Enable- Count=1/1 Maskable- 64bit+
	Capabilities: [68] Vendor Specific Information: Len=44 <?>
	Capabilities: [ac] Express Endpoint, MSI 00
	Capabilities: [100] Advanced Error Reporting
	Capabilities: [13c] Device Serial Number b8-09-00-ff-ff-00-00-01
	Capabilities: [150] Power Budgeting <?>
	Capabilities: [160] Virtual Channel
	Capabilities: [1b0] Latency Tolerance Reporting
	Capabilities: [220] #15
	Kernel driver in use: bcma-pci-bridge
	Kernel modules: bcma

geerlingguy avatar Feb 20 '21 22:02 geerlingguy