raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.15k stars 4.99k forks source link

Raspberry PI CM4 not booting from USB #4325

Open havok13888 opened 3 years ago

havok13888 commented 3 years ago

Describe the bug Raspberry PI CM4 not booting from USB. We have a carrier with the USB 2.0 lane connected to an sd card slot. If we boot into the OS using EMMC we can see the sd card mounted to sda. But we cannot use this sd card to boot from if the EMMC is blank. We are using yocto gatesgarth to build the image.

To reproduce

  1. Build Yocto gatesgarth Image.
  2. Erase emmc.
  3. Burn the image to an SD card and try to boot from it.

Expected behaviour CM4 should be able to boot from SD card using USB 2.0

Actual behaviour config.txt is loaded -> errors (attached logs) -> rainbow screen

System

Logs usb-boot-xhci-debug.log usb-boot-xhci-debug2.log usb-boot-using-start_debug.log cmdline.txt config.txt

Additional context Fails with u-boot too. It never reaches that stage. I can provide an image if needed. BOOT_ORDER=0xf251

pelwell commented 3 years ago

You're bootloader EEPROM image is too old to take advantage of the onboard XHCI controller. From https://github.com/raspberrypi/rpi-eeprom/blob/master/firmware/release-notes.md:

2021-04-19 - Promote 2021-03-18 from LATEST to DEFAULT - DEFAULT ... Add support for the BCM2711 XHCI controller - BOOT_ORDER 0x5

havok13888 commented 3 years ago

Same problem using pieeprom-2021-04-29.bin Just to clarify we are using this controller https://www.microchip.com/wwwproducts/en/USB2514B and our sd card slot is connected to the USB 2.0 lane.

timg236 commented 3 years ago

All of the logs seem to show that start.elf is loaded correctly but the first USB command where it reads the MBR in start.elf fails. This suggests that this USB hub device is sensitive to something in the early firmware init code and stops responding.

Can you reproduce this on a CM4 IO board i.e. with a hub using that chipset?

havok13888 commented 3 years ago

We will try it here on the dev board and update, might take a bit.

havok13888 commented 3 years ago

Tried just the CM4 IO board, no hardware changes. Installed Raspbian buster to a usb stick and put the stick in the USB 2.0 slot. It still wouldn't boot. Log attached puttyOut1.txt

timg236 commented 3 years ago

The puttyOut1.txt log doesn't show any USB connection events (EVT 34) so the software it just waiting for a USB device to appear. Was the micro USB (rpiboot) cable still connected, this would switch off the type-A sockets on the IO board.

Connecting any USB device (e.g. a keyboard or a hub) should cause connection events

Boot mode: BCM-USB-MSD (05) order f2
XHCI-STOP
xHC ver: 272 HCS: 01000140 0c0000f1 07ff000a HCC: 0220fe65
xHC ports 1 slots 64 intrs 1
EVT (34   1) 00 00 00 01 00 00 00 00 00 00 00 01 01 88 00 00
USB2[1] 000206e1 connected
EVT (34   1) 00 00 00 01 00 00 00 00 00 00 00 01 01 88 00 00
USB2[1] 00200e03 connected enabled
USB2 root HUB port 1 init