[PATCH v2] usb: tcpm: fix inverted poll condition in tcpm_pd_transmit()

Peng Fan (OSS) peng.fan at oss.nxp.com
Thu Jun 18 08:48:48 CEST 2026


From: Peng Fan <peng.fan at nxp.com>

The read_poll_timeout() macro breaks out of its loop when the condition
evaluates to true. The current code uses "!tx_complete" as the
condition, which means it exits immediately when tx_complete is false
(i.e., transmission has NOT completed yet), rather than waiting for
completion.

Fix the condition to "tx_complete" so that the poll loop waits until
the TCPC signals transmission success/failure/discard before
proceeding.

Without this fix, tcpm_pd_transmit() returns before the TCPC has
finished transmitting, causing the PD state machine to proceed with
stale tx_status values.

Fixes: 1db4c0ac77e3 ("usb: tcpm: add core framework")
Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
Changes in V2:
 Add R-b
 Separate the patch from patchset:
 https://lore.kernel.org/u-boot/20260617-tcpci-dwc3-v1-0-b824fe1e9299@nxp.com/
---
 drivers/usb/tcpm/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/tcpm/tcpm.c b/drivers/usb/tcpm/tcpm.c
index 3061b466d7c..d6c0be82333 100644
--- a/drivers/usb/tcpm/tcpm.c
+++ b/drivers/usb/tcpm/tcpm.c
@@ -207,7 +207,7 @@ static int tcpm_pd_transmit(struct udevice *dev,
 	 */
 	timeout_us *= 5;
 	ret = read_poll_timeout(tcpm_transmit_helper, tx_complete,
-				!tx_complete, false, timeout_us, dev);
+				tx_complete, false, timeout_us, dev);
 	if (ret < 0) {
 		dev_err(dev, "TCPM: PD transmit data failed: %d\n", ret);
 		return ret;

---
base-commit: a0a1e9f2f1dffed04ee52723ce957c07bb905c25
change-id: 20260618-tcpm-fix-ac71d74523fe

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



More information about the U-Boot mailing list