artik053: register RTC driver at boot
authorHeesub Shin <heesub.shin@samsung.com>
Mon, 3 Apr 2017 04:41:39 +0000 (13:41 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 18 Apr 2017 03:02:05 +0000 (12:02 +0900)
This commit registers the RTC device driver at boot, so that the RTC
device can be exported through /dev/rtc0. This allows users to open and
then use various operations with it on application space. This change
takes effects only when the upper-half RTC driver is enabled.

Change-Id: I7215251dafba93544485a58ef49d2aa7503c7fbf
Signed-off-by: Heesub Shin <heesub.shin@samsung.com>
os/arch/arm/src/artik053/src/artik053_tash.c

index b4bfa0b..5b5374f 100644 (file)
@@ -64,7 +64,9 @@
 #include <tinyara/fs/ioctl.h>
 #include <chip.h>
 
+#include "s5j_rtc.h"
 #include "up_internal.h"
+
 #include <apps/shell/tash.h>
 
 #include "artik053.h"
@@ -239,6 +241,21 @@ int board_app_initialize(void)
        }
 #endif
 
+#if defined(CONFIG_RTC_DRIVER)
+       {
+               struct rtc_lowerhalf_s *rtclower;
+
+               rtclower = s5j_rtc_lowerhalf();
+               if (rtclower) {
+                       ret = rtc_initialize(0, rtclower);
+                       if (ret < 0) {
+                               lldbg("Failed to register the RTC driver: %d\n",
+                                               ret);
+                       }
+               }
+       }
+#endif /* CONFIG_RTC_DRIVER */
+
        scsc_wpa_ctrl_iface_init();
 
 #ifdef CONFIG_TASH