Commit 9d1d4f9e authored by Nicolas Pitre's avatar Nicolas Pitre

[ARM] Kirkwood: fail the probe if internal RTC does not work

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: default avatarMartin Michlmayr <tbm@cyrius.com>
Signed-off-by: default avatarNicolas Pitre <nico@marvell.com>
parent 0c1355e3
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/bcd.h> #include <linux/bcd.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/delay.h>
#define RTC_TIME_REG_OFFS 0 #define RTC_TIME_REG_OFFS 0
...@@ -119,6 +120,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev) ...@@ -119,6 +120,16 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
return -EINVAL; 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); platform_set_drvdata(pdev, pdata);
pdata->rtc = rtc_device_register(pdev->name, &pdev->dev, pdata->rtc = rtc_device_register(pdev->name, &pdev->dev,
&mv_rtc_ops, THIS_MODULE); &mv_rtc_ops, THIS_MODULE);
......
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