Round 33: USB stack enabled (xHCI + T-PHY + keyboard); payload 35345ec7

This commit is contained in:
vhaudiquet
2026-08-30 19:29:39 +02:00
parent a252735992
commit 15fa3b22f5
+72
View File
@@ -1225,3 +1225,75 @@ Still WIP/temporary in the u-boot tree (to revert before upstreaming):
Next: milestone 4 — distro_bootcmd booting pmOS from USB (sda), then
cleanup/upstreaming pass (single-purpose commits, MAINTAINERS,
checkpatch, revert diagnostics).
## Round 33 — USB stack enabled (xHCI + T-PHY + keyboard); payload `35345ec7…`
Milestone 4 step 1: make the pogo keyboard (USB HID behind the GL610
hub on `usb_host`) work at the prompt. Krane defconfig had been forked
from pumpkin minus all USB/PHY configs.
### Source survey (all mainline drivers, no new driver needed)
- U-Boot `drivers/usb/host/xhci-mtk.c` binds `mediatek,mtk-xhci`
(matches the `usb@11200000` child of `ssusb@11201000`) and expects
reg-names `mac` + `ippc` and a `phys` list ON THE XHCI NODE. The
upstream mt8183.dtsi models the block for the Linux mtu3 driver:
`ippc` (0x11203e00) and the `phys` live on the PARENT mtu3 node,
the xhci child has only `mac`. U-Boot has no mtu3 driver.
→ new `arch/arm/dts/mt8183-kukui-krane-sku176-u-boot.dtsi`
(auto-included at the END of the upstream dts by
scripts/Makefile.lib `dtsi_include_list`, so `&label` refs work)
adds `ippc` to `reg`/`reg-names` and
`phys = <&u2port0 PHY_TYPE_USB2>, <&u3port0 PHY_TYPE_USB3>` to
`usb_host`. Not a DT fork; upstream file untouched. Verified in the
compiled dt.dtb.
- `drivers/phy/phy-mtk-tphy.c` binds `mediatek,generic-tphy-v2`
(mt8183 u3phy node is already status-okay with both ports).
- Regulators: kukui DT gives `vusb33-supply = <&mt6358_vusb_reg>`, but
U-Boot has no MT6358 PMIC/regulator driver. Safe: on missing
regulator, `device_get_supply_regulator` fails (debug only) and
`regulator_set_enable(NULL)` returns -ENOSYS, which
`xhci_mtk_ldos_enable` tolerates (vusb33 is a 3.3 V LDO the firmware
already keeps on; no VBUS regulator exists in the DT for usb_host).
No PMIC work needed.
- MMU: MTK armv8-mem-map pre-maps 0x00x20000000 as device; xhci
(0x11200000), ippc (0x11203e00) and phy (0x11f40000) need NO dynamic
mappings — the R31 get_page_table_size headroom is untouched.
- Enumeration→keyboard path: `U_BOOT_USB_DEVICE(usb_kbd,
kbd_id_table)` in common/usb_kbd.c matches HID boot-protocol
keyboards during `usb_scan_device`; the bound UCLASS_KEYBOARD probe
registers stdio "usbkbd" and re-runs `iomux_doenv(stdin)` when the
env `stdin` contains the name.
- Timing: no `initr_usb` exists in board_r.c anymore — USB is only
enumerated on `usb start`. CONFIG_PREBOOT has a built-in default of
"usb start" when USB_KEYBOARD=y (boot/Kconfig), so
`CONFIG_USE_PREBOOT=y` suffices: preboot runs at main_loop entry
(after console_init_r, so probe errors print to the panel/vidconsole;
keyboard not yet in the stdin mux at console_init_r is fine —
iomux_err falls back to serial, then usb_kbd probe re-muxes stdin).
SYS_CONSOLE_ENV_OVERWRITE defaults n, so krane.env's
`stdin=serial,usbkbd` survives until the re-mux.
### Changes (u-boot `krane` branch)
- configs/mt8183_kukui_krane_defconfig: USE_PREBOOT, CMD_USB, USB,
DM_USB, USB_XHCI_HCD, USB_XHCI_MTK, USB_KEYBOARD, USB_STORAGE (for
the sda distro boot), PHY, PHY_MTK_TPHY. Defconfig re-run done.
- arch/arm/dts/mt8183-kukui-krane-sku176-u-boot.dtsi: new overlay
(ippc + phys onto usb_host).
- board/mediatek/mt8183/krane.env: stdin=serial,usbkbd.
- Build OK; `_start` still 0x4C001000 == __image_copy_start; dtb
verified (mac+ippc+phys on usb@11200000). Payload `35345ec7…`
flashed, cmp OK, vbutil_kernel body verification succeeded.
### Decision tree for the reboot
| observation | meaning |
|---|---|
| banner → `usb start` scanning lines → prompt; typing works | WORKING |
| banner → "Scanning bus … failed, error N" or xhci/phy error text, then prompt | enumeration failed at stage N (transcribe the error line) |
| banner → prompt, no usb lines at all | preboot never ran |
| reset to menu <1 s after banner | sync abort in USB probe (PANIC_HANG should freeze instead — check it is still set) |
| prompt but keys do nothing | keyboard not enumerated (pogo not seated?) or stdin mux — re-seat keyboard and power-cycle |
Awaiting user reboot report.