]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/powerpc/platforms/maple/time.c
[PATCH] powerpc: Fix Maple build
[linux-2.6-omap-h63xx.git] / arch / powerpc / platforms / maple / time.c
index 15846cc938acd4a87158a47b19ba547f5af062d5..50bc4eb853535bca3e78eae519dbf98367b7f294 100644 (file)
@@ -168,11 +168,24 @@ unsigned long __init maple_get_boot_time(void)
        struct rtc_time tm;
        struct device_node *rtcs;
 
-       rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
-       if (rtcs && rtcs->addrs) {
-               maple_rtc_addr = rtcs->addrs[0].address;
-               printk(KERN_INFO "Maple: Found RTC at 0x%x\n", maple_rtc_addr);
-       } else {
+       rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00");
+       if (rtcs) {
+               struct resource r;
+               if (of_address_to_resource(rtcs, 0, &r)) {
+                       printk(KERN_EMERG "Maple: Unable to translate RTC"
+                              " address\n");
+                       goto bail;
+               }
+               if (!(r.flags & IORESOURCE_IO)) {
+                       printk(KERN_EMERG "Maple: RTC address isn't PIO!\n");
+                       goto bail;
+               }
+               maple_rtc_addr = r.start;
+               printk(KERN_INFO "Maple: Found RTC at IO 0x%x\n",
+                      maple_rtc_addr);
+       }
+ bail:
+       if (maple_rtc_addr == 0) {
                maple_rtc_addr = RTC_PORT(0); /* legacy address */
                printk(KERN_INFO "Maple: No device node for RTC, assuming "
                       "legacy address (0x%x)\n", maple_rtc_addr);