Re: dwc2: RPi 3 B plus - USB mass storage boot broken
From: Stefan Wahren <hidden>
Date: 2021-06-29 21:32:44
Also in:
linux-arm-kernel, linux-devicetree
Am 29.06.21 um 13:37 schrieb Stefan Wahren:
Hi, i noticed more fallout connected to the recent fw_devlink changes in Linux 5.13. Since fw_devlink=on the Raspberry Pi 3 B Plus (multi_v7_defconfig, 32 bit) is unable to boot from USB because the dwc2 driver probe too late and the kernel waits endlessly for the rootfs. Switching fw_devlink back to permissive makes the dwc2 driver probe earlier and make USB mass storage boot work again. Here are some dmesg extracts taken from a Raspberry Pi 3 B Plus (5.13, multi_v7_defconfig, booting from SD card to show good and bad case): fw_devlink=permissive [ 2.198105] calling dwc2_platform_driver_init+0x0/0x10 @ 1 [ 2.198663] initcall dwc2_platform_driver_init+0x0/0x10 returned 0 after 529 usecs [ 4.156494] dwc2 3f980000.usb: supply vusb_d not found, using dummy regulator [ 4.174514] dwc2 3f980000.usb: supply vusb_a not found, using dummy regulator [ 4.242973] dwc2 3f980000.usb: DWC OTG Controller [ 4.259505] dwc2 3f980000.usb: new USB bus registered, assigned bus number 1 [ 4.278483] dwc2 3f980000.usb: irq 66, io mem 0x3f980000 [ 4.759700] usb 1-1: new high-speed USB device number 2 using dwc2 [ 5.359793] usb 1-1.1: new high-speed USB device number 3 using dwc2 [ 5.899703] usb 1-1.2: new low-speed USB device number 4 using dwc2 [ 6.149705] usb 1-1.1.3: new low-speed USB device number 5 using dwc2 [ 6.629761] usb 1-1.1.1: new high-speed USB device number 6 using dwc2 fw_devlink=on [ 2.198579] calling dwc2_platform_driver_init+0x0/0x10 @ 1 [ 2.199021] initcall dwc2_platform_driver_init+0x0/0x10 returned 0 after 416 usecs [ 7.693987] dwc2 3f980000.usb: supply vusb_d not found, using dummy regulator [ 7.694228] dwc2 3f980000.usb: supply vusb_a not found, using dummy regulator [ 7.747111] dwc2 3f980000.usb: DWC OTG Controller [ 7.747152] dwc2 3f980000.usb: new USB bus registered, assigned bus number 1 [ 7.747192] dwc2 3f980000.usb: irq 66, io mem 0x3f980000 [ 8.179985] usb 1-1: new high-speed USB device number 2 using dwc2 [ 8.749920] usb 1-1.1: new high-speed USB device number 3 using dwc2 [ 9.179900] usb 1-1.2: new low-speed USB device number 4 using dwc2 [ 9.409951] usb 1-1.1.3: new low-speed USB device number 5 using dwc2 [ 9.849927] usb 1-1.1.1: new high-speed USB device number 6 using dwc2 Unfortunately i wasn't able to find the root cause for this delay of 3 seconds during boot. I noticed that usb_phy_generic_init is called very late. Maybe this is related.
I was able to investigate this further. The Raspberry Pi has a PHY defined in device tree ( compatible = "usb-nop-xceiv", bcm283x.dtsi ) and in arm/multi_v7_defconfig the relevant driver is compiled as a module. The dwc2 platform code attempt to find the optional PHY. With fw_devlink=permissive the dwc2 driver seems to fail getting the PHY and proceed. But with fw_devlink=on the dwc2 driver seems to go the EPROBE_DEFER path and wait endlessly for the PHY driver which isn't built into the kernel. This PHY handling was a troublemaker in the past [1] So there are two workarounds to avoid this issue with fw_devlink=on: a) make CONFIG_NOP_USB_XCEIV=y for multi_v7_defconfig b) remove the usb-nop-xceiv PHY from the device tree But it would be nice to have a clean solution. Best regards Stefan [1] - https://patchwork.kernel.org/project/linux-arm-kernel/patch/20180112101223.3661181-1-arnd@arndb.de/
Best regards Stefan