rockchip64-6.18: rebase rk3399 dwc3 phy-reset-quirk patch for 6.18.32#9847
Conversation
Kernel 6.18 stable progressed past 6.18.18 (last patch rewrite baseline, commit 2dc5b23) and refactored dwc3_readl()/dwc3_writel() to take the struct dwc3 pointer directly instead of dwc->regs. The patch context still referenced dwc->regs, causing hunks #1 (at core.c:153) and armbian#3 (at core.c:213) to fail on builds against 6.18.32. Update the patch context to drop "->regs" (no change to the +/- payload) so it applies cleanly on 6.18.32 while remaining compatible with the prior baseline. Verified with patch -p1 --dry-run against the 6.18.32 HEAD blob from the linux-rockchip 6.18 branch: exit 0, all 16 hunks across the 3 files apply (offset -2 on core.h, harmless). Signed-off-by: SuperKali <hello@superkali.me>
📝 WalkthroughWalkthroughThis patch enhances the DWC3 USB controller driver to support RK3399 TypeC PHYs that require USB3 PHY power-cycling during role transitions. It adds a device-tree-configurable quirk, introduces a disconnected pseudo-role state, and integrates selective PHY power management into the mode-setting, suspend/resume, and DRD event handling paths. ChangesDWC3 USB3 PHY Reset Quirk
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
patch/kernel/archive/rockchip64-6.18/rk3399-usbc-phy-rockchip-naneng-Add-fallback-for-old-DTs.patch (1)
187-218: 💤 Low valuePre-existing logic concern in non-quirk path (not introduced by this PR).
The
dwc3_drd_update()logic has a potential issue: whenusb3_phy_reset_quirkis disabled (the else branch at lines 213-215), the mode is unconditionally set toDEVICE, which would overwrite a previously setHOSTmode from theEXTCON_USB_HOSTcheck. This means without the quirk, host mode can never be selected.The quirk-enabled path works correctly because the
EXTCON_USBconditional preserves the HOST mode when EXTCON_USB is not asserted.Since this PR explicitly states it changes only context lines for 6.18 compatibility and not patch logic, this is noted for awareness only.
🤖 Prompt for 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. In `@patch/kernel/archive/rockchip64-6.18/rk3399-usbc-phy-rockchip-naneng-Add-fallback-for-old-DTs.patch` around lines 187 - 218, In dwc3_drd_update() the else branch for when usb3_phy_reset_quirk is false currently unconditionally sets mode = DWC3_GCTL_PRTCAP_DEVICE and thus overwrites a previously-detected HOST mode; change that branch to only set DEVICE when extcon shows no HOST (i.e., respect the result of extcon_get_state(dwc->edev, EXTCON_USB_HOST) / the local variable ret so HOST is preserved), then call dwc3_set_mode(dwc, mode); update logic around usb3_phy_reset_quirk, extcon_get_state, EXTCON_USB_HOST/EXTCON_USB and the mode variable in dwc3_drd_update() so the HOST path is not clobbered by the non-quirk path.
🤖 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.
Nitpick comments:
In
`@patch/kernel/archive/rockchip64-6.18/rk3399-usbc-phy-rockchip-naneng-Add-fallback-for-old-DTs.patch`:
- Around line 187-218: In dwc3_drd_update() the else branch for when
usb3_phy_reset_quirk is false currently unconditionally sets mode =
DWC3_GCTL_PRTCAP_DEVICE and thus overwrites a previously-detected HOST mode;
change that branch to only set DEVICE when extcon shows no HOST (i.e., respect
the result of extcon_get_state(dwc->edev, EXTCON_USB_HOST) / the local variable
ret so HOST is preserved), then call dwc3_set_mode(dwc, mode); update logic
around usb3_phy_reset_quirk, extcon_get_state, EXTCON_USB_HOST/EXTCON_USB and
the mode variable in dwc3_drd_update() so the HOST path is not clobbered by the
non-quirk path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 86d09085-ec11-4e1f-8978-39bcb583ea9a
📒 Files selected for processing (1)
patch/kernel/archive/rockchip64-6.18/rk3399-usbc-phy-rockchip-naneng-Add-fallback-for-old-DTs.patch
Shadowrom2020
left a comment
There was a problem hiding this comment.
Works for me, fixes compilation of other rockchip64 boards
|
✅ This PR has been reviewed and approved — all set for merge! |
Description
The
rk3399-usbc-phy-rockchip-naneng-Add-fallback-for-old-DTs.patchinpatch/kernel/archive/rockchip64-6.18/was last rewritten against 6.18.18 (commit 2dc5b23). Mainline 6.18 stable progressed past that point and refactoreddwc3_readl()/dwc3_writel()to take thestruct dwc3 *directly instead ofdwc->regs. The patch context still references the old form, so hunks 1 (drivers/usb/dwc3/core.cline 153) and 3 (line 213) fail to match when building against 6.18.32.This commit updates only the patch context (no change to the
+/-payload) so the same logic applies cleanly on 6.18.32 while remaining compatible with the prior baseline.The copies of the same patch in
rockchip64-7.0(rebased by Paolo Sabatino on 2026-03-08, commit37142830b) androckchip64-7.1(copy from 7.0 on 2026-04-28,9d967eccf) already use the newdwc3_writel(dwc, ...)form and do not need a similar update.How Has This Been Tested?
Before, on a build pulling 6.18.32 sources (
./compile.sh BOARD=youyeetoo-r1-v3 BRANCH=current):After rebase, the patch applies cleanly on kernel 6.18.32, all 16 hunks across the 3 files (
core.c,core.h,drd.c), no offset, no rejects.Checklist:
Summary by CodeRabbit
Release Notes