All of lore.kernel.org
 help / color / mirror / Atom feed
From: geoffrey.levand@am.sony.com
To: paulus@samba.org
Cc: linuxppc-dev@ozlabs.org
Subject: [patch 4/6] PS3: Add os-area rtc_diff set/get routines
Date: Sat, 06 Oct 2007 14:35:46 -0700	[thread overview]
Message-ID: <20071006213542.768463626@am.sony.com> (raw)
In-Reply-To: 20071006213542.311447584@am.sony.com

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 <geoffrey.levand@am.sony.com>
---
 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(-)

--- 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.
  */
 
--- 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 *ti
 /* 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 */
 
--- a/arch/powerpc/platforms/ps3/time.c
+++ b/arch/powerpc/platforms/ps3/time.c
@@ -50,12 +50,6 @@ static void __maybe_unused _dump_time(in
 	_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();
 }

-- 

  parent reply	other threads:[~2007-10-06 21:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-06 21:35 [patch 0/6] PS3 os area patches for 2.6.24 geoffrey.levand
2007-10-06 21:35 ` [patch 1/6] PS3: Cleanup of os-area.c geoffrey.levand
2007-10-06 21:35 ` [patch 2/6] PS3: Remove unused os-area params geoffrey.levand
2007-10-08 14:00   ` Ranulf Doswell
2007-10-08 17:53     ` Geoff Levand
2007-10-08 22:38       ` Ranulf Doswell
2007-10-08 22:50         ` Geoff Levand
2007-10-06 21:35 ` [patch 3/6] PS3: os-area workqueue processing geoffrey.levand
2007-10-06 21:35 ` geoffrey.levand [this message]
2007-10-06 21:35 ` [patch 5/6] PS3: Save os-area params to device tree geoffrey.levand
2007-10-06 21:35 ` [patch 6/6] PS3: Add os-area database routines geoffrey.levand
2007-10-08  8:27   ` Geert Uytterhoeven
2007-10-09  1:08     ` Geoff Levand
2007-10-08 12:16   ` Geert Uytterhoeven
2007-10-09  1:12     ` Geoff Levand
2007-10-08 13:48   ` Ranulf Doswell
2007-10-08 17:52     ` Geoff Levand
2007-10-08 22:59       ` Ranulf Doswell
2007-10-08 23:36         ` Geoff Levand
2007-10-09  9:35         ` Geert Uytterhoeven
2007-10-09 12:23           ` Ranulf Doswell
2007-10-09  1:07   ` [patch v2] " Geoff Levand
2007-10-09 11:38     ` Geert Uytterhoeven
2007-10-09 17:15     ` Linas Vepstas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071006213542.768463626@am.sony.com \
    --to=geoffrey.levand@am.sony.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.