Skip to content

rockchip64: scope the rk3576 HS400 DLL calibration to rk3576 only - #10375

Merged
igorpecovnik merged 1 commit into
armbian:mainfrom
crackerjacques:rk3576-sdhci-dll-scope
Aug 9, 2026
Merged

rockchip64: scope the rk3576 HS400 DLL calibration to rk3576 only#10375
igorpecovnik merged 1 commit into
armbian:mainfrom
crackerjacques:rk3576-sdhci-dll-scope

Conversation

@crackerjacques

@crackerjacques crackerjacques commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

What

The rk3576 HS400 DLL tap calibration added for the Anbernic RG Vita Pro
(rk3576-0013-mmc-sdhci-dwcmshc-rk3576-dll-tap-calibration.patch) was gated on
rockchip_pdata->revision == 1. Revision 1 is shared by every non-rk356x dwcmshc
SoC — rk3576 and rk3588 (the driver's own comment says as much). As written it
also fed the rk3576 tap values, DLL_TAP_VALUE_SEL and BOTH_CLK_EDGE into
rk3588's HS400 path, changing its eMMC timing.

Fix

Gate the calibration on a dedicated needs_hs400_dll_calibration flag in
struct rockchip_pltfm_data, set only for sdhci_dwcmshc_rk3576_pdata. rk3588 and
the other revision-1 SoCs keep their original 90-degree CMDOUT taps and STRBIN
default untouched; only rk3576 gets the calibrated taps and the measured DLL lock
value feedback.

Reported by CodeRabbit on #10321.

Testing

Built rockchip64 edge (7.1) and bleedingedge (7.2-rc6). rk3576 HS400 behaviour
is unchanged (still calibrated, no more Timeout waiting for hardware interrupt on
the RG Vita Pro); the rk3588 path is restored to its pre-patch register values.

Summary by CodeRabbit

  • Bug Fixes
    • Improved HS400 eMMC reliability on RK3576 devices through device-specific DLL calibration.
    • Automatically tunes clock and data timing for high-speed memory communication.
    • Preserved existing behavior for other supported Rockchip SoCs.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The two Rockchip kernel patch variants add RK3576-specific HS400 DLL calibration. The driver reads and scales the DLL lock value, applies it to clock tap selection, and preserves existing behavior on other revision-1 SoCs.

Changes

RK3576 HS400 DLL calibration

Layer / File(s) Summary
Calibration contract and platform gating
patch/kernel/archive/rockchip64-7.1/..., patch/kernel/archive/rockchip64-7.2/...
The patches add DLL calibration definitions, add needs_hs400_dll_calibration to platform data, and enable the flag for RK3576.
DLL lock and tap programming
patch/kernel/archive/rockchip64-7.1/..., patch/kernel/archive/rockchip64-7.2/...
When the flag and HS400 timing are active, the driver reads DLL_STATUS0 and programs RXCLK, TXCLK, CMDOUT, and STRBIN. RK3576 uses taps 7/7/5 and BOTH_CLK_EDGE; other revision-1 SoCs retain their existing settings.

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

Sequence Diagram(s)

sequenceDiagram
  participant SDHCI_DWCMShc
  participant DLL_STATUS0
  participant DLL_Clock_Registers
  SDHCI_DWCMShc->>DLL_STATUS0: Read and scale DLL lock value
  DLL_STATUS0-->>SDHCI_DWCMShc: Return lock value
  SDHCI_DWCMShc->>DLL_Clock_Registers: Program calibrated RXCLK, TXCLK, CMDOUT, and STRBIN taps
Loading

Possibly related PRs

  • armbian/build#10321: Includes the same RK3576 DLL calibration changes while rebasing the 7.2 patch set.
  • armbian/build#10329: Updates the same RK3576 HS400 DLL calibration logic across kernel branches.

Suggested reviewers: igorpecovnik, rpardini, ahoneybun

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes scoping rk3576 HS400 DLL calibration to rk3576 only, which is the main change.
✨ 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 size/medium PR with more then 50 and less then 250 lines Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Aug 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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
`@patch/kernel/archive/rockchip64-7.1/rk3576-0013-mmc-sdhci-dwcmshc-rk3576-dll-tap-calibration.patch`:
- Around line 90-95: Limit the calibrated DLL programming in
dwcmshc_rk3568_set_clock() to MMC_TIMING_MMC_HS400 in all four sites: 7.1 lines
90-95 and 137-150, and 7.2 lines 90-95 and 137-150. Require both
needs_hs400_dll_calibration and HS400 timing before updating RXCLK, TXCLK, or
STRBIN, preserving existing settings for HS200.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3973c1a6-d47c-4d1d-ad7d-00711075097e

📥 Commits

Reviewing files that changed from the base of the PR and between ef2f2c2 and 2364b3f.

📒 Files selected for processing (2)
  • patch/kernel/archive/rockchip64-7.1/rk3576-0013-mmc-sdhci-dwcmshc-rk3576-dll-tap-calibration.patch
  • patch/kernel/archive/rockchip64-7.2/rk3576-0013-mmc-sdhci-dwcmshc-rk3576-dll-tap-calibration.patch

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot added Ready to merge Reviewed, tested and ready for merge and removed Needs review Seeking for review labels Aug 9, 2026
@igorpecovnik

Copy link
Copy Markdown
Member

There is new rabbit's concern to check.

@EvilOlaf

EvilOlaf commented Aug 9, 2026

Copy link
Copy Markdown
Member

Yes, has to be addressed or dismissed

…rk3576

revision == 1 is shared by every non-rk356x dwcmshc SoC (rk3576, rk3588, ...), so the rk3576 HS400 DLL calibration also fed the rk3576 tap values, DLL_TAP_VALUE_SEL and BOTH_CLK_EDGE into rk3588's HS400 path, changing its eMMC timing.

Gate it on a dedicated needs_hs400_dll_calibration flag set only for rk3576, and only in HS400 timing (matching the CMDOUT path) so the RXCLK/TXCLK/STRBIN calibration no longer touches HS200. rk3588 and the other revision-1 SoCs keep their original 90-degree CMDOUT taps and STRBIN default untouched.

Signed-off-by: crackerjacques <jack@supremeoverlordjabs.co>
@crackerjacques

Copy link
Copy Markdown
Contributor Author

Good catch — addressed in the amended commit. The RXCLK/TXCLK/STRBIN calibration is now gated on needs_hs400_dll_calibration && host->mmc->ios.timing == MMC_TIMING_MMC_HS400, matching the CMDOUT path, so HS200 keeps its existing (non-calibrated) values on rk3576. The RG Vita Pro runs HS400-ES, so its behaviour is unchanged; this only restores the HS200 path for rk3576 boards that use it. Built rockchip64 edge to confirm.

@crackerjacques
crackerjacques force-pushed the rk3576-sdhci-dll-scope branch from 2364b3f to 20a6cd4 Compare August 9, 2026 12:44
@github-actions github-actions Bot added Needs review Seeking for review and removed Ready to merge Reviewed, tested and ready for merge labels Aug 9, 2026
@github-actions github-actions Bot added the Ready to merge Reviewed, tested and ready for merge label Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions Bot removed the Needs review Seeking for review label Aug 9, 2026
@igorpecovnik
igorpecovnik merged commit 6e1c755 into armbian:main Aug 9, 2026
12 checks passed
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, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/medium PR with more then 50 and less then 250 lines

Development

Successfully merging this pull request may close these issues.

3 participants