diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2022-06-19 17:02:48 +0200 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2023-01-17 10:37:00 +0100 |
commit | fe1a1cf7c97028570127ac8d222c2b451ba04278 (patch) | |
tree | 94d54b2d3d9542ab938e33be8ede02688713454c /drivers/thunderbolt/tunnel.c | |
parent | thunderbolt: Take CL states into account when waiting for link to come up (diff) | |
download | linux-fe1a1cf7c97028570127ac8d222c2b451ba04278.tar.xz linux-fe1a1cf7c97028570127ac8d222c2b451ba04278.zip |
thunderbolt: Increase timeout of DP OUT adapter handshake
Sometimes the current timeout is not enough so increase it to 1500 ms
and while there make the loop use ktime instead.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tunnel.c')
-rw-r--r-- | drivers/thunderbolt/tunnel.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c index 62a2d0eb1c5c..04fbdbbc4ee2 100644 --- a/drivers/thunderbolt/tunnel.c +++ b/drivers/thunderbolt/tunnel.c @@ -339,9 +339,10 @@ static bool tb_dp_is_usb4(const struct tb_switch *sw) return tb_switch_is_usb4(sw) || tb_switch_is_titan_ridge(sw); } -static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out) +static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out, + int timeout_msec) { - int timeout = 10; + ktime_t timeout = ktime_add_ms(ktime_get(), timeout_msec); u32 val; int ret; @@ -368,8 +369,8 @@ static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out) return ret; if (!(val & DP_STATUS_CTRL_CMHS)) return 0; - usleep_range(10, 100); - } while (timeout--); + usleep_range(100, 150); + } while (ktime_before(ktime_get(), timeout)); return -ETIMEDOUT; } @@ -519,7 +520,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel) * Perform connection manager handshake between IN and OUT ports * before capabilities exchange can take place. */ - ret = tb_dp_cm_handshake(in, out); + ret = tb_dp_cm_handshake(in, out, 1500); if (ret) return ret; |