uwb: clean up whci_wait_for() timeout error message
All callers of whci_wait_for() should get consistant error message if a timeout occurs. Signed-off-by: David Vrabel <david.vrabel@csr.com>
This commit is contained in:
Родитель
56968d0c1a
Коммит
5a4e1a795d
|
@ -332,47 +332,23 @@ void whcrc_release_rc_umc(struct whcrc *whcrc)
|
||||||
static int whcrc_start_rc(struct uwb_rc *rc)
|
static int whcrc_start_rc(struct uwb_rc *rc)
|
||||||
{
|
{
|
||||||
struct whcrc *whcrc = rc->priv;
|
struct whcrc *whcrc = rc->priv;
|
||||||
int result = 0;
|
|
||||||
struct device *dev = &whcrc->umc_dev->dev;
|
struct device *dev = &whcrc->umc_dev->dev;
|
||||||
unsigned long start, duration;
|
|
||||||
|
|
||||||
/* Reset the thing */
|
/* Reset the thing */
|
||||||
le_writel(URCCMD_RESET, whcrc->rc_base + URCCMD);
|
le_writel(URCCMD_RESET, whcrc->rc_base + URCCMD);
|
||||||
if (d_test(3))
|
|
||||||
start = jiffies;
|
|
||||||
if (whci_wait_for(dev, whcrc->rc_base + URCCMD, URCCMD_RESET, 0,
|
if (whci_wait_for(dev, whcrc->rc_base + URCCMD, URCCMD_RESET, 0,
|
||||||
5000, "device to reset at init") < 0) {
|
5000, "hardware reset") < 0)
|
||||||
result = -EBUSY;
|
return -EBUSY;
|
||||||
goto error;
|
|
||||||
} else if (d_test(3)) {
|
|
||||||
duration = jiffies - start;
|
|
||||||
if (duration > msecs_to_jiffies(40))
|
|
||||||
dev_err(dev, "Device took %ums to "
|
|
||||||
"reset. MAX expected: 40ms\n",
|
|
||||||
jiffies_to_msecs(duration));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the event buffer, start the controller (enable IRQs later) */
|
/* Set the event buffer, start the controller (enable IRQs later) */
|
||||||
le_writel(0, whcrc->rc_base + URCINTR);
|
le_writel(0, whcrc->rc_base + URCINTR);
|
||||||
le_writel(URCCMD_RS, whcrc->rc_base + URCCMD);
|
le_writel(URCCMD_RS, whcrc->rc_base + URCCMD);
|
||||||
result = -ETIMEDOUT;
|
|
||||||
if (d_test(3))
|
|
||||||
start = jiffies;
|
|
||||||
if (whci_wait_for(dev, whcrc->rc_base + URCSTS, URCSTS_HALTED, 0,
|
if (whci_wait_for(dev, whcrc->rc_base + URCSTS, URCSTS_HALTED, 0,
|
||||||
5000, "device to start") < 0)
|
5000, "radio controller start") < 0)
|
||||||
goto error;
|
return -ETIMEDOUT;
|
||||||
if (d_test(3)) {
|
|
||||||
duration = jiffies - start;
|
|
||||||
if (duration > msecs_to_jiffies(40))
|
|
||||||
dev_err(dev, "Device took %ums to start. "
|
|
||||||
"MAX expected: 40ms\n",
|
|
||||||
jiffies_to_msecs(duration));
|
|
||||||
}
|
|
||||||
whcrc_enable_events(whcrc);
|
whcrc_enable_events(whcrc);
|
||||||
result = 0;
|
|
||||||
le_writel(URCINTR_EN_ALL, whcrc->rc_base + URCINTR);
|
le_writel(URCINTR_EN_ALL, whcrc->rc_base + URCINTR);
|
||||||
error:
|
return 0;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,7 +370,7 @@ void whcrc_stop_rc(struct uwb_rc *rc)
|
||||||
|
|
||||||
le_writel(0, whcrc->rc_base + URCCMD);
|
le_writel(0, whcrc->rc_base + URCCMD);
|
||||||
whci_wait_for(&umc_dev->dev, whcrc->rc_base + URCSTS,
|
whci_wait_for(&umc_dev->dev, whcrc->rc_base + URCSTS,
|
||||||
URCSTS_HALTED, URCSTS_HALTED, 100, "URCSTS.HALTED");
|
URCSTS_HALTED, URCSTS_HALTED, 100, "radio controller stop");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void whcrc_init(struct whcrc *whcrc)
|
static void whcrc_init(struct whcrc *whcrc)
|
||||||
|
|
|
@ -67,11 +67,11 @@ int whci_wait_for(struct device *dev, u32 __iomem *reg, u32 mask, u32 result,
|
||||||
val = le_readl(reg);
|
val = le_readl(reg);
|
||||||
if ((val & mask) == result)
|
if ((val & mask) == result)
|
||||||
break;
|
break;
|
||||||
msleep(10);
|
|
||||||
if (t >= max_ms) {
|
if (t >= max_ms) {
|
||||||
dev_err(dev, "timed out waiting for %s ", tag);
|
dev_err(dev, "%s timed out\n", tag);
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
msleep(10);
|
||||||
t += 10;
|
t += 10;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче