mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Weiner <jw@emlix.com>
To: Chris Zankel <chris@zankel.net>
Cc: linux-kernel@vger.kernel.org, Johannes Weiner <hannes@cmpxchg.org>
Subject: [patch 2/3] xtensa: remove platform rtc hooks
Date: Tue, 03 Mar 2009 16:30:45 +0100	[thread overview]
Message-ID: <E1LeXIx-00071s-Tp@mailer.emlix.com> (raw)
In-Reply-To: <E1LeXCe-0006wA-5k@mailer.emlix.com>

[-- Attachment #1: xtensa-remove-platform-rtc.patch --]
[-- Type: text/plain, Size: 3480 bytes --]

From: Johannes Weiner <hannes@cmpxchg.org>

platform_get/set_rtc_time() is not implemented by any of the supported
xtensa platforms.  Remove the facility completely.

The initial seconds for xtime come from read_persistent_clock() which
returns just 0 in the generic implementation.  Platforms that sport a
persistent clock can implement this function.

This is needed to implement the ccount register as a clock source.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
 arch/xtensa/include/asm/platform.h |   11 -----------
 arch/xtensa/kernel/platform.c      |    2 --
 arch/xtensa/kernel/time.c          |   29 +----------------------------
 3 files changed, 1 insertion(+), 41 deletions(-)

--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -14,7 +14,6 @@
 
 #include <linux/errno.h>
 #include <linux/time.h>
-#include <linux/timex.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/init.h>
@@ -25,18 +24,11 @@
 #include <asm/timex.h>
 #include <asm/platform.h>
 
-
-DEFINE_SPINLOCK(rtc_lock);
-EXPORT_SYMBOL(rtc_lock);
-
-
 #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
 unsigned long ccount_per_jiffy;		/* per 1/HZ */
 unsigned long nsec_per_ccount;		/* nsec per ccount increment */
 #endif
 
-static long last_rtc_update = 0;
-
 static irqreturn_t timer_interrupt(int irq, void *dev_id);
 static struct irqaction timer_irqaction = {
 	.handler =	timer_interrupt,
@@ -46,8 +38,6 @@ static struct irqaction timer_irqaction 
 
 void __init time_init(void)
 {
-	time_t sec_o, sec_n = 0;
-
 	/* The platform must provide a function to calibrate the processor
 	 * speed for the CALIBRATE.
 	 */
@@ -59,15 +49,8 @@ void __init time_init(void)
 			(int)(ccount_per_jiffy/(10000/HZ))%100);
 #endif
 
-	/* Set time from RTC (if provided) */
-
-	if (platform_get_rtc_time(&sec_o) == 0)
-		while (platform_get_rtc_time(&sec_n))
-			if (sec_o != sec_n)
-				break;
-
 	xtime.tv_nsec = 0;
-	last_rtc_update = xtime.tv_sec = sec_n;
+	xtime.tv_sec = read_persistent_clock();
 
 	set_normalized_timespec(&wall_to_monotonic,
 		-xtime.tv_sec, -xtime.tv_nsec);
@@ -169,16 +152,6 @@ again:
 		next += CCOUNT_PER_JIFFY;
 		set_linux_timer(next);
 
-		if (ntp_synced() &&
-		    xtime.tv_sec - last_rtc_update >= 659 &&
-		    abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ) {
-
-			if (platform_set_rtc_time(xtime.tv_sec+1) == 0)
-				last_rtc_update = xtime.tv_sec+1;
-			else
-				/* Do it again in 60 s */
-				last_rtc_update += 60;
-		}
 		write_sequnlock(&xtime_lock);
 	}
 
--- a/arch/xtensa/include/asm/platform.h
+++ b/arch/xtensa/include/asm/platform.h
@@ -74,16 +74,5 @@ extern int platform_pcibios_fixup (void)
  */
 extern void platform_calibrate_ccount (void);
 
-/*
- * platform_get_rtc_time returns RTC seconds (returns 0 for no error)
- */
-extern int platform_get_rtc_time(time_t*);
-
-/*
- * platform_set_rtc_time set RTC seconds (returns 0 for no error)
- */
-extern int platform_set_rtc_time(time_t);
-
-
 #endif	/* _XTENSA_PLATFORM_H */
 
--- a/arch/xtensa/kernel/platform.c
+++ b/arch/xtensa/kernel/platform.c
@@ -36,8 +36,6 @@ _F(void, power_off, (void), { while(1); 
 _F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); });
 _F(void, heartbeat, (void), { });
 _F(int,  pcibios_fixup, (void), { return 0; });
-_F(int, get_rtc_time, (time_t* t), { return 0; });
-_F(int, set_rtc_time, (time_t t), { return 0; });
 
 #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
 _F(void, calibrate_ccount, (void),

-- 


  parent reply	other threads:[~2009-03-03 16:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03 15:30 [patch 0/3] xtensa generic time Johannes Weiner
2009-03-03 15:30 ` [patch 1/3] xtensa: use generic sched_clock() Johannes Weiner
2009-03-03 15:30 ` Johannes Weiner [this message]
2009-03-03 15:30 ` [patch 3/3] xtensa: ccount clocksource Johannes Weiner
2009-03-03 17:55   ` Daniel Walker
2009-03-03 19:54     ` Johannes Weiner
2009-03-03 21:36       ` Daniel Walker
2009-03-04 20:26         ` Johannes Weiner

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=E1LeXIx-00071s-Tp@mailer.emlix.com \
    --to=jw@emlix.com \
    --cc=chris@zankel.net \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®