Commit 0172e411 authored by Gil Fine's avatar Gil Fine Committed by Mika Westerberg
Browse files

thunderbolt: Poll 10ms for REG_FW_STS_NVM_AUTH_DONE to be set



In Intel Tiger Lake and beyond it takes some time after the force power
is set until the firmware connection manager is ready. So instead of
reading it once we poll it for 10ms before giving up.

Signed-off-by: default avatarGil Fine <gil.fine@intel.com>
Reviewed-by: default avatarYehezkel Bernat <YehezkelShB@gmail.com>
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 349bfe08
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -1677,14 +1677,18 @@ static void icm_icl_rtd3_veto(struct tb *tb, const struct icm_pkg_header *hdr)

static bool icm_tgl_is_supported(struct tb *tb)
{
	unsigned long end = jiffies + msecs_to_jiffies(10);

	do {
		u32 val;

	/*
	 * If the firmware is not running use software CM. This platform
	 * should fully support both.
	 */
		val = ioread32(tb->nhi->iobase + REG_FW_STS);
	return !!(val & REG_FW_STS_NVM_AUTH_DONE);
		if (val & REG_FW_STS_NVM_AUTH_DONE)
			return true;
		usleep_range(100, 500);
	} while (time_before(jiffies, end));

	return false;
}

static void icm_handle_notification(struct work_struct *work)