]> Git Repo - linux.git/commitdiff
rtc: omap: silence bogus power-up reset message at probe
authorJohan Hovold <[email protected]>
Wed, 10 Dec 2014 23:53:04 +0000 (15:53 -0800)
committerLinus Torvalds <[email protected]>
Thu, 11 Dec 2014 01:41:14 +0000 (17:41 -0800)
Some legacy RTC IP revisions has a power-up reset flag in the status
register that later revisions lack.

As this flag is always read back as set on later revisions (or is
overloaded with a different flag), make sure to only clear the flag and
print the info message on legacy platforms.

Signed-off-by: Johan Hovold <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Tony Lindgren <[email protected]>
Cc: Benot Cousson <[email protected]>
Cc: Lokesh Vutla <[email protected]>
Cc: Guenter Roeck <[email protected]>
Cc: Sekhar Nori <[email protected]>
Cc: Tero Kristo <[email protected]>
Cc: Keerthy J <[email protected]>
Tested-by: Felipe Balbi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/rtc/rtc-omap.c

index 1abd88e24c22c51d75710fddbd7d675bf1a96e83..ee20f2d36065f572f84b264309b7a74c4bd4a79a 100644 (file)
@@ -106,6 +106,7 @@ struct omap_rtc_device_type {
        bool has_32kclk_en;
        bool has_kicker;
        bool has_irqwakeen;
+       bool has_power_up_reset;
 };
 
 struct omap_rtc {
@@ -346,6 +347,7 @@ static struct rtc_class_ops omap_rtc_ops = {
 };
 
 static const struct omap_rtc_device_type omap_rtc_default_type = {
+       .has_power_up_reset = true,
 };
 
 static const struct omap_rtc_device_type omap_rtc_am3352_type = {
@@ -391,7 +393,7 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
 {
        struct omap_rtc         *rtc;
        struct resource         *res;
-       u8                      reg, new_ctrl;
+       u8                      reg, mask, new_ctrl;
        const struct platform_device_id *id_entry;
        const struct of_device_id *of_id;
        int ret;
@@ -448,12 +450,17 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
 
        /* clear old status */
        reg = rtc_read(rtc, OMAP_RTC_STATUS_REG);
-       if (reg & (u8) OMAP_RTC_STATUS_POWER_UP) {
-               dev_info(&pdev->dev, "RTC power up reset detected\n");
-               rtc_write(rtc, OMAP_RTC_STATUS_REG, OMAP_RTC_STATUS_POWER_UP);
+
+       mask = OMAP_RTC_STATUS_ALARM;
+
+       if (rtc->type->has_power_up_reset) {
+               mask |= OMAP_RTC_STATUS_POWER_UP;
+               if (reg & OMAP_RTC_STATUS_POWER_UP)
+                       dev_info(&pdev->dev, "RTC power up reset detected\n");
        }
-       if (reg & (u8) OMAP_RTC_STATUS_ALARM)
-               rtc_write(rtc, OMAP_RTC_STATUS_REG, OMAP_RTC_STATUS_ALARM);
+
+       if (reg & mask)
+               rtc_write(rtc, OMAP_RTC_STATUS_REG, reg & mask);
 
        /* On boards with split power, RTC_ON_NOFF won't reset the RTC */
        reg = rtc_read(rtc, OMAP_RTC_CTRL_REG);
This page took 0.059161 seconds and 4 git commands to generate.