summaryrefslogtreecommitdiff
path: root/arch/ppc64/kernel/rtc.c
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2002-12-17 10:35:28 +1100
committerAnton Blanchard <anton@samba.org>2002-12-17 10:35:28 +1100
commit8752fb78b3b96ff49f77c8675d1818ff33b181de (patch)
treeba608d036b90ef38907290eb1cf897d5b1594fbd /arch/ppc64/kernel/rtc.c
parentb1c22fd1a0cc8be4b216f48e3c944f2bc1f532cd (diff)
ppc64: wrap pSeries and iSeries specific code
Diffstat (limited to 'arch/ppc64/kernel/rtc.c')
-rw-r--r--arch/ppc64/kernel/rtc.c111
1 files changed, 57 insertions, 54 deletions
diff --git a/arch/ppc64/kernel/rtc.c b/arch/ppc64/kernel/rtc.c
index 5ace02abc1bc..72e65910a442 100644
--- a/arch/ppc64/kernel/rtc.c
+++ b/arch/ppc64/kernel/rtc.c
@@ -257,6 +257,7 @@ static int rtc_read_proc(char *page, char **start, off_t off,
return len;
}
+#ifdef CONFIG_PPC_ISERIES
/*
* Get the RTC from the virtual service processor
* This requires flowing LpEvents to the primary partition
@@ -270,60 +271,6 @@ void iSeries_get_rtc_time(struct rtc_time *rtc_tm)
rtc_tm->tm_mon--;
}
-
-void pSeries_get_rtc_time(struct rtc_time *rtc_tm)
-{
- unsigned long ret[8];
- int error;
- int count;
-
- /*
- * error -2 is clock busy, we keep retrying a few times to see
- * if it will come good -- paulus
- */
- count = 0;
- do {
- error = rtas_call(rtas_token("get-time-of-day"), 0, 8, (void *)&ret);
- } while (error == -2 && ++count < 1000);
-
- if (error != 0) {
- printk(KERN_WARNING "error: reading the clock failed (%d)\n",
- error);
- return;
- }
-
- rtc_tm->tm_sec = ret[5];
- rtc_tm->tm_min = ret[4];
- rtc_tm->tm_hour = ret[3];
- rtc_tm->tm_mday = ret[2];
- rtc_tm->tm_mon = ret[1] - 1;
- rtc_tm->tm_year = ret[0] - 1900;
-}
-
-int pSeries_set_rtc_time(struct rtc_time *tm)
-{
- int error;
- int count;
-
- /*
- * error -2 is clock busy, we keep retrying a few times to see
- * if it will come good -- paulus
- */
- count = 0;
- do {
- error = rtas_call(rtas_token("set-time-of-day"), 7, 1, NULL,
- tm->tm_year + 1900, tm->tm_mon + 1,
- tm->tm_mday, tm->tm_hour, tm->tm_min,
- tm->tm_sec, 0);
- } while (error == -2 && ++count < 1000);
-
- if (error != 0)
- printk(KERN_WARNING "error: setting the clock failed (%d)\n",
- error);
-
- return 0;
-}
-
/*
* Set the RTC in the virtual service processor
* This requires flowing LpEvents to the primary partition
@@ -379,3 +326,59 @@ void iSeries_get_boot_time(struct rtc_time *tm)
tm->tm_year -= 1900;
tm->tm_mon -= 1;
}
+#endif
+
+#ifdef CONFIG_PPC_PSERIES
+void pSeries_get_rtc_time(struct rtc_time *rtc_tm)
+{
+ unsigned long ret[8];
+ int error;
+ int count;
+
+ /*
+ * error -2 is clock busy, we keep retrying a few times to see
+ * if it will come good -- paulus
+ */
+ count = 0;
+ do {
+ error = rtas_call(rtas_token("get-time-of-day"), 0, 8, (void *)&ret);
+ } while (error == -2 && ++count < 1000);
+
+ if (error != 0) {
+ printk(KERN_WARNING "error: reading the clock failed (%d)\n",
+ error);
+ return;
+ }
+
+ rtc_tm->tm_sec = ret[5];
+ rtc_tm->tm_min = ret[4];
+ rtc_tm->tm_hour = ret[3];
+ rtc_tm->tm_mday = ret[2];
+ rtc_tm->tm_mon = ret[1] - 1;
+ rtc_tm->tm_year = ret[0] - 1900;
+}
+
+int pSeries_set_rtc_time(struct rtc_time *tm)
+{
+ int error;
+ int count;
+
+ /*
+ * error -2 is clock busy, we keep retrying a few times to see
+ * if it will come good -- paulus
+ */
+ count = 0;
+ do {
+ error = rtas_call(rtas_token("set-time-of-day"), 7, 1, NULL,
+ tm->tm_year + 1900, tm->tm_mon + 1,
+ tm->tm_mday, tm->tm_hour, tm->tm_min,
+ tm->tm_sec, 0);
+ } while (error == -2 && ++count < 1000);
+
+ if (error != 0)
+ printk(KERN_WARNING "error: setting the clock failed (%d)\n",
+ error);
+
+ return 0;
+}
+#endif