@@ -345,7 +345,7 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
int recv_bytes;
uint32_t status;
uint32_t aux_clock_divider;
- int try, precharge;
+ int try, aux_ch_try, precharge;
if (IS_HASWELL(dev)) {
switch (intel_dig_port->port) {
@@ -428,7 +428,10 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
DP_AUX_CH_CTL_DONE |
DP_AUX_CH_CTL_TIME_OUT_ERROR |
DP_AUX_CH_CTL_RECEIVE_ERROR);
- for (;;) {
+ /* Wait 1 ms then timeout, it should be sufficient since the
+ * timeout above is 400us
+ */
+ for (aux_ch_try = 0; aux_ch_try < 10; aux_ch_try++) {
status = I915_READ(ch_ctl);
if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
break;
@@ -448,6 +451,9 @@ intel_dp_aux_ch(struct intel_dp *intel_dp,
if (status & DP_AUX_CH_CTL_DONE)
break;
}
+ /* If after 5 tries we're still busy, give up. */
+ if ((status & DP_AUX_CH_CTL_SEND_BUSY) != 0)
+ return -EIO;
if ((status & DP_AUX_CH_CTL_DONE) == 0) {
DRM_ERROR("dp_aux_ch not done status 0x%08x\n", status);