Skip to content

Commit

Permalink
[ARM] Kirkwood: fail the probe if internal RTC does not work
Browse files Browse the repository at this point in the history
Having a RTC that doesn't maintain proper time across a reboot is one
thing.  But a RTC that doesn't work at all and only causes timeouts is
another.

Tested-by: Martin Michlmayr <tbm@cyrius.com>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
  • Loading branch information
Nicolas Pitre committed Mar 24, 2009
1 parent 0c1355e commit 9d1d4f9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/rtc/rtc-mv.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/bcd.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/delay.h>


#define RTC_TIME_REG_OFFS 0
Expand Down Expand Up @@ -119,6 +120,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
return -EINVAL;
}

/* make sure it is actually functional */
if (rtc_time == 0x01000000) {
ssleep(1);
rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS);
if (rtc_time == 0x01000000) {
dev_err(&pdev->dev, "internal RTC not ticking\n");
return -ENODEV;
}
}

platform_set_drvdata(pdev, pdata);
pdata->rtc = rtc_device_register(pdev->name, &pdev->dev,
&mv_rtc_ops, THIS_MODULE);
Expand Down

0 comments on commit 9d1d4f9

Please sign in to comment.