aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/time.c42
-rw-r--r--include/asm-powerpc/time.h6
2 files changed, 47 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 7a3c3f791ade..b4ed362c457a 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -1048,6 +1048,48 @@ void __init time_init(void)
1048 set_dec(tb_ticks_per_jiffy); 1048 set_dec(tb_ticks_per_jiffy);
1049} 1049}
1050 1050
1051#ifdef CONFIG_RTC_CLASS
1052static int set_rtc_class_time(struct rtc_time *tm)
1053{
1054 int err;
1055 struct class_device *class_dev =
1056 rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
1057
1058 if (class_dev == NULL)
1059 return -ENODEV;
1060
1061 err = rtc_set_time(class_dev, tm);
1062
1063 rtc_class_close(class_dev);
1064
1065 return 0;
1066}
1067
1068static void get_rtc_class_time(struct rtc_time *tm)
1069{
1070 int err;
1071 struct class_device *class_dev =
1072 rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
1073
1074 if (class_dev == NULL)
1075 return;
1076
1077 err = rtc_read_time(class_dev, tm);
1078
1079 rtc_class_close(class_dev);
1080
1081 return;
1082}
1083
1084int __init rtc_class_hookup(void)
1085{
1086 ppc_md.get_rtc_time = get_rtc_class_time;
1087 ppc_md.set_rtc_time = set_rtc_class_time;
1088
1089 return 0;
1090}
1091#endif /* CONFIG_RTC_CLASS */
1092
1051 1093
1052#define FEBRUARY 2 1094#define FEBRUARY 2
1053#define STARTOFTIME 1970 1095#define STARTOFTIME 1970
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h
index 5785ac4737b5..b051d4c88c3b 100644
--- a/include/asm-powerpc/time.h
+++ b/include/asm-powerpc/time.h
@@ -39,6 +39,10 @@ extern void generic_calibrate_decr(void);
39extern void wakeup_decrementer(void); 39extern void wakeup_decrementer(void);
40extern void snapshot_timebase(void); 40extern void snapshot_timebase(void);
41 41
42#ifdef CONFIG_RTC_CLASS
43extern int __init rtc_class_hookup(void);
44#endif
45
42/* Some sane defaults: 125 MHz timebase, 1GHz processor */ 46/* Some sane defaults: 125 MHz timebase, 1GHz processor */
43extern unsigned long ppc_proc_freq; 47extern unsigned long ppc_proc_freq;
44#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) 48#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
@@ -234,4 +238,4 @@ extern void snapshot_timebases(void);
234#endif 238#endif
235 239
236#endif /* __KERNEL__ */ 240#endif /* __KERNEL__ */
237#endif /* __PPC64_TIME_H */ 241#endif /* __POWERPC_TIME_H */