aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/platforms/iseries/mf.c78
-rw-r--r--include/asm-powerpc/iseries/mf.h4
2 files changed, 39 insertions, 43 deletions
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 18054e922bd1..d771b8ee857d 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -706,6 +706,43 @@ static void get_rtc_time_complete(void *token, struct ce_msg_data *ce_msg)
706 complete(&rtc->com); 706 complete(&rtc->com);
707} 707}
708 708
709static int mf_set_rtc(struct rtc_time *tm)
710{
711 char ce_time[12];
712 u8 day, mon, hour, min, sec, y1, y2;
713 unsigned year;
714
715 year = 1900 + tm->tm_year;
716 y1 = year / 100;
717 y2 = year % 100;
718
719 sec = tm->tm_sec;
720 min = tm->tm_min;
721 hour = tm->tm_hour;
722 day = tm->tm_mday;
723 mon = tm->tm_mon + 1;
724
725 BIN_TO_BCD(sec);
726 BIN_TO_BCD(min);
727 BIN_TO_BCD(hour);
728 BIN_TO_BCD(mon);
729 BIN_TO_BCD(day);
730 BIN_TO_BCD(y1);
731 BIN_TO_BCD(y2);
732
733 memset(ce_time, 0, sizeof(ce_time));
734 ce_time[3] = 0x41;
735 ce_time[4] = y1;
736 ce_time[5] = y2;
737 ce_time[6] = sec;
738 ce_time[7] = min;
739 ce_time[8] = hour;
740 ce_time[10] = day;
741 ce_time[11] = mon;
742
743 return signal_ce_msg(ce_time, NULL);
744}
745
709static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm) 746static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm)
710{ 747{
711 tm->tm_wday = 0; 748 tm->tm_wday = 0;
@@ -761,7 +798,7 @@ static int rtc_set_tm(int rc, u8 *ce_msg, struct rtc_time *tm)
761 return 0; 798 return 0;
762} 799}
763 800
764int mf_get_rtc(struct rtc_time *tm) 801static int mf_get_rtc(struct rtc_time *tm)
765{ 802{
766 struct ce_msg_comp_data ce_complete; 803 struct ce_msg_comp_data ce_complete;
767 struct rtc_time_data rtc_data; 804 struct rtc_time_data rtc_data;
@@ -794,7 +831,7 @@ static void get_boot_rtc_time_complete(void *token, struct ce_msg_data *ce_msg)
794 rtc->busy = 0; 831 rtc->busy = 0;
795} 832}
796 833
797int mf_get_boot_rtc(struct rtc_time *tm) 834static int mf_get_boot_rtc(struct rtc_time *tm)
798{ 835{
799 struct ce_msg_comp_data ce_complete; 836 struct ce_msg_comp_data ce_complete;
800 struct boot_rtc_time_data rtc_data; 837 struct boot_rtc_time_data rtc_data;
@@ -816,43 +853,6 @@ int mf_get_boot_rtc(struct rtc_time *tm)
816 return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm); 853 return rtc_set_tm(rtc_data.rc, rtc_data.ce_msg.ce_msg, tm);
817} 854}
818 855
819int mf_set_rtc(struct rtc_time *tm)
820{
821 char ce_time[12];
822 u8 day, mon, hour, min, sec, y1, y2;
823 unsigned year;
824
825 year = 1900 + tm->tm_year;
826 y1 = year / 100;
827 y2 = year % 100;
828
829 sec = tm->tm_sec;
830 min = tm->tm_min;
831 hour = tm->tm_hour;
832 day = tm->tm_mday;
833 mon = tm->tm_mon + 1;
834
835 BIN_TO_BCD(sec);
836 BIN_TO_BCD(min);
837 BIN_TO_BCD(hour);
838 BIN_TO_BCD(mon);
839 BIN_TO_BCD(day);
840 BIN_TO_BCD(y1);
841 BIN_TO_BCD(y2);
842
843 memset(ce_time, 0, sizeof(ce_time));
844 ce_time[3] = 0x41;
845 ce_time[4] = y1;
846 ce_time[5] = y2;
847 ce_time[6] = sec;
848 ce_time[7] = min;
849 ce_time[8] = hour;
850 ce_time[10] = day;
851 ce_time[11] = mon;
852
853 return signal_ce_msg(ce_time, NULL);
854}
855
856#ifdef CONFIG_PROC_FS 856#ifdef CONFIG_PROC_FS
857 857
858static int proc_mf_dump_cmdline(char *page, char **start, off_t off, 858static int proc_mf_dump_cmdline(char *page, char **start, off_t off,
diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h
index 89f3282df04d..eb851a9c9e5c 100644
--- a/include/asm-powerpc/iseries/mf.h
+++ b/include/asm-powerpc/iseries/mf.h
@@ -48,8 +48,4 @@ extern void mf_display_progress(u16 value);
48 48
49extern void mf_init(void); 49extern void mf_init(void);
50 50
51extern int mf_get_rtc(struct rtc_time *tm);
52extern int mf_get_boot_rtc(struct rtc_time *tm);
53extern int mf_set_rtc(struct rtc_time *tm);
54
55#endif /* _ASM_POWERPC_ISERIES_MF_H */ 51#endif /* _ASM_POWERPC_ISERIES_MF_H */