Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d7b98e3dd87b4512462f6cdfe646a8e59673e62e
Commit:     d7b98e3dd87b4512462f6cdfe646a8e59673e62e
Parent:     418ef2094eb8b0916d6cbda10e2ab857b9f64d97
Author:     Geoff Levand <[EMAIL PROTECTED]>
AuthorDate: Sun Oct 7 07:35:46 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Tue Oct 9 21:01:58 2007 +1000

    [POWERPC] PS3: Add os-area rtc_diff set/get routines
    
    Updates for PS3 os-area rtc_diff set/get routines
    o Add a new routine ps3_os_area_set_rtc_diff().
    o Rename ps3_os_area_rtc_diff() to ps3_os_area_get_rtc_diff().
    o Remove static variable rtc_shift with calls to ps3_os_area_get_rtc_diff().
    
    Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/os-area.c  |   19 +++++++++++++++++--
 arch/powerpc/platforms/ps3/platform.h |    3 ++-
 arch/powerpc/platforms/ps3/time.c     |   14 +++-----------
 3 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/os-area.c 
b/arch/powerpc/platforms/ps3/os-area.c
index db311a1..473aee8 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -261,16 +261,31 @@ void __init ps3_os_area_save_params(void)
 }
 
 /**
- * ps3_os_area_rtc_diff - Returns the rtc diff value.
+ * ps3_os_area_get_rtc_diff - Returns the rtc diff value.
  */
 
-u64 ps3_os_area_rtc_diff(void)
+u64 ps3_os_area_get_rtc_diff(void)
 {
        return saved_params.rtc_diff ? saved_params.rtc_diff
                : SECONDS_FROM_1970_TO_2000;
 }
 
 /**
+ * ps3_os_area_set_rtc_diff - Set the rtc diff value.
+ *
+ * An asynchronous write is needed to support writing updates from
+ * the timer interrupt context.
+ */
+
+void ps3_os_area_set_rtc_diff(u64 rtc_diff)
+{
+       if (saved_params.rtc_diff != rtc_diff) {
+               saved_params.rtc_diff = rtc_diff;
+               os_area_queue_work();
+       }
+}
+
+/**
  * ps3_os_area_get_av_multi_out - Returns the default video mode.
  */
 
diff --git a/arch/powerpc/platforms/ps3/platform.h 
b/arch/powerpc/platforms/ps3/platform.h
index 9109c31..6b4f4dd 100644
--- a/arch/powerpc/platforms/ps3/platform.h
+++ b/arch/powerpc/platforms/ps3/platform.h
@@ -63,7 +63,8 @@ int ps3_set_rtc_time(struct rtc_time *time);
 /* os area */
 
 void __init ps3_os_area_save_params(void);
-u64 ps3_os_area_rtc_diff(void);
+u64 ps3_os_area_get_rtc_diff(void);
+void ps3_os_area_set_rtc_diff(u64 rtc_diff);
 
 /* spu */
 
diff --git a/arch/powerpc/platforms/ps3/time.c 
b/arch/powerpc/platforms/ps3/time.c
index 802a9cc..d0daf7d 100644
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -50,12 +50,6 @@ static void __maybe_unused _dump_time(int time, const char 
*func,
        _dump_tm(&tm, func, line);
 }
 
-/**
- * rtc_shift - Difference in seconds between 1970 and the ps3 rtc value.
- */
-
-static s64 rtc_shift;
-
 void __init ps3_calibrate_decr(void)
 {
        int result;
@@ -66,8 +60,6 @@ void __init ps3_calibrate_decr(void)
 
        ppc_tb_freq = tmp;
        ppc_proc_freq = ppc_tb_freq * 40;
-
-       rtc_shift = ps3_os_area_rtc_diff();
 }
 
 static u64 read_rtc(void)
@@ -87,18 +79,18 @@ int ps3_set_rtc_time(struct rtc_time *tm)
        u64 now = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
                tm->tm_hour, tm->tm_min, tm->tm_sec);
 
-       rtc_shift = now - read_rtc();
+       ps3_os_area_set_rtc_diff(now - read_rtc());
        return 0;
 }
 
 void ps3_get_rtc_time(struct rtc_time *tm)
 {
-       to_tm(read_rtc() + rtc_shift, tm);
+       to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm);
        tm->tm_year -= 1900;
        tm->tm_mon -= 1;
 }
 
 unsigned long __init ps3_get_boot_time(void)
 {
-       return read_rtc() + rtc_shift;
+       return read_rtc() + ps3_os_area_get_rtc_diff();
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to