Page MenuHomeFreeBSD

Handle Raspberry Pi 4 xhci firmware loading.
ClosedPublic

Authored by crowston_protonmail.com on Jun 14 2020, 12:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 16 2024, 3:52 AM
Unknown Object (File)
Jan 10 2024, 3:29 AM
Unknown Object (File)
Jan 10 2024, 3:29 AM
Unknown Object (File)
Dec 22 2023, 2:16 PM
Unknown Object (File)
Dec 10 2023, 11:06 PM
Unknown Object (File)
Nov 23 2023, 12:02 PM
Unknown Object (File)
Nov 23 2023, 9:40 AM
Unknown Object (File)
Nov 11 2023, 1:33 PM

Details

Summary
The newer hardware revisions of the Raspberry Pi 4 removed the ability
of the VIA VL805 xhci controller to load its own firmware. Instead the
firmware must be installed at the appropriate time by the VideoCore
coprocessor.

This differential builds on top of D25068.
Test Plan

Tested with new and old firmware, on several different Pi4s.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 31691
Build 29262: arc lint + arc unit

Event Timeline

crowston_protonmail.com edited the test plan for this revision. (Show Details)
crowston_protonmail.com edited the summary of this revision. (Show Details)
sys/arm/broadcom/bcm2835/bcm2838_xhci.c
86–87

Is this correct? There is a device tree node for the XHCI device?

sys/arm/broadcom/bcm2835/bcm2838_xhci.c
86–87

There is a device tree node, but it's disabled and in any case we do not use it. The controller is discovered through ordinary enumeration of the PCI bus, both on Linux and in the driver I wrote.

The intention of the device tree inspection here is so I can check if the computer is a Raspberry Pi 4. The VIA controller is a commodity controller, but this quirk where the Pi Foundation removed the firmware EEPROM is limited to the Pi SBC.

Add additional comments to explain the probe.

I tried this on my Raspberry Pi 4 & got the following error.

xhci0: <VL805 USB 3.0 controller (on the Raspberry Pi 4b)> irq 78 at device 0.0 on pci1
mbox0: mbox response error
xhci0: warning: xhci firmware install failed (error 5).
xhci0: 32 bytes context size, 64-bit DMA
sys/arm/broadcom/bcm2835/bcm2838_xhci.c
86–87

This device has no node associated with it do the call to ofw_bus_status_okay will call ofw_bus_get_status that returns NULL so we return a status of 'ok'.

95

You should place the variable decorations at the start of the function.

99

I thunk you can use ofw_bus_is_compatible here.

sys/dev/usb/controller/xhci_pci.c
88–89

Remove the above driver_t & replace it with the DEFINE_CLASS_0 version. They are equivalent, other than the variable name.

sys/arm/broadcom/bcm2835/bcm2838_xhci.c
99

What's the advantage of using ofw_bus_is_compatible? I would have to discover the right device_t for the "/" device.

sys/arm/broadcom/bcm2835/bcm2838_xhci.c
99

Sorry, that should be ofw_bus_node_is_compatible. fdt_is_compatible_strict should be removed as it's redundant given we have ofw_ versions.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 3 2020, 10:20 AM
This revision was automatically updated to reflect the committed changes.