diff options
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r-- | arch/powerpc/kernel/time.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 8b278d85ca4e..85b9244a098c 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -1041,6 +1041,48 @@ void __init time_init(void) | |||
1041 | set_dec(tb_ticks_per_jiffy); | 1041 | set_dec(tb_ticks_per_jiffy); |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | #ifdef CONFIG_RTC_CLASS | ||
1045 | static int set_rtc_class_time(struct rtc_time *tm) | ||
1046 | { | ||
1047 | int err; | ||
1048 | struct class_device *class_dev = | ||
1049 | rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | ||
1050 | |||
1051 | if (class_dev == NULL) | ||
1052 | return -ENODEV; | ||
1053 | |||
1054 | err = rtc_set_time(class_dev, tm); | ||
1055 | |||
1056 | rtc_class_close(class_dev); | ||
1057 | |||
1058 | return 0; | ||
1059 | } | ||
1060 | |||
1061 | static void get_rtc_class_time(struct rtc_time *tm) | ||
1062 | { | ||
1063 | int err; | ||
1064 | struct class_device *class_dev = | ||
1065 | rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | ||
1066 | |||
1067 | if (class_dev == NULL) | ||
1068 | return; | ||
1069 | |||
1070 | err = rtc_read_time(class_dev, tm); | ||
1071 | |||
1072 | rtc_class_close(class_dev); | ||
1073 | |||
1074 | return; | ||
1075 | } | ||
1076 | |||
1077 | int __init rtc_class_hookup(void) | ||
1078 | { | ||
1079 | ppc_md.get_rtc_time = get_rtc_class_time; | ||
1080 | ppc_md.set_rtc_time = set_rtc_class_time; | ||
1081 | |||
1082 | return 0; | ||
1083 | } | ||
1084 | #endif /* CONFIG_RTC_CLASS */ | ||
1085 | |||
1044 | 1086 | ||
1045 | #define FEBRUARY 2 | 1087 | #define FEBRUARY 2 |
1046 | #define STARTOFTIME 1970 | 1088 | #define STARTOFTIME 1970 |