Skip to content

phy: the TI TUSB2E11 eUSB2 repeater (Pixel 9a) - #107

Draft
W4HO-ham wants to merge 2 commits into
derekross:omamobilefrom
W4HO-ham:tegu-tusb2e11
Draft

W4HO-ham wants to merge 2 commits into
derekross:omamobilefrom
W4HO-ham:tegu-tusb2e11

Conversation

@W4HO-ham

Copy link
Copy Markdown
Contributor

Draft: built and checked, not yet run on the palmtop. It waits for the USB host test (a flash drive on the 9a's port), which will show whether the board's repeater tuning is what host mode needs.

The 9a's USB 2.0 path goes from the zumapro eUSB2 PHY through a TI TUSB2E11 repeater (hsi2c_9 at 0x3e, supply LDO19M) to the Type-C connector. Today the bootloader's repeater setup carries peripheral mode; host mode reaches the repeater's host role, but the root hub port's reset never completes.

Two patches:

  1. dt-bindings: ti,tusb2e11, with its 3.3 V supply and one optional property per signal tuning register (mode control 0x50, the USB 2.0 side 0x70-0x73, the eUSB2 side 0x77-0x79).
  2. phy: at init, power it, wait the 3 ms it needs before it answers I2C, enable its port (GLOBAL_CONFIG bit 6 clear) and write the tuning the board describes; at exit, disable the port and the supply. The role needs no driver, since the repeater follows the eUSB2 link (Google's driver never writes CONFIG_PORT1 either). snps-eusb2 already takes a repeater through phys.

Registers, the ready time and tegu's values (0x50=0a, 0x70=4f, 0x71=3c, 0x72=92, 0x73=86, 0x77=00, 0x78=0b, 0x79=60) come from Google's GPL eusb_repeater driver and zuma-tegu-usb.dtsi.

Checks: checkpatch --strict (only the new-file MAINTAINERS note on the binding patch, which the driver patch's MAINTAINERS entry covers), W=1 build, dt_binding_check. The board DT patch follows once the host test passes.

The TUSB2E11 converts between an SoC's eUSB2 signalling and USB 2.0 on
one port, as on the Pixel 9a between the zumapro eUSB2 PHY and the
Type-C connector. It takes its role from the eUSB2 link, so the binding
only describes its supply and the board's signal tuning, one property
per tuning register; the register names follow Google's GPL
eusb_repeater driver.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
Power the repeater, wait the 3 ms it needs before it answers I2C, enable
its port and write the board's tuning from the device tree; at exit,
disable the port and the supply. The role needs no driver: the repeater
follows the eUSB2 link. Registers and timing follow Google's GPL
eusb_repeater driver for the Pixel 9a, which writes the same tuning.

Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com>
@derekross

Copy link
Copy Markdown
Owner

A note for when this leaves draft, since the 9a's USB is your only link to the phone while you test it: the safety points I posted on #118 (the board side of this repeater) apply here too. Please test it behind a dead-man switch that undoes the change if a fresh SSH login fails (tools/usbc-deadman or a systemd-run --on-active timer), include a replug test, and make sure the PHY is taken down (phy_exit) across suspend so the repeater doesn't stay powered. No other comments until it's ready for review.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Understood, and I'll keep it in draft until all three are done. Answering the part that is a code question now, and leaving the rest as the test plan for when it leaves draft.

The power-down path exists. tusb2e11_exit() sets TUSB2E11_GLOBAL_DISABLE_P1 and then disables the supply, so a phy_exit() leaves the repeater unpowered rather than merely idle, and the error path in init() drops the supply too. What that does not tell us is whether anything calls phy_exit() across s2idle on this board, which is the thing you asked for and is a system question rather than a driver one: the consumer is the USB controller, and on the 9a that is a test boot.

So the test plan for leaving draft, all three of your points:

  1. Behind tools/usbc-deadman, with the undo armed before the change and a fresh tools/phone-ssh --fresh login to confirm the link survived.
  2. A replug test, which the 9a needs anyway because of the MAX77779's data switch on unplug.
  3. The rail read across a sleep rather than assumed: eusb-vdd in /sys/class/regulator before the freeze and after the wake, plus the repeater's own GLOBAL_CONFIG if I2C answers, to show the port disabled and the supply off while asleep. If nothing calls phy_exit() there, that is a finding about the controller's suspend path and I will say so rather than paper over it with a driver-side power-down.

No action wanted from you on this; I'll post the results under those three headings.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

One measurement to add, from the daily boot just now (no repeater driver loaded): eusb-vdd and eusb-vdda12 both read enabled with one consumer each, from the S2MPG14, and touch-avdd likewise. So on this phone the repeater's supplies are already up and claimed before this driver is anywhere near them, which makes sense: the repeater sits in the USB2 path that carries the only link to the phone.

That sharpens your third point rather than answering it. Powering the repeater down on phy_exit() is right, but on the 9a it has to be paired with coming back on resume, and the test has to prove the link returns, not just that the rail went off. Which is exactly why the dead-man switch belongs in the test. I'll report the rail state before the freeze, during it, and after the wake, together with a fresh login afterwards.

@derekross

Copy link
Copy Markdown
Owner

Thanks for the plan. Two corrections, the first mine: tools/usbc-deadman is hard-wired to the 7 Pro's MAX77759, so on the 9a please use systemd-run --on-active=90 systemctl reboot plus a tools/phone-ssh --fresh login. And eusb-vdd and eusb-vdda12 are the eUSB2 PHY's supplies (LDO8M and LDO9M on usb_hsphy). The repeater's rail is LDO19M, so that's the one to read across sleep, along with its use count.

@W4HO-ham

Copy link
Copy Markdown
Contributor Author

Both corrections taken, thank you: I had the wrong rail. The repeater's supply is LDO19M (eusb-repeater-vdd), and eusb-vdd and eusb-vdda12 are the eUSB2 PHY's (LDO8M and LDO9M on usb_hsphy), so the measurement I posted says the PHY is powered, not the repeater. The plan for leaving draft now reads: eusb-repeater-vdd with its use count before the freeze, during it and after the wake; systemd-run --on-active=90 systemctl reboot armed before the change and a tools/phone-ssh --fresh login to disarm it, since tools/usbc-deadman is wired to the 7 Pro's MAX77759; and the replug test. Nothing further until it comes out of draft.

@derekross

Copy link
Copy Markdown
Owner

Thanks, @W4HO-ham. The plan reads right to me: LDO19M (eusb-repeater-vdd) with its use count before the freeze, during it and after the wake, a systemd-run --on-active=90 systemctl reboot timer armed before the change and stopped only after a fresh tools/phone-ssh --fresh login, and the replug. The branch hasn't moved since my last comment, so there's nothing new to review in the code. It still builds and passes the gate merged onto today's omamobile.

Two things to fold into that test while you're planning it. Neither needs a push now.

  1. How the driver gets loaded. Once arm64: dts: exynos: google: zumapro-tegu: Add the eUSB2 repeater #118's board change gives usb_hsphy phys = <&usb_repeater>, the eUSB2 PHY waits for this driver before it initialises, and the gadget waits for the PHY. The 9a's USB already needed four options built in to come up in the initramfs (omarchy-mobile#227), and this would be a fifth. So please say how the test kernel carries PHY_TI_TUSB2E11: built in, or in the initramfs's module list. Also say what you expect if it's missing (most likely no gadget in the initramfs, so the first boot is attended with the buttons in reach). If built in is the answer, it belongs in kernel/configs/omamobile.config, next to PCI: exynos: add staged GS101 Wi-Fi controller and PHY support #227's options.
  2. The rail's first 30 seconds. In arm64: dts: exynos: google: zumapro-tegu: Add the eUSB2 repeater #118, ldo19m has no regulator-always-on, so the regulator core's unused-regulator cleanup will switch it off about 30 s after late init unless this driver has enabled it by then. On the first boot, please read the rail's state and use count once after 40 s of uptime, as well as across the sleep.

Nothing more from me until it leaves draft.

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