Skip to content

Increase USB hub debounce timeout to fix USB SSD boot on RPi 3 - #4940

Merged
sairon merged 1 commit into
home-assistant:devfrom
dlxmax:rpi3-usb-pgood-delay
Aug 6, 2026
Merged

sairon merged 1 commit into
home-assistant:devfrom
dlxmax:rpi3-usb-pgood-delay

Conversation

@dlxmax

@dlxmax dlxmax commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

On Raspberry Pi 3, U-Boot runs usb start early in boot to find the boot
device. Many USB-SATA/NVMe bridges haven't finished enumerating within the
default USB hub debounce window, so U-Boot reports "0 storage devices found"
and fails to boot from a USB SSD. This happens intermittently or on every boot
depending on the adapter.

CONFIG_USB_HUB_DEBOUNCE_TIMEOUT is the knob for exactly this: its own Kconfig
help notes that "some usb device needs around 1.5s to be initialized and a 2s
value should solve detection issue on problematic USB keys." Raising it gives
slow bridges time to present the drive. This is preferred over overriding
CONFIG_PREBOOT, which would shadow the default preboot string and could
silently mask a future upstream change to it.

Scoped to rpi3-64 via a per-board fragment, matching the existing
rpi4-64/uboot.config, so Pi 4/5 images are unaffected. On my Pi 3B with a
USB-SATA bridge and SSD, stock fails with "0 storage devices"; 2000 ms was
still intermittent (roughly two boots in three), while 2500 ms boots reliably
across repeated cold starts.

The manual setenv usb_pgood_delay ...; usb reset workaround from #1712 doesn't
persist, because CONFIG_ENV_IS_NOWHERE=y means saveenv is unavailable, and a
hand-patched u-boot.bin is overwritten by OS updates. So this needs to ship in
the image.

Addresses the USB SSD boot detection reported in #1712 and #2876.

Summary by CodeRabbit

  • Bug Fixes
    • Improved USB hub initialization reliability on Raspberry Pi 3 64-bit systems by allowing additional debounce time during startup.
    • Applied the updated USB configuration to the Raspberry Pi 3 64-bit build.

@home-assistant home-assistant Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dlxmax

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
home-assistant Bot marked this pull request as draft August 3, 2026 10:34
@home-assistant

home-assistant Bot commented Aug 3, 2026

Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks ๐Ÿ‘

Learn more about our pull request process.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • โ–ถ๏ธ Resume reviews
  • ๐Ÿ” Trigger review

No actionable comments were generated in the recent review. ๐ŸŽ‰

โ„น๏ธ Recent review info
โš™๏ธ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fb77381a-019b-4371-8530-0aa6b37b3421

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 27693d8 and 351b328.

๐Ÿ“’ Files selected for processing (2)
  • buildroot-external/board/raspberrypi/rpi3-64/uboot.config
  • buildroot-external/configs/rpi3_64_defconfig
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • buildroot-external/configs/rpi3_64_defconfig

๐Ÿ“ Walkthrough

Walkthrough

The Raspberry Pi 3 64-bit U-Boot configuration sets the USB hub debounce timeout to 2500 ms. The defconfig includes the board-specific U-Boot configuration fragment.

Changes

Raspberry Pi 3 USB hub configuration

Layer / File(s) Summary
Configure and include USB debounce setting
buildroot-external/board/raspberrypi/rpi3-64/uboot.config, buildroot-external/configs/rpi3_64_defconfig
The U-Boot fragment sets CONFIG_USB_HUB_DEBOUNCE_TIMEOUT to 2500 ms. The defconfig includes this fragment.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested labels: board/raspberrypi

Poem

A rabbit sets the timeout right,
Two thousand five hundred milliseconds guide USB through the night.
The board fragment joins the build,
Raspberry Pi starts as configured.
Hop, hop, boot!

๐Ÿšฅ Pre-merge checks | โœ… 5
โœ… Passed checks (5 passed)
Check name Status Explanation
Description Check โœ… Passed Check skipped - CodeRabbitโ€™s high-level summary is enabled.
Title check โœ… Passed The title clearly describes the USB hub debounce change and its purpose for USB SSD boot on Raspberry Pi 3.
Docstring Coverage โœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check โœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check โœ… Passed Check skipped because no linked issues were found for this pull request.
โœจ Finishing Touches
๐Ÿงช Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share

Comment @coderabbitai help to get the list of available commands.

@dlxmax
dlxmax marked this pull request as ready for review August 3, 2026 10:39
@dlxmax
dlxmax force-pushed the rpi3-usb-pgood-delay branch 2 times, most recently from a483cca to 8349e48 Compare August 3, 2026 11:32

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

๐Ÿค– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@buildroot-external/board/raspberrypi/rpi3-64/uboot.config`:
- Line 1: Update CONFIG_PREBOOT in the rpi3-64 U-Boot configuration to retain
the existing usb start command while also setting usb_pgood_delay to 1000,
ensuring USB initialization occurs before autoboot.
๐Ÿช„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

โ„น๏ธ Review info
โš™๏ธ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f2532c7-7883-4196-a35e-bd34c5e2ab31

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between a483cca and 8349e48.

๐Ÿ“’ Files selected for processing (2)
  • buildroot-external/board/raspberrypi/rpi3-64/uboot.config
  • buildroot-external/configs/rpi3_64_defconfig
๐Ÿšง Files skipped from review as they are similar to previous changes (1)
  • buildroot-external/configs/rpi3_64_defconfig

@dlxmax
dlxmax force-pushed the rpi3-usb-pgood-delay branch from 8349e48 to a7f035f Compare August 3, 2026 11:44

@sairon sairon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up. There are couple of issues with this solution though. First of all, it delays boot of all Pi 3's, no matter if they use USB as the main boot device or not (which is another issue - direct USB boot was always rather discouraged, using SD card for OS and USB drive as data disk is the better way - anyway, it was never completely unsupported). But on the other hand, Pi 3 is already rather underspec'd for today's Home Assistant deployments, and that one extra second will be lost in the noise, so... I think I can live with that.

The bigger issue for me is from the maintainability perspective, as this change overrides the default CONFIG_PREBOOT defined either upstream or potentially in upper configs. This way it could shadow another default should it ever change. Currently it's a default string from the Kconfig, which is most likely to be changed without us noticing when updating U-Boot.

On the bright side, I think there's more appropriate way to delay the initialization instead, and that's by increasing CONFIG_USB_HUB_DEBOUNCE_TIMEOUT. From its Kconfig description it sounds it's exactly what you need and adjusting a config option is IMHO better than extending preboot environment. Would you be able to build and test if increasing that value (e.g. to 2000 from the default 1000) helps in your case?

@home-assistant
home-assistant Bot marked this pull request as draft August 3, 2026 13:00
@dlxmax
dlxmax force-pushed the rpi3-usb-pgood-delay branch from a7f035f to 351b328 Compare August 6, 2026 07:29
@dlxmax dlxmax changed the title raspberrypi: Set usb_pgood_delay to fix USB SSD boot detection on RPi 3 raspberrypi: Increase USB hub debounce timeout to fix USB SSD boot on RPi 3 Aug 6, 2026
@dlxmax
dlxmax marked this pull request as ready for review August 6, 2026 07:29
@home-assistant
home-assistant Bot requested a review from sairon August 6, 2026 07:29
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@dlxmax

dlxmax commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, that's a cleaner fit and I agree on the maintainability concern. Overriding CONFIG_PREBOOT to shadow the default string bothered me for the same reason, and the debounce timeout is purpose-built for this per its own Kconfig help.

I rebuilt with the stock preboot untouched and only CONFIG_USB_HUB_DEBOUNCE_TIMEOUT raised, then tested on my Pi 3B with the USB-SATA bridge and SSD:

  • 2000 ms: still intermittent, roughly two cold boots in three.
  • 2500 ms: reliable across repeated cold starts.

Pushed as CONFIG_USB_HUB_DEBOUNCE_TIMEOUT=2500, scoped to rpi3-64. Title and description updated to match.

@sairon sairon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sairon
sairon merged commit 1328ed1 into home-assistant:dev Aug 6, 2026
3 checks passed
@sairon sairon added board/raspberrypi Raspberry Pi Boards u-boot U-Boot related issue labels Aug 6, 2026
@sairon sairon changed the title raspberrypi: Increase USB hub debounce timeout to fix USB SSD boot on RPi 3 Increase USB hub debounce timeout to fix USB SSD boot on RPi 3 Aug 6, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

board/raspberrypi Raspberry Pi Boards cla-signed u-boot U-Boot related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants