Re: [PATCH 02/11] usb: tcpm: avoid hard reset for sink-only ports on Source_Cap timeout
Sebastian Reichel <[email protected]>
| Newsgroups | gmane.comp.boot-loaders.u-boot.general,gmane.comp.boot-loaders.u-boot |
|---|---|
| Message-ID | <aneRdwZf8ShsyoNB@venus> |
Hi, On Wed, Jun 17, 2026 at 04:23:01PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan <[email protected]> > > When a sink-only port times out waiting for Source_Capabilities in > SNK_WAIT_CAPABILITIES, the current code falls through to > hard_reset_state() which sends a Hard Reset. For sink-only ports > powered via VBUS, this causes the source to cut VBUS, resetting > the board. > > Unlike DRP ports which can potentially recover by switching roles, > sink-only ports have no recovery path after a Hard Reset induced > VBUS loss. Instead, gracefully fall back to SNK_READY to operate > at the Type-C default current. > > Signed-off-by: Peng Fan <[email protected]> > --- This violates the USB-PD specification, which says a reset should be done in this case. The Rock 5B has the same limitation as your board, but that's not true for all sink-only USB-C ports. A board might have a battery (then self-powered property *should* be set in the connector). A board might also be capable of being powered over a different power source (e.g. Rock 5B supports PoE). My suggestion would be to introduce a new property in the USB connector DT binding for usb-connector and then divert from the spec if that property is set: main-power-source: description: This port is the main power source of the board. Setting this might result in diverting from the USB-PD specification to avoid disabling VBUS as that would usually reset the whole board. type: boolean Greetings, -- Sebastian > drivers/usb/tcpm/tcpm.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/tcpm/tcpm.c b/drivers/usb/tcpm/tcpm.c > index d6c0be82333..25ff0926cdf 100644 > --- a/drivers/usb/tcpm/tcpm.c > +++ b/drivers/usb/tcpm/tcpm.c > @@ -1647,6 +1647,8 @@ static void run_state_machine(struct udevice *dev) > port->vbus_never_low = false; > tcpm_set_state(dev, SOFT_RESET_SEND, > PD_T_SINK_WAIT_CAP); > + } else if (port->port_type == TYPEC_PORT_SNK) { > + tcpm_set_state(dev, SNK_READY, 0); > } else { > tcpm_set_state(dev, hard_reset_state(port), > PD_T_SINK_WAIT_CAP); > @@ -1770,9 +1772,13 @@ static void run_state_machine(struct udevice *dev) > port->message_id = 0; > port->rx_msgid = -1; > if (tcpm_pd_send_control(dev, PD_CTRL_SOFT_RESET)) > - tcpm_set_state_cond(dev, hard_reset_state(port), 0); > + tcpm_set_state_cond(dev, > + port->port_type == TYPEC_PORT_SNK ? > + SNK_READY : hard_reset_state(port), 0); > else > - tcpm_set_state_cond(dev, hard_reset_state(port), > + tcpm_set_state_cond(dev, > + port->port_type == TYPEC_PORT_SNK ? > + SNK_READY : hard_reset_state(port), > PD_T_SENDER_RESPONSE); > break; > > > -- > 2.51.0 >
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmp3nl0ACgkQ2O7X88g7 +pog/w//UbRllgsOZh6wCeMBnuAiAzE+AYOnA3p7UUP9+KkslD4XohdL9S7jbctY diqk6xi300/5yeNCAU9cAv/MxXv8GYnLp8lD1qVSdD6c+wrFS/zXkXbv9Mg4fgHC MfJev2WbzvOfUcHut6aSSV9zaF8MAnBnHjtu0IqPa8M3Tf9j8nldLlYOdy8cIKVt sO9m5O/KY075HGxUYjmJjkjbGgclQ360DD/WPYEt9brg6QJ1SYXzy2UY0sz2sP2R cuVdSuD5La0oyml95Obwe2WTIE6vs50HRJudbCYsMB2gkDCaw2MME1AhYjMASXgs 7U1MA5dpkN+HHOCYIN1PYbBJ9tBmCdbDG0FPU4TKjKSZwVikUheTPepzHd9pPCIw ZB5yL9s7OCWScpasm+/mm/R6XWUnbZrZxJrDHADscLiqSx/SXW8jrCFTwg3vNcV3 TfR6os7540aQzbvv9ju7/22c1MhLgxlfVUMCsqY6qqHDD73bshffu1/+CMcWslIi WYC/IbpIwQGoTYQVLQD0eQrJwPUc3/0GsnwKhWvZtgWix4FnAwC+boQRcQk2WZl2 6V5e9/hVBptXQ6fNyO/znDYfdWCDeV8F68a1rrhLKWfx8fCttoAOcfau7t+e8mDa Kse++0DbU/2D/Ha775rfflkO9RBlMLfBq9ZZ8EbpkwXk0iijW6o= =cA6k -----END PGP SIGNATURE-----