Commit fe1a1cf7 authored by Mika Westerberg's avatar Mika Westerberg

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: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent e70a8f36
...@@ -339,9 +339,10 @@ static bool tb_dp_is_usb4(const struct tb_switch *sw) ...@@ -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); 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; u32 val;
int ret; int ret;
...@@ -368,8 +369,8 @@ static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out) ...@@ -368,8 +369,8 @@ static int tb_dp_cm_handshake(struct tb_port *in, struct tb_port *out)
return ret; return ret;
if (!(val & DP_STATUS_CTRL_CMHS)) if (!(val & DP_STATUS_CTRL_CMHS))
return 0; return 0;
usleep_range(10, 100); usleep_range(100, 150);
} while (timeout--); } while (ktime_before(ktime_get(), timeout));
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -519,7 +520,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel) ...@@ -519,7 +520,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel)
* Perform connection manager handshake between IN and OUT ports * Perform connection manager handshake between IN and OUT ports
* before capabilities exchange can take place. * before capabilities exchange can take place.
*/ */
ret = tb_dp_cm_handshake(in, out); ret = tb_dp_cm_handshake(in, out, 1500);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment