Skip to content

usb: typec: tipd: take the replug's unlock key from the DT - #2639

Merged
DjDeveloperr merged 2 commits into
integration/aurorafrom
djdev/tipd-replug-key-from-dt
Nov 21, 2026
Merged

DjDeveloperr merged 2 commits into
integration/aurorafrom
djdev/tipd-replug-key-from-dt

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2638, whose commit this branch includes; #2640 stacks on it. Review only the last commit, take the replug's unlock key from the DT. Part of the no-board-gates rule: board facts go in the DT, not in driver lists.

What changes

  • The partner replug (DISC) was J714s-only, with the J714s key 417J built into the driver. The key is the board's target identifier, reversed.
  • It now comes from the controller's apple,debug-lock-key. That's the same LOCK key the DT already gives for debug mode (J700: 007J).
  • tipd_replug_supported() is true for an SN201202x that has a four-character key.
  • The binding description is generalized.
  • The J714s's three USB-C controllers get apple,debug-lock-key = "417J" in t6050-j714s.dts.

Effect

  • J714s: unchanged with a DTB built from this tree. With an older DTB the replug is refused with -EOPNOTSUPP.
  • J700: its debug-port controller already has its key, but its connector has no USB role switch, so neither debugfs nor dwc3-apple can request a replug. Nothing changes there.
  • The debug-link rearm still needs apple,debug-port (only the J700 has it) and a sleep that cut that controller's link, so it doesn't start on the J714s.

Review: done. Fixed from it: the J700 statement, "board number reversed", and two stale comments. Still open: cd321x_inherited_boards hard-codes LOCK keys behind machine compatibles (J716c "617J", J575c "575J"), left for the later board-table pass.

Merge prerequisite (rig): the M5 rig boots a lab-built DTB (fdc15472) that doesn't have the new property. Merging this without refreshing that DTB would turn off the replug on the rig: the Dell-port SuperSpeed recovery and the gates' replug trigger. So the merge waits for a rig DTB refresh: fdc15472 plus these properties, gated and switched.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor

Looks right. tipd_replug_key() gates on the SN201202x compatible and a four-character key. tipd_replug_supported() and the work item both go through it, so a controller without the property keeps returning -EOPNOTSUPP at the request. A failed key read in the work item still runs the relock with the zero key, which is harmless. The binding text now covers both uses of the key.

With this, the J700's debug-port controller (0xc, "007J") gets the replug. It has a connector and apple,sleep-ssps, so with #2638 it also takes the running-time cable SSPS/USBw step. A debugfs replug there exercises that step on the J700 without anyone touching the cable, so it can serve as the J700 row #2638 asks for.

Assisted-by: LLM (Claude:Opus 5.5)

DjDeveloperr and others added 2 commits November 20, 2026 20:09
…ntroller

The macOS sleep entry and wake of an SN201202x, its USB-wake arm after
the PHYs' stop and the SSPS/USBw at a cable change were taken only on
the J714s (of_machine_is_compatible("apple,j714s")). Select them by
what the controller and its DT present instead:

- the sleep entry and wake: a polled controller (no interrupt in the
  DT) that follows the system's power state (apple,sleep-ssps) and arms
  no USB wake of its own (no apple,usb-remote-wake), for a firmware
  sleep, from a port last known dry or mitigated, as before;
- the USB-wake arm: every controller with apple,sleep-ssps registers
  for apple-sleep's notifier; it arms only with that macOS entry and a
  connector with a partner, as before, and only the T6050 sleep's
  .prepare_late calls the notifier;
- the cable change: an SN201202x whose DT asks for it with the new
  apple,cable-change-ssps (set on the J714s's USB-C port controllers,
  where macOS's sequence was traced), with a connector, while running,
  and not one in a debug route (from before Linux, or opened through
  debugfs). It is not
  tied to apple,sleep-ssps: the J700's controllers follow the system's
  power state, but macOS sends them only SSPS around a sleep.

On the J714s nothing changes, given a DTB built from this tree, except
that a USB-C controller in a debug route no longer gets the cable
sequence. The macOS entry now also applies to the other boards whose
DT marks polled SN201202x controllers with apple,sleep-ssps, J716c and
J813, and the USB-wake arm on the T6050 one (J716c). Neither has been
traced or tested with it.

Signed-off-by: Diljit Singh <hey@djdev.me>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A partner replug ("DISC") was offered only on the J714s, with the
J714s's unlock key built into the driver: "417J", the board number
reversed. The key is a board fact, the same kind of key the
controller's LOCK takes for its debug mode, which the DT already gives
as apple,debug-lock-key (J700: "007J").

Read the key from apple,debug-lock-key. tipd_replug_supported() is
true for an SN201202x whose DT gives a four-character key, and the
replug unlocks with it. The binding's description says the key is the
board number reversed, four characters, and serves both commands. The
J714s's three USB-C port controllers get "417J".

On the J714s the replug behaves as before, given a DTB built from this
tree; with an older DTB it is refused (-EOPNOTSUPP). The J700's debug
port controller already has its key, but its connector has no USB role
switch, so neither debugfs nor dwc3-apple can ask it for a replug. The
debug link rearm needs the key and a sleep that cut that controller's
link (apple,debug-port, the J700's only), so it doesn't start on the
J714s.

Signed-off-by: Diljit Singh <hey@djdev.me>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DjDeveloperr
DjDeveloperr force-pushed the djdev/tipd-replug-key-from-dt branch from 59e7bb5 to 82123a0 Compare November 21, 2026 01:11
@DjDeveloperr
DjDeveloperr merged commit 583f35b into integration/aurora Nov 21, 2026
2 checks passed
@RyanTheTide

Copy link
Copy Markdown
Contributor

J700 row on fleet77 (integration b4cd7b3 based), with this PR's tipd modules (with #2622 and #2638) swapped in at runtime. The modules load, both controllers probe, and the dock's devices re-enumerate.

The replug node does not appear for the J700's debug-port controller (1-0c, apple,debug-lock-key = "007J"), only command and regs. tipd_debugfs_register() creates it only when tps->role_sw is set. On the J700 the usb-pd@c connector's port@0 endpoint points at usb@40a280000/hub@1/ports/port@2, the onboard hub's node, not at the dwc3 node that has usb-role-switch. So fwnode_usb_role_switch_get() returns NULL there. The description's "J700: its debug-port controller can now be replugged through debugfs" doesn't hold on the current J700 DT.

Two ways out: let the replug go without a role switch (the DISC unlock/relock doesn't need one, and the interrupt handler sets the roles again), or have the lookup follow the graph through the hub node up to the controller. Either way the J700 could then run the cable-step row #2638 asked for without anyone touching the cable. #2638's running cable step itself wasn't exercised here: a module reload re-probes, and the step only runs on an attach or detach while running.

Assisted-by: LLM (Claude:Opus 5.5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants