]> Zhao Yanbai Git Server - minix.git/commitdiff
arm:replace ifdef's by runtime checks in the omap rtc driver. 24/1424/1
authorKees Jongenburger <kees.jongenburger@gmail.com>
Mon, 10 Feb 2014 11:20:28 +0000 (12:20 +0100)
committerKees Jongenburger <kees.jongenburger@gmail.com>
Wed, 12 Feb 2014 12:47:47 +0000 (13:47 +0100)
Change-Id: I038f0fcf88061ae60d6d029d86c84153bf0f0020

drivers/readclock/arch/earm/omap_rtc.c

index dc9cad6829f2baf3150981090e867567a7a90c8e..8fb312275bb0180b7ed404437fb6648716f2f2f0 100644 (file)
@@ -4,6 +4,7 @@
 #include <minix/mmio.h>
 #include <minix/clkconf.h>
 #include <minix/sysutil.h>
+#include <minix/board.h>
 
 #include <sys/mman.h>
 #include <sys/types.h>
@@ -197,15 +198,18 @@ omap_rtc_init(void)
        int rtc_rev, major, minor;
        struct minix_mem_range mr;
 
-#ifndef AM335X
-       /* Only the am335x (BeagleBone & BeagleBone Black) is supported ATM.
-        * The dm37xx (BeagleBoard-xM) doesn't have a real time clock
-        * built-in. Instead, it uses the RTC on the PMIC. A driver for
-        * the BeagleBoard-xM's PMIC still needs to be developed.
-        */
-       log_warn(&log, "unsupported processor\n");
-       return ENOSYS;
-#endif /* !AM335X */
+       struct machine  machine ;
+       sys_getmachine(&machine);
+
+       if(! BOARD_IS_BB(machine.board_id)){
+               /* Only the am335x (BeagleBone & BeagleBone Black) is supported ATM.
+                * The dm37xx (BeagleBoard-xM) doesn't have a real time clock
+                * built-in. Instead, it uses the RTC on the PMIC. A driver for
+                * the BeagleBoard-xM's PMIC still needs to be developed.
+                */
+               log_warn(&log, "unsupported processor\n");
+               return ENOSYS;
+       }
 
        if (pwr_off_in_progress)
                return EINVAL;