[PATCH v2 00/10] usb: Add TCPCI driver and DWC3 OTG dual-role support

Peng Fan (OSS) peng.fan at oss.nxp.com
Sun Jun 21 04:06:36 CEST 2026


[V2] Just resend this patchset without
"usb: tcpm: fix inverted poll condition in tcpm_pd_transmit()"

This series adds TCPCI (Type-C Port Controller Interface) driver support
to U-Boot's TCPM framework and enables runtime USB host/device mode
switching on platforms using DWC3 with Type-C connectors.

The work is motivated by the NXP i.MX8MP EVK, which has a PTN5110 TCPCI
chip managing a USB Type-C data port. The goal is to support both
"usb start" (host mode, for USB storage) and "ums"/"fastboot" (device
mode, for flashing) on the same Type-C port, switchable at runtime.

The series breaks down into three logical groups:

TCPM bugfixes (patches 1-3):
  Fix three issues discovered in the upstream TCPM state machine during
  PD sink testing with various chargers:
  - Inverted poll condition causing transmit to always time out
  - Unnecessary hard resets on sink-only ports when source doesn't
    respond to capabilities request
  - Premature exit from poll loop after SNK_READY, missing source
    follow-up messages (Get_Sink_Cap etc.) that trigger hard reset

TCPCI driver and TCPM API extensions (patches 4-7):
  - Lightweight PD negotiation tracing (RAM ring buffer, zero serial
    overhead) for debugging charger interop issues
  - TCPCI driver for NXP PTN5110 and compatible chips, ported from
    the Linux kernel with adaptations for U-Boot's polled model
  - New tcpm_setup_host_mode()/tcpm_setup_device_mode() APIs that
    configure Type-C CC role and detect cable orientation without
    running the full PD state machine -- appropriate for U-Boot's
    synchronous, command-driven execution model
  - pd-disable connector property support in tcpm_post_probe() to
    skip the PD state machine for data-only ports while keeping the
    TCPCI driver ops accessible

DWC3 OTG and board support (patches 8-11):
  - board_usb_init()/board_usb_cleanup() hooks in DWC3 generic glue,
    called during child probe/remove to allow board-level Type-C
    configuration before DWC3 core init
  - OTG dual-bind: when dr_mode="otg", bind both dwc3-generic-host
    and dwc3-generic-peripheral children; runtime mode switching via
    dwc3_otg_deactivate_sibling() which removes the active sibling
    before probing the new one
  - i.MX8MP EVK board support wiring it all together: TCPCI DT nodes,
    board_usb_init using TCPM APIs for CC role setup and SS mux
    control, PD sink configuration for the power port

Tested on NXP i.MX8MP EVK.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
Changes in v2:
- Drop "usb: tcpm: fix inverted poll condition in tcpm_pd_transmit"
  which was sent to list as a separate fix.
- Link to v1: https://patch.msgid.link/20260617-tcpci-dwc3-v1-0-b824fe1e9299@nxp.com

---
Peng Fan (9):
      usb: tcpm: avoid hard reset for sink-only ports on Source_Cap timeout
      usb: tcpm: continue polling after PD negotiation to handle source messages
      usb: tcpm: add lightweight PD negotiation tracing
      usb: tcpm: add TCPCI (Type-C Port Controller Interface) driver
      usb: tcpm: add setup_host_mode/device_mode/disable_src_vbus APIs
      usb: tcpm: skip state machine for pd-disable ports
      usb: dwc3: generic: support OTG dual-bind for runtime host/device switching
      board: imx8mp_evk: enable USB PD sink via TCPCI
      board: imx8mp_evk: add USB Type-C OTG support with TCPCI

Ye Li (1):
      usb: dwc3: generic: add board_usb_init/cleanup hooks

 arch/arm/dts/imx8mp-evk-u-boot.dtsi |  52 ++-
 board/nxp/imx8mp_evk/imx8mp_evk.c   |  78 ++++
 configs/imx8mp_evk_defconfig        |   3 +
 drivers/usb/dwc3/dwc3-generic.c     |  73 +++-
 drivers/usb/tcpm/Kconfig            |   9 +
 drivers/usb/tcpm/Makefile           |   1 +
 drivers/usb/tcpm/tcpci.c            | 778 ++++++++++++++++++++++++++++++++++++
 drivers/usb/tcpm/tcpm-internal.h    |  40 ++
 drivers/usb/tcpm/tcpm-uclass.c      |  87 ++++
 drivers/usb/tcpm/tcpm.c             |  46 ++-
 include/usb/tcpci.h                 | 185 +++++++++
 include/usb/tcpm.h                  |   4 +
 12 files changed, 1350 insertions(+), 6 deletions(-)
---
base-commit: debaadb75013a6d3706a2137d540bf4660475e3e
change-id: 20260617-tcpci-dwc3-653a5d9c8893

Best regards,
--  
Peng Fan <peng.fan at nxp.com>



More information about the U-Boot mailing list