From 9d1d4f9eabbca276a2a618a94ed3149d5971063e Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Mon, 23 Mar 2009 20:42:29 -0400 Subject: [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: Martin Michlmayr Signed-off-by: Nicolas Pitre --- drivers/rtc/rtc-mv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'drivers/rtc') diff --git a/drivers/rtc/rtc-mv.c b/drivers/rtc/rtc-mv.c index 45f12dcd371..e0263d2005e 100644 --- a/drivers/rtc/rtc-mv.c +++ b/drivers/rtc/rtc-mv.c @@ -12,6 +12,7 @@ #include #include #include +#include #define RTC_TIME_REG_OFFS 0 @@ -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); -- cgit v1.2.3-70-g09d2