Skip to content

meson64: mmc: meson-gx: honour the busy timeout for R1b commands - #10451

Open
iav wants to merge 1 commit into
armbian:mainfrom
iav:mmc/meson-gx-busy-timeout
Open

meson64: mmc: meson-gx: honour the busy timeout for R1b commands#10451
iav wants to merge 1 commit into
armbian:mainfrom
iav:mmc/meson-gx-busy-timeout

Conversation

@iav

@iav iav commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

meson-gx-mmc waits for R1b busy in hardware but programs a fixed 1024 ms there and does not report max_busy_timeout, so the core sends erase and cache-flush commands with the card's real (multi-second) timeouts and the controller gives up after one second:

mmc_erase: erase error -110, status 0x0
mmc1: cache flush error -110

Same for an SD card in the SoC slot (DISCARD I/O errors; the same card behind a USB reader is fine, see ophub/fnnas#330). Program the timeout from cmd->busy_timeout (bounded by the 2^15 ms field) and report the bound as max_busy_timeout, the way sdhci and meson-mx-sdhc do. Fixes: 51c5d8447bd7, upstream candidate.

How Has This Been Tested?

  • ODROID-N2+ eMMC, btrfs discard=async, 20 GiB write + delete + fstrim: 48 errors on 7.1.7 (24 erase + 24 cache flush), 0 on 7.1.8 with the patch (2 runs)
  • Patch applies to 6.12 / 6.18 / 7.1 / 7.2 (git apply --check); built and booted only 7.1 (edge)
  • Draft until tested on other Amlogic boards

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of extended storage command operations on Meson GX devices.
    • Busy timeouts are now calculated and constrained to supported controller limits, reducing premature command failures.
    • Longer operations can use polling when hardware timeout limits are exceeded.
    • Applied consistently across supported kernel versions.

@github-actions github-actions Bot added 08 Milestone: Third quarter release size/large PR with 250 lines or more labels Aug 17, 2026
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 650017fa-a6f3-411e-82b2-47ced23906ed

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • No files to review - (🔄 Check again to try again)

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7aee012b-0b35-4634-9ac8-2d3e6f8c88ea

📥 Commits

Reviewing files that changed from the base of the PR and between 2db577f and fe5d09b.

📒 Files selected for processing (4)
  • patch/kernel/archive/meson64-6.12/general-mmc-meson-gx-honour-busy-timeout.patch
  • patch/kernel/archive/meson64-6.18/general-mmc-meson-gx-honour-busy-timeout.patch
  • patch/kernel/archive/meson64-7.1/general-mmc-meson-gx-honour-busy-timeout.patch
  • patch/kernel/archive/meson64-7.2/general-mmc-meson-gx-honour-busy-timeout.patch

Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The Meson GX MMC patches add command-specific R1b timeout handling across kernel versions. They round and clamp cmd->busy_timeout, program non-data commands with the result, and advertise the 32-second hardware limit to the MMC core.

Changes

Meson GX MMC busy-timeout handling

Layer / File(s) Summary
Command-specific timeout programming
patch/kernel/archive/meson64-6.12/..., patch/kernel/archive/meson64-6.18/..., patch/kernel/archive/meson64-7.1/..., patch/kernel/archive/meson64-7.2/...
The patches define a 32,768 ms controller limit. Non-data command timeouts use cmd->busy_timeout, power-of-two rounding, defaults, and bounds.
MMC core timeout advertisement
patch/kernel/archive/meson64-6.12/..., patch/kernel/archive/meson64-6.18/..., patch/kernel/archive/meson64-7.1/..., patch/kernel/archive/meson64-7.2/...
The driver sets mmc->max_busy_timeout to the controller limit.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to fe5d0

The PR updates meson-gx MMC handling to honor card-specific R1b busy timeouts across supported kernel series; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: adeepn, igorpecovnik, jomadeto

🚥 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 and concisely describes the main change: honoring busy timeouts for R1b commands in the Meson GX MMC driver.
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.

@github-actions github-actions Bot added Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Aug 17, 2026
@iav
iav force-pushed the mmc/meson-gx-busy-timeout branch from fe5d09b to ceb8047 Compare August 19, 2026 12:01
@iav
iav marked this pull request as ready for review August 19, 2026 12:01
The controller waits for R1b busy in hardware, but the driver programs a
fixed 1024 ms there and does not report max_busy_timeout, so erase and
cache-flush commands time out as soon as the card is busy for more than
a second:

  mmc_erase: erase error -110, status 0x0
  mmc1: cache flush error -110

Program the timeout from cmd->busy_timeout (bounded by the 2^15 ms field)
and report the bound as max_busy_timeout, the way sdhci and meson-mx-sdhc
do. ODROID-N2+ eMMC, 20 GiB write + delete + fstrim: 48 errors before,
0 after (two runs). Applies to 6.12, 6.18, 7.1 and 7.2.
@iav
iav force-pushed the mmc/meson-gx-busy-timeout branch from ceb8047 to 2a7a6ea Compare August 19, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

08 Milestone: Third quarter release Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review Patches Patches related to kernel, U-Boot, ... size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

1 participant