Skip to content

Commit 4476c96

Browse files
hnazczankel
authored andcommitted
xtensa: remove platform rtc hooks
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 as a clock source. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Chris Zankel <chris@zankel.net>
1 parent 90be8c1 commit 4476c96

3 files changed

Lines changed: 1 addition & 41 deletions

File tree

‎arch/xtensa/include/asm/platform.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,5 @@ extern int platform_pcibios_fixup (void);
7474
*/
7575
extern void platform_calibrate_ccount (void);
7676

77-
/*
78-
* platform_get_rtc_time returns RTC seconds (returns 0 for no error)
79-
*/
80-
extern int platform_get_rtc_time(time_t*);
81-
82-
/*
83-
* platform_set_rtc_time set RTC seconds (returns 0 for no error)
84-
*/
85-
extern int platform_set_rtc_time(time_t);
86-
87-
8877
#endif /* _XTENSA_PLATFORM_H */
8978

‎arch/xtensa/kernel/platform.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ _F(void, power_off, (void), { while(1); });
3636
_F(void, idle, (void), { __asm__ __volatile__ ("waiti 0" ::: "memory"); });
3737
_F(void, heartbeat, (void), { });
3838
_F(int, pcibios_fixup, (void), { return 0; });
39-
_F(int, get_rtc_time, (time_t* t), { return 0; });
40-
_F(int, set_rtc_time, (time_t t), { return 0; });
4139

4240
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
4341
_F(void, calibrate_ccount, (void),

‎arch/xtensa/kernel/time.c‎

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#include <linux/errno.h>
1616
#include <linux/time.h>
17-
#include <linux/timex.h>
1817
#include <linux/interrupt.h>
1918
#include <linux/module.h>
2019
#include <linux/init.h>
@@ -25,18 +24,11 @@
2524
#include <asm/timex.h>
2625
#include <asm/platform.h>
2726

28-
29-
DEFINE_SPINLOCK(rtc_lock);
30-
EXPORT_SYMBOL(rtc_lock);
31-
32-
3327
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
3428
unsigned long ccount_per_jiffy; /* per 1/HZ */
3529
unsigned long nsec_per_ccount; /* nsec per ccount increment */
3630
#endif
3731

38-
static long last_rtc_update = 0;
39-
4032
static irqreturn_t timer_interrupt(int irq, void *dev_id);
4133
static struct irqaction timer_irqaction = {
4234
.handler = timer_interrupt,
@@ -46,8 +38,6 @@ static struct irqaction timer_irqaction = {
4638

4739
void __init time_init(void)
4840
{
49-
time_t sec_o, sec_n = 0;
50-
5141
/* The platform must provide a function to calibrate the processor
5242
* speed for the CALIBRATE.
5343
*/
@@ -59,15 +49,8 @@ void __init time_init(void)
5949
(int)(ccount_per_jiffy/(10000/HZ))%100);
6050
#endif
6151

62-
/* Set time from RTC (if provided) */
63-
64-
if (platform_get_rtc_time(&sec_o) == 0)
65-
while (platform_get_rtc_time(&sec_n))
66-
if (sec_o != sec_n)
67-
break;
68-
6952
xtime.tv_nsec = 0;
70-
last_rtc_update = xtime.tv_sec = sec_n;
53+
xtime.tv_sec = read_persistent_clock();
7154

7255
set_normalized_timespec(&wall_to_monotonic,
7356
-xtime.tv_sec, -xtime.tv_nsec);
@@ -169,16 +152,6 @@ irqreturn_t timer_interrupt (int irq, void *dev_id)
169152
next += CCOUNT_PER_JIFFY;
170153
set_linux_timer(next);
171154

172-
if (ntp_synced() &&
173-
xtime.tv_sec - last_rtc_update >= 659 &&
174-
abs((xtime.tv_nsec/1000)-(1000000-1000000/HZ))<5000000/HZ) {
175-
176-
if (platform_set_rtc_time(xtime.tv_sec+1) == 0)
177-
last_rtc_update = xtime.tv_sec+1;
178-
else
179-
/* Do it again in 60 s */
180-
last_rtc_update += 60;
181-
}
182155
write_sequnlock(&xtime_lock);
183156
}
184157

0 commit comments

Comments
 (0)