raspberrypi cm4 usb not working
I am building a custom yocto image for the raspberry pi compute module
4. I am using meta-raspberry scarthgap branch using the raspberrypi4 machine (32-bit version). (U-Boot 2024.01)
In the /boot/config.txt I added:
# Enable USB peripheral mode dtoverlay=dwc2,dr_mode=peripheral
which should be the right mode if I understand correctly.
On startup the following is logged:
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
PCI: Failed autoconfig bar 10
starting USB...
Bus xhci_pci: dm_pci_bus_to_phys: invalid physical address xhci-pci init cannot map PCI mem bar
probe failed, error -5
No working controllers found
I have no idea on what could be the problem and how to fix this. Ultimately I want to use the U-Boot ums feature to expose a block device via the usb port to another computer. I have searched the mailing list and other resources online but only found the following unanswered stackoverflow post:
https://stackoverflow.com/questions/78843599/usb-not-working-in-u-boot-on-raspberry-pi-4b-with-custom-yocto-image
Any help would be really appreciated,
Sincerely
Moritz Krautwald
Signature · 7 lines
https://www.aicorn.de Östliche Rheinbrückenstr. 50 | BK 148, 76187 Karlsruhe (Postanschrift) aicorn GmbH: Geschäftsführer: Dr.-Ing. Thilo Oliver Richter, Samuel Wenz, Christian Grund; Sitz der Gesellschaft: Siemensallee 75, 76187 Karlsruhe, Deutschland; Registergericht: Mannheim, HRB 74312
Hi Moritz,
Quoted 2 lines
I am building a custom yocto image for the raspberry pi compute module
4. I am using meta-raspberry scarthgap branch using the raspberrypi4
Can you provide a link to what ever that branch is?
Quoted 1 line
machine (32-bit version). (U-Boot 2024.01)
That release is quite old, can you test the latest 2025.04 release or even 2025.07-rc1 to see if that fixes things, I am pretty sure there's been quite a few fixes to that in the last year+.
Quoted 7 lines
In the
/boot/config.txtI added:
# Enable USB peripheral mode dtoverlay=dwc2,dr_mode=peripheral
which should be the right mode if I understand correctly.On startup the following is logged:
Quoted 7 lines
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
PCI: Failed autoconfig bar 10
starting USB...
Busxhci_pci:dm_pci_bus_to_phys: invalid physical address xhci-pci init cannot map PCI mem bar
probe failed, error -5
No working controllers found
So the USB2 controller on the CM4 isn't PCI based so those errors are likely spurious.
Quoted 6 lines
I have no idea on what could be the problem and how to fix this. Ultimately I want to use the U-Boot ums feature to expose a block device via the usb port to another computer. I have searched the mailing list and other resources online but only found the following unanswered stackoverflow post:
https://stackoverflow.com/questions/78843599/usb-not-working-in-u-boot-on-raspberry-pi-4b-with-custom-yocto-image
So if I understand your description correctly you want to be able to emulate the RPi usbboot process described here?
TBH as one of the RPi maintainers here I've never even considered this so have definitely not tested it in any form nor do I remember anyone mentioning it.
Taking a quick look without digging out a CM3/CM4 device I think you're going to need to enable USB_GADGET_DWC2_OTG and associated configs, I am not sure if the meta you reference above does any of that for the configs etc.
Peter