Files
bfe-core1106-sdk/patches/README.md
T
NoahandClaude Opus 5 f6add60a9c Keep the usb2 phy OTG state machines out of host role
Issue #160: the USB ethernet link on the OTG port stops passing traffic and
the host controller is later declared dead ("xHCI host not responding to stop
endpoint command", "HC died").

Root cause. The phy's OTG state machine and charger detection only make sense
while the port is a peripheral. This board has no ID source, so in host role
their inputs are meaningless: rockchip_usb2phy_otg_sm_work() reaches
OTG_STATE_B_IDLE with vbus asserted, schedules rockchip_chg_detect_work(), and
a DCP verdict calls rockchip_usb2phy_power_off(). That suspends the phy and
drops the 480M clkout the controller's core runs on, while a device is
enumerated and working.

The controller then stops clocking with its register block still readable, so
it reports itself healthy: USBCMD keeps RS set, USBSTS reads 0, PORTSC still
shows CCS and PED. Only MFINDEX gives it away by no longer advancing. Nothing
completes from that point, and the first transmit afterwards times out. The
recovery path cannot help either, because xhci_halt() needs the core clock to
update USBSTS.HCH, so it times out and xhci_reset() returns early without ever
writing USBCMD.HCRST.

dwc3 already calls phy_set_mode() on every role change, but this driver
implemented no .set_mode, so the phy never learned the role. Implement it,
track the role per port, and return early from both work functions in host
role. The check is inside the functions because both have direct callers
besides the scheduled work.

This keeps dr_mode "otg" and runtime role switching. Setting dr_mode to "host"
also avoids the fault, by skipping the same state machine, but compiles out
the gadget needed for flashing, recovery and pairing.

Measured on warden-c8a3, per arm, transmit packets and xhci interrupts
delivered after the stated idle:

  idle 0 s    +9, +10, +9 packets   +170, +176, +188 interrupts
  idle 120 s  +0, +0, +0 packets    +0, +0, +0 interrupts

Also drops 28-dwc3-otg-no-live-reinit.patch. It guarded dwc3_otg_host_init()
against re-entry on a live controller, but that path never executes here:
GSTS reads OTG IP clear and instrumentation logged no entries on either the
hardware irq or the guard site.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MVGTC78dgCGfRANNKjoPea
2026-09-23 00:25:15 -06:00

49 lines
2.6 KiB
Markdown

# The Kernel Patch Series
The delta that forward-ports the vendor Rockchip 5.10.160 RV1106 support onto a
pristine upstream **linux-6.18.46**, as a reviewable, subsystem-split series. Every
patch applies cleanly onto pristine 6.18.46 (`git apply --check`), and the whole set
reproduces the 223-file / ~136K-line delta that boots and is hardware-verified on
`warden-c8a3` (see `../kernel/rv1106-enablement/`).
Build it with `../build/build-kernel.sh` (fetch pristine -> apply these -> configure
with `../build/warden_defconfig` -> `zImage` + `rv1106-warden.dtb`).
## The Series
| Patch | Scope |
|---|---|
| `05-build-wiring.patch` | top-level `drivers/{Kconfig,Makefile}` (wire in rknpu) |
| `10-clk-rv1106.patch` | CRU clock driver (`clk-rv1106.c`, reuses rv1126 data) |
| `15-pinctrl.patch` | `pinctrl-rockchip` RV1106 iomux |
| `20-arch-dts-bindings.patch` | `arch/arm` DTs (`rv1106.dtsi`, `rv1106-warden.dts`, pinctrl), mach, configs, `include/dt-bindings` |
| `25-usb-phy.patch` | inno-usb2 phy |
| `27-usb-phy-tuning.patch` | inno-usb2 phy: RV1106 signal-quality register tuning |
| `29-usb2phy-no-otg-sm-in-host.patch` | inno-usb2 phy: keep the OTG/charger state machines out of host role |
| `30-drm-vop-panel-rgb.patch` | VOP (`rgb_dclk_pol`=0 + WIN1 scanout), panel-simple bus-format, rockchip_rgb |
| `35-mailbox-hpmcu.patch` | rockchip-mailbox (rv1106 num_chans=1) |
| `40-pvtm-soc.patch` | PVTM (core+pmu) + `include/soc/rockchip/pvtm.h` |
| `45-npu-rknpu.patch` | open GPL rknpu 0.9.2 driver + `rknpu_ioctl.h` uapi |
| `50-rga.patch` | RGA 2D (rga3) + `drivers/video` wiring |
| `60-wifi-aic8800.patch` | out-of-tree AIC8800 wifi/BT (the 88.5K-line vendor blob) |
| `70-audio-codec.patch` | `rv1106_codec` + I2S wiring |
| `80-misc-thermal-rtc-adc.patch` | tsadc, rtc-rockchip, saradc, trng, otp, gmac, goodix touch |
## License
Everything in this directory is a derivative work of the Linux kernel and of
GPL-2.0 vendor kernel code: **GPL-2.0-only** (or the per-file SPDX identifier
where one is present), the same license the whole repository carries.
## Provenance & regeneration
Baseline: `linux-6.18.46` from kernel.org (`build/linux-6.18.46.tar.xz.sha256`
pins the tarball). The series was generated by overlaying the hardware-verified
source tree onto pristine (build artifacts excluded) and splitting `git diff` by
subsystem. Licensing/origin of each block is tracked in
`../kernel/rv1106-enablement/PROVENANCE.md`.
Whitespace: `60-wifi-aic8800.patch` carries the vendor blob's trailing-whitespace
verbatim; `git apply --whitespace=nowarn` (the build wrapper) accepts it. Do not
re-flow vendor code; it must stay diffable against future vendor drops.