Commit e4be8c9b authored by Mika Westerberg's avatar Mika Westerberg

thunderbolt: Wait a bit longer for ICM to authenticate the active NVM

Sometimes during cold boot ICM has not yet authenticated the active NVM
image leading to timeout and failing the driver probe. Allow ICM to take
some more time and increase the timeout to 3 seconds before we give up.

While there fix icm_firmware_init() to return the real error code
without overwriting it with -ENODEV.

Fixes: f67cf491 ("thunderbolt: Add support for Internal Connection Manager (ICM)")
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable@vger.kernel.org
parent 44b51bbb
...@@ -736,14 +736,14 @@ static bool icm_ar_is_supported(struct tb *tb) ...@@ -736,14 +736,14 @@ static bool icm_ar_is_supported(struct tb *tb)
static int icm_ar_get_mode(struct tb *tb) static int icm_ar_get_mode(struct tb *tb)
{ {
struct tb_nhi *nhi = tb->nhi; struct tb_nhi *nhi = tb->nhi;
int retries = 5; int retries = 60;
u32 val; u32 val;
do { do {
val = ioread32(nhi->iobase + REG_FW_STS); val = ioread32(nhi->iobase + REG_FW_STS);
if (val & REG_FW_STS_NVM_AUTH_DONE) if (val & REG_FW_STS_NVM_AUTH_DONE)
break; break;
msleep(30); msleep(50);
} while (--retries); } while (--retries);
if (!retries) { if (!retries) {
...@@ -1063,6 +1063,9 @@ static int icm_firmware_init(struct tb *tb) ...@@ -1063,6 +1063,9 @@ static int icm_firmware_init(struct tb *tb)
break; break;
default: default:
if (ret < 0)
return ret;
tb_err(tb, "ICM firmware is in wrong mode: %u\n", ret); tb_err(tb, "ICM firmware is in wrong mode: %u\n", ret);
return -ENODEV; return -ENODEV;
} }
......
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