Repository navigation
j873, kboot_atc: bring up all rear USB hosts and export T8152 USB3 tunables - #565
Conversation
j873_usb_prep() previously powered and initialized only usb-drd1 (back- left) and usb-drd2 (front internal hub), leaving the back-middle (usb- drd0, hpm0) and back-right (usb-drd3, hpm3) ports unconfigured for USB2 host mode. Add usb-drd3 (ATC3_USB_AON 0x3082901c0, PSD 74 0x303a14a00, ATC3_USB 0x3082901e0, DWC3 0x412430000, hpm3) to j873_usb[], and bring up usb- drd0 (ATC0_USB_AON 0x308290100, PSD 71 0x303a14700, ATC0_USB 0x308290120, DWC3 0x402430000, hpm0) in kboot_boot_t8152() so the USB CDC proxy still finds usb-drd0 cold if entered. Also allow ATCn_USB_AON to already be on (0x3ff) in j873_usb_power() in case display_init() already powered ATC3_USB_AON. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
Non-fixed-USB3 T8152 ATC PHYs (the rear Type-C ports on J873g) previously received only the common and CIO (USB4) lane tunable lists. Export apple,tunable-lane0-usb and apple,tunable-lane1-usb alongside the CIO lists so Linux can switch those ports between USB3 SuperSpeed (in either plug orientation) and USB4/CIO. Place tunable_ACIOPHY_USBC0_DFLT and tunable_ACIOPHY_USBC0_USB at the front of each lane's USB3 list rather than in apple,tunable-common-b so CIO/USB4 mode never writes USBC0 registers and older kernels that only consume the CIO lists keep identical behaviour. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
There was a problem hiding this comment.
Verdict: MERGE at 265e443c (once queued CI checks pass)
Blockers: none
Checked:
- Audited both commits (
42d50fa7,265e443c) across all 4 touched files (src/j873.c,src/j873.h,src/kboot.c,src/kboot_atc.c,+144/-36); zero code blockers found. - Verified
j873_usb0(usb-drd0) andusb-drd3MMIO/PMGR/PSD/DART/HPM tables follow the exact T8152 ATC stride (0x40PMGR,0x100PSD bank,0x8000000ATC block), andj873_usb_prep_host0()is called only inkboot_boot_t8152()right before Linux handoff so the USB CDC proxy still receivesusb-drd0cold when entered. - Verified
j873_usb_is_up(&j873_usb0)checksaon == 1023,!(psd & 7), andgate == 1023before readingu->dwc + 0xc110, soj873_usb_wake_hpms()cannot fault on a coldusb-drd0, andj873_usb_power()safely accepts already-powered AON (0x3ff) fromdisplay_init()while still validating cold PSD and gate. - Verified all 24
apple,tunable-lane0-usband 24apple,tunable-lane1-usbentries insrc/kboot_atc.c: every lane 1 offset equalslane0 + 0x9000(with sharedUSBC00x15c00placed at the front of each lane's USB3 list so CIO/USB4 mode never writes USBC0 registers and older kernels remain unaffected). - Verified exact-head
J873g(mini6) hardware row at265e443c(paired withlinux#356674b7061e): all 4 USB hosts active, VL817 SSD at 10000M (339-347 MB/s), VIA hub + RTL8153 GbE at 5000M (IPv4/IPv6 + ping 3/3 0% loss), front VL822 hub at 10000M, 0 failed units, 0 DART faults, plus PR text (What/Tested/Risktwo-way door).
Evidence
src/j873.c:j873_usb_prep_one()deduplicates bring-up acrossj873_usb[](id1, 2, 3) andj873_usb0(id0).src/kboot.c:j873_usb_prep_host0()runs inkboot_boot_t8152()afterkboot_move_to_exec_window(), gated bychip_id == T8152 && board_id == 0x24.src/kboot_atc.c:atc_tunables_t8152_cio[]addsapple,tunable-lane0-usbandapple,tunable-lane1-usbwithout alteringapple,tunable-common-a/borapple,tunable-lane0/1-cio.
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: Changes requested at 265e443c995e.
Blocker: On a rear T8152 PHY, the new required USB3 lane groups share the common/CIO export's failure path. If a USB3 group is absent or malformed after common and CIO calibration has been read successfully, that path deletes the valid common and CIO properties and drops existing USB4 support. Please publish the two USB3 lane lists together and clear only those two lists when the USB3 calibration is incomplete. Keep the existing common/CIO cleanup for errors in that calibration.
Checked: Compared the old and new export tables and followed dt_append_atc_tunable() through the cleanup. The J873g row verifies the complete group set. Please cover both complete and incomplete USB3 calibration in validation of the fix.
Export apple,tunable-lane0-usb and apple,tunable-lane1-usb for T8152 Type-C ports via a dedicated dt_copy_t8152_cio_usb3_tunables() helper that reuses atc_tunables_t8152_usb3[] instead of duplicating 48 static table entries in atc_tunables_t8152_cio[]. If any USB3 ADT group is missing or malformed after common/CIO export succeeded, cleanup now deletes only the two USB3 lane properties and preserves valid common and CIO calibration. Reusing the existing table also removes 48 PIE relocations from Stage 1, bringing gcc Stage 1 headroom back from 3664 B to 11480 B. Add a host test covering complete export (USBC0 at 0x15c00, lane 1 at +0x9000) and isolated cleanup on missing or malformed USB3 groups. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
|
Addressed in 45455f8:
|
There was a problem hiding this comment.
Verdict: HOLD at 45455f8c — dt_copy_t8152_cio_usb3_tunables() and test_t8152_atc_usb3.py cleanly resolve the common/CIO cleanup isolation blocker and restore Stage 1 headroom; awaiting queued CI completion and exact-head hardware confirmation at 45455f8c.
Blockers:
- Wait for queued CI checks (
build,ESP stage 2 vital size, all 5stage1-sizetoolchains, all 5Pytestjobs,format-check,policy,pr-text) at45455f8cto pass. - Post a J873g boot verification row at exact head
45455f8cconfirmingapple,tunable-lane0-usb/apple,tunable-lane1-usbexport and rear-port USB2/USB3 bring-up match the prior265e443cresult.
Checked:src/kboot_atc.c(dt_copy_t8152_cio_usb3_tunables(),atc_tunables_t8152_usb3[],dt_copy_atc_tunables()),tests/python/test_t8152_atc_usb3.py,src/j873.c,src/j873.h,src/kboot.c, and DCO sign-off at45455f8c.
Evidence
- Blocker fix verification (
45455f8c):dt_copy_t8152_cio_usb3_tunables()runs only after common/CIO export succeeds on non-apple,fixed-usb3atc-phy,t8152nodes, clears staleapple,tunable-lane0-usb/apple,tunable-lane1-usbfirst, and reusesatc_tunables_t8152_usb3[](verified lines 296–297 are the only two0x15c00USBC0 entries, followed by the 22apple,tunable-lane0-usbentries, biased by+0x9000for lane 1).- On any missing or malformed USB3 group,
cleanup:deletes onlyapple,tunable-lane0-usbandapple,tunable-lane1-usb, keeping valid common/CIO calibration intact for USB4. - Reusing
atc_tunables_t8152_usb3[]drops 48 duplicate entries and their PIE relocations from Stage 1 (restoring local GCC Stage 1 headroom to11,480 B). tests/python/test_t8152_atc_usb3.pyverifies complete 24-triple export per lane (0x15c04USBC0 prefix ++0x9000lane 1 stride) and isolated cleanup on both missing and malformed USB3 groups.
- Note (non-blocking):
@DjDeveloperrhas a pendingCHANGES_REQUESTEDreview from265e443cthat will also need dismissal/re-review once CI and the45455f8crow land.
In dt_copy_t8152_cio_usb3_tunables(), require each required ADT USB3 tunable group to be both present and non-empty before calling dt_append_atc_tunable(), taking the USB3-only cleanup path on a present-but-empty group while preserving common/CIO calibration. Extend tests/python/test_t8152_atc_usb3.py to cover the empty-group case alongside complete, missing, and malformed groups. Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
There was a problem hiding this comment.
Verdict: HOLD at d1d7ca31 — the empty required-group guard and host test extension are clean and code-ready; awaiting queued CI completion, exact-head J873g hardware confirmation, and @DjDeveloperr's re-review.
Blockers:
- Wait for queued CI checks at
d1d7ca31(build,ESP stage 2 vital size, allstage1-sizetoolchains,Pytest,pr-text,readiness) to complete green. - Post exact-head
d1d7ca31J873g hardware confirmation showing rear Type-C USB3 lane tunables exported and common/CIO calibration intact.
Checked:
- Audited commit
d1d7ca31(src/kboot_atc.cL937–940,tests/python/test_t8152_atc_usb3.py, DCOSigned-off-by:present):dt_copy_t8152_cio_usb3_tunables()checksadt_getprop(adt, adt_node, entry.adt_name, &len)and jumps tocleanupwhenentry.required && (!raw || !len), rejecting present-but-empty required USB3 ADT groups while clearing onlyapple,tunable-lane0-usb/apple,tunable-lane1-usband preserving common/CIO tunables.tests/python/test_t8152_atc_usb3.pyadds a present-but-emptytunable_ACIOPHY_USBC0_USBcase verifying both USB3 properties are removed and common/CIO properties remain intact.
Evidence
src/kboot_atc.c(L913–951): verified!rawshort-circuits before!lenandcleanupdeletes onlylane_names[].tests/python/test_t8152_atc_usb3.py(L28–45, L113–127): verifiedemptyhook returns non-NULL pointer with*len = 0, exercising the new guard after re-population.
|
Addressed in
|
Verified at d1d7ca3 that an empty required USB3 group clears both USB3 lane lists and preserves common/CIO. Exact-head CI and J873g hardware confirmation remain outstanding.
|
Exact-head Stage 2 hardware verification on Mac mini M6 (J873g, T8152, FW 27.2) at
|
There was a problem hiding this comment.
Verdict: MERGE at d1d7ca31
Blockers: none
Checked:
- Upgrading prior
HOLDatd1d7ca31: all build, format, policy, Stage 1 headroom,Pytest(Linux gcc/llvm, macOS 15/26, ARM native),selftest,clang-macos, and distro (fedora,alarm,nix) CI checks are green (0failures; only queuedpr-textandreadinessremaining). - Exact-head
d1d7ca31Stage 2 J873g (T8152, FW 27.2) hardware row posted: clean boot (0failed units,0kernel warnings/Call traces,0DART/IOMMU faults), live/proc/device-tree/soc/phy@*tunables verified across front hub andATC0/ATC1/ATC3, end-to-end rear USB3 SuperSpeed + 2-lane DP bring-up onATC3,test_t8152_atc_usb3.py8/8 PASS, Stage 1 gcc headroom11,480 B. - Prior
265e443creview is dismissed and both the USB3-only cleanup isolation (45455f8c) and present-but-empty required-group guard (d1d7ca31) are cleanly in place.
Evidence
d1d7ca31095df9000238ab85d4ddad45e05f2c8f(MERGEABLEonmain, DCO-signed):dt_copy_t8152_cio_usb3_tunables()rejects missing or zero-length required USB3 groups via the USB3-onlycleanuppath without deleting common/CIO calibration.- Wait for queued
pr-textandreadinesschecks to finish green before merging.
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merging under the 6-point rule at |
What: Bring up all three rear USB host controllers on J873g (
usb-drd0,usb-drd1,usb-drd3) in USB2 host mode and exportapple,tunable-lane0-usbandapple,tunable-lane1-usbon non-fixed-USB3 T8152 ATC PHYs so Linux can switch rear Type-C ports between USB3 SuperSpeed (normal and reversed orientations) and USB4/CIO.Tested: J873g M6 Mac mini (
mini6) at exact headd1d7ca31(Stage 2ESP_STAGE2=1, paired withaurora-silicon/linux#3617at460f8ea4bda8): all 4 USB hosts active (Bus 001..008), live DT exportscommon-a/common-b/lane0-cio/lane1-cio/lane0-usb/lane1-usbon all three rear PHYs (phy@{403000000,40b000000,413000000}) plus frontphy@383000000, Pin D 5000M SuperSpeed USB3 (Bus 008) + 480M USB2 (Bus 007) active alongside 2-lane2560x1440DP onATC3(phy-apple-atc 413000000.phy: USB3 SuperSpeed active alongside 2-lane DP (lane 1)), 0 failed units, 0 kernel warnings, 0 DART faults;pytest tests/python/test_t8152_atc_usb3.py8/8 PASS,make format-checkclean, Stage 1 gcc headroom 11,480 B. (Earlier at265e443c: VL817 10000M SSD 331-347 MB/s and VIA+RTL8153 5000M GbE normal/reversed hot-swap verified.)Risk: two-way door · T8152 (J873g)
Not yet: Other T8152 boards if any.