Page MenuHomeFreeBSD

Handle Raspberry Pi 4 xhci firmware loading.
ClosedPublic

Authored by crowston_protonmail.com on Jun 14 2020, 12:22 AM.

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

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 ↗(On Diff #73087)

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

sys/arm/broadcom/bcm2835/bcm2838_xhci.c
86–87 ↗(On Diff #73087)

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
94 ↗(On Diff #74170)

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

98 ↗(On Diff #74170)

I thunk you can use ofw_bus_is_compatible here.

86–87 ↗(On Diff #73087)

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'.

sys/dev/usb/controller/xhci_pci.c
88–89 ↗(On Diff #74170)

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
98 ↗(On Diff #74170)

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
98 ↗(On Diff #74170)

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.