aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-11-25 09:34:47 -0500
committerDavid Vrabel <david.vrabel@csr.com>2008-11-25 09:34:47 -0500
commit5a4e1a795d7c5b47e94067a72db09f8cfb52bcff (patch)
tree71fe74f4b652d346ffc1651b0a36015abed36541 /drivers/uwb
parent56968d0c1a920eb165c06318f5c458724e1df0af (diff)
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>
Diffstat (limited to 'drivers/uwb')
-rw-r--r--drivers/uwb/whc-rc.c36
-rw-r--r--drivers/uwb/whci.c4
2 files changed, 8 insertions, 32 deletions
diff --git a/drivers/uwb/whc-rc.c b/drivers/uwb/whc-rc.c
index e0d66938ccd8..5f00386e26c7 100644
--- a/drivers/uwb/whc-rc.c
+++ b/drivers/uwb/whc-rc.c
@@ -332,47 +332,23 @@ void whcrc_release_rc_umc(struct whcrc *whcrc)
332static int whcrc_start_rc(struct uwb_rc *rc) 332static int whcrc_start_rc(struct uwb_rc *rc)
333{ 333{
334 struct whcrc *whcrc = rc->priv; 334 struct whcrc *whcrc = rc->priv;
335 int result = 0;
336 struct device *dev = &whcrc->umc_dev->dev; 335 struct device *dev = &whcrc->umc_dev->dev;
337 unsigned long start, duration;
338 336
339 /* Reset the thing */ 337 /* Reset the thing */
340 le_writel(URCCMD_RESET, whcrc->rc_base + URCCMD); 338 le_writel(URCCMD_RESET, whcrc->rc_base + URCCMD);
341 if (d_test(3))
342 start = jiffies;
343 if (whci_wait_for(dev, whcrc->rc_base + URCCMD, URCCMD_RESET, 0, 339 if (whci_wait_for(dev, whcrc->rc_base + URCCMD, URCCMD_RESET, 0,
344 5000, "device to reset at init") < 0) { 340 5000, "hardware reset") < 0)
345 result = -EBUSY; 341 return -EBUSY;
346 goto error;
347 } else if (d_test(3)) {
348 duration = jiffies - start;
349 if (duration > msecs_to_jiffies(40))
350 dev_err(dev, "Device took %ums to "
351 "reset. MAX expected: 40ms\n",
352 jiffies_to_msecs(duration));
353 }
354 342
355 /* Set the event buffer, start the controller (enable IRQs later) */ 343 /* Set the event buffer, start the controller (enable IRQs later) */
356 le_writel(0, whcrc->rc_base + URCINTR); 344 le_writel(0, whcrc->rc_base + URCINTR);
357 le_writel(URCCMD_RS, whcrc->rc_base + URCCMD); 345 le_writel(URCCMD_RS, whcrc->rc_base + URCCMD);
358 result = -ETIMEDOUT;
359 if (d_test(3))
360 start = jiffies;
361 if (whci_wait_for(dev, whcrc->rc_base + URCSTS, URCSTS_HALTED, 0, 346 if (whci_wait_for(dev, whcrc->rc_base + URCSTS, URCSTS_HALTED, 0,
362 5000, "device to start") < 0) 347 5000, "radio controller start") < 0)
363 goto error; 348 return -ETIMEDOUT;
364 if (d_test(3)) {
365 duration = jiffies - start;
366 if (duration > msecs_to_jiffies(40))
367 dev_err(dev, "Device took %ums to start. "
368 "MAX expected: 40ms\n",
369 jiffies_to_msecs(duration));
370 }
371 whcrc_enable_events(whcrc); 349 whcrc_enable_events(whcrc);
372 result = 0;
373 le_writel(URCINTR_EN_ALL, whcrc->rc_base + URCINTR); 350 le_writel(URCINTR_EN_ALL, whcrc->rc_base + URCINTR);
374error: 351 return 0;
375 return result;
376} 352}
377 353
378 354
@@ -394,7 +370,7 @@ void whcrc_stop_rc(struct uwb_rc *rc)
394 370
395 le_writel(0, whcrc->rc_base + URCCMD); 371 le_writel(0, whcrc->rc_base + URCCMD);
396 whci_wait_for(&umc_dev->dev, whcrc->rc_base + URCSTS, 372 whci_wait_for(&umc_dev->dev, whcrc->rc_base + URCSTS,
397 URCSTS_HALTED, URCSTS_HALTED, 100, "URCSTS.HALTED"); 373 URCSTS_HALTED, URCSTS_HALTED, 100, "radio controller stop");
398} 374}
399 375
400static void whcrc_init(struct whcrc *whcrc) 376static void whcrc_init(struct whcrc *whcrc)
diff --git a/drivers/uwb/whci.c b/drivers/uwb/whci.c
index e626467f95e3..1f8964ed9882 100644
--- a/drivers/uwb/whci.c
+++ b/drivers/uwb/whci.c
@@ -67,11 +67,11 @@ int whci_wait_for(struct device *dev, u32 __iomem *reg, u32 mask, u32 result,
67 val = le_readl(reg); 67 val = le_readl(reg);
68 if ((val & mask) == result) 68 if ((val & mask) == result)
69 break; 69 break;
70 msleep(10);
71 if (t >= max_ms) { 70 if (t >= max_ms) {
72 dev_err(dev, "timed out waiting for %s ", tag); 71 dev_err(dev, "%s timed out\n", tag);
73 return -ETIMEDOUT; 72 return -ETIMEDOUT;
74 } 73 }
74 msleep(10);
75 t += 10; 75 t += 10;
76 } 76 }
77 return 0; 77 return 0;