[PATCH] tcpm: fix pd_transmit poll condition
Marcel Ziswiler
marcel.ziswiler at codethink.co.uk
Wed Jun 18 11:38:53 CEST 2025
Hi Neil
Good catch. Thanks!
On Mon, 2025-05-26 at 09:42 +0200, Neil Armstrong wrote:
> The read_poll_timeout() exit "cond" parameter wait for a complete
> transmit state.
>
> The "!tx_complete" cond means that on the first tcpm_transmit_helper()
> call, if the tx_complete returns to false, the poll loop would exit.
> But since at probe the tx_status is left at 0, the tx is considered
> as successful. And then later the proper status is returned and
> ignored.
>
> But if on the first tcpm_transmit_helper() call the TX status is
> returned the read_poll_timeout() would return in timeout and the
> negociation would fail.
>
> Fixes: 1db4c0ac77e ("usb: tcpm: add core framework")
> Signed-off-by: Neil Armstrong <neil.armstrong at linaro.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler at codethink.co.uk> # rock5b
> ---
> 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 0aee57cb2f4a44af7b483e0e609e39ba584a06c0..c8679615cd7701982b64b1905c5822ac98ed6f79 100644
> --- a/drivers/usb/tcpm/tcpm.c
> +++ b/drivers/usb/tcpm/tcpm.c
> @@ -209,7 +209,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: bab54f5942c428be698216224fd10b91d974d4da
> change-id: 20250526-topic-tcpm-tx-poll-cond-8dd3ebbbeddc
>
> Best regards,
> --
> Neil Armstrong <neil.armstrong at linaro.org>
Cheers
Marcel
More information about the U-Boot
mailing list