Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
a58c9f3c
Commit
a58c9f3c
authored
Feb 22, 2007
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC64]: Synchronize RTC clock via timer just like x86.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
de46c337
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
18 deletions
+48
-18
arch/sparc64/kernel/time.c
arch/sparc64/kernel/time.c
+48
-18
No files found.
arch/sparc64/kernel/time.c
View file @
a58c9f3c
...
@@ -435,22 +435,56 @@ static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
...
@@ -435,22 +435,56 @@ static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
#define TICK_SIZE (tick_nsec / 1000)
#define TICK_SIZE (tick_nsec / 1000)
static
inline
void
timer_check_rtc
(
void
)
#define USEC_AFTER 500000
#define USEC_BEFORE 500000
static
void
sync_cmos_clock
(
unsigned
long
dummy
);
static
DEFINE_TIMER
(
sync_cmos_timer
,
sync_cmos_clock
,
0
,
0
);
static
void
sync_cmos_clock
(
unsigned
long
dummy
)
{
{
/* last time the cmos clock got updated */
struct
timeval
now
,
next
;
static
long
last_rtc_update
;
int
fail
=
1
;
/* Determine when to update the Mostek clock. */
/*
if
(
ntp_synced
()
&&
* If we have an externally synchronized Linux clock, then update
xtime
.
tv_sec
>
last_rtc_update
+
660
&&
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
(
xtime
.
tv_nsec
/
1000
)
>=
500000
-
((
unsigned
)
TICK_SIZE
)
/
2
&&
* called as close as possible to 500 ms before the new second starts.
(
xtime
.
tv_nsec
/
1000
)
<=
500000
+
((
unsigned
)
TICK_SIZE
)
/
2
)
{
* This code is run on a timer. If the clock is set, that timer
if
(
set_rtc_mmss
(
xtime
.
tv_sec
)
==
0
)
* may not expire at the correct time. Thus, we adjust...
last_rtc_update
=
xtime
.
tv_sec
;
*/
if
(
!
ntp_synced
())
/*
* Not synced, exit, do not restart a timer (if one is
* running, let it run out).
*/
return
;
do_gettimeofday
(
&
now
);
if
(
now
.
tv_usec
>=
USEC_AFTER
-
((
unsigned
)
TICK_SIZE
)
/
2
&&
now
.
tv_usec
<=
USEC_BEFORE
+
((
unsigned
)
TICK_SIZE
)
/
2
)
fail
=
set_rtc_mmss
(
now
.
tv_sec
);
next
.
tv_usec
=
USEC_AFTER
-
now
.
tv_usec
;
if
(
next
.
tv_usec
<=
0
)
next
.
tv_usec
+=
USEC_PER_SEC
;
if
(
!
fail
)
next
.
tv_sec
=
659
;
else
else
last_rtc_update
=
xtime
.
tv_sec
-
600
;
next
.
tv_sec
=
0
;
/* do it again in 60 s */
if
(
next
.
tv_usec
>=
USEC_PER_SEC
)
{
next
.
tv_sec
++
;
next
.
tv_usec
-=
USEC_PER_SEC
;
}
}
mod_timer
(
&
sync_cmos_timer
,
jiffies
+
timeval_to_jiffies
(
&
next
));
}
void
notify_arch_cmos_timer
(
void
)
{
mod_timer
(
&
sync_cmos_timer
,
jiffies
+
1
);
}
}
irqreturn_t
timer_interrupt
(
int
irq
,
void
*
dev_id
)
irqreturn_t
timer_interrupt
(
int
irq
,
void
*
dev_id
)
...
@@ -483,8 +517,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
...
@@ -483,8 +517,6 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
:
"r"
(
pstate
));
:
"r"
(
pstate
));
}
while
(
time_after_eq
(
ticks
,
compare
));
}
while
(
time_after_eq
(
ticks
,
compare
));
timer_check_rtc
();
write_sequnlock
(
&
xtime_lock
);
write_sequnlock
(
&
xtime_lock
);
return
IRQ_HANDLED
;
return
IRQ_HANDLED
;
...
@@ -497,8 +529,6 @@ void timer_tick_interrupt(struct pt_regs *regs)
...
@@ -497,8 +529,6 @@ void timer_tick_interrupt(struct pt_regs *regs)
do_timer
(
1
);
do_timer
(
1
);
timer_check_rtc
();
write_sequnlock
(
&
xtime_lock
);
write_sequnlock
(
&
xtime_lock
);
}
}
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment