Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
84d6bd5e
Commit
84d6bd5e
authored
Aug 29, 2008
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sparc64: Use generic sun4v RTC driver.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
7a138ede
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
75 deletions
+9
-75
arch/sparc64/Kconfig
arch/sparc64/Kconfig
+1
-0
arch/sparc64/kernel/time.c
arch/sparc64/kernel/time.c
+8
-75
No files found.
arch/sparc64/Kconfig
View file @
84d6bd5e
...
...
@@ -23,6 +23,7 @@ config SPARC64
select RTC_DRV_M48T59
select RTC_DRV_CMOS
select RTC_DRV_BQ4802
select RTC_DRV_SUN4V
config GENERIC_TIME
bool
...
...
arch/sparc64/kernel/time.c
View file @
84d6bd5e
...
...
@@ -424,48 +424,6 @@ static int starfire_set_time(u32 val)
return
0
;
}
static
u32
hypervisor_get_time
(
void
)
{
unsigned
long
ret
,
time
;
int
retries
=
10000
;
retry:
ret
=
sun4v_tod_get
(
&
time
);
if
(
ret
==
HV_EOK
)
return
time
;
if
(
ret
==
HV_EWOULDBLOCK
)
{
if
(
--
retries
>
0
)
{
udelay
(
100
);
goto
retry
;
}
printk
(
KERN_WARNING
"SUN4V: tod_get() timed out.
\n
"
);
return
0
;
}
printk
(
KERN_WARNING
"SUN4V: tod_get() not supported.
\n
"
);
return
0
;
}
static
int
hypervisor_set_time
(
u32
secs
)
{
unsigned
long
ret
;
int
retries
=
10000
;
retry:
ret
=
sun4v_tod_set
(
secs
);
if
(
ret
==
HV_EOK
)
return
0
;
if
(
ret
==
HV_EWOULDBLOCK
)
{
if
(
--
retries
>
0
)
{
udelay
(
100
);
goto
retry
;
}
printk
(
KERN_WARNING
"SUN4V: tod_set() timed out.
\n
"
);
return
-
EAGAIN
;
}
printk
(
KERN_WARNING
"SUN4V: tod_set() not supported.
\n
"
);
return
-
EOPNOTSUPP
;
}
unsigned
long
cmos_regs
;
EXPORT_SYMBOL
(
cmos_regs
);
...
...
@@ -644,6 +602,11 @@ static struct of_platform_driver mostek_driver = {
},
};
static
struct
platform_device
rtc_sun4v_device
=
{
.
name
=
"rtc-sun4v"
,
.
id
=
-
1
,
};
static
int
__init
clock_init
(
void
)
{
if
(
this_is_starfire
)
{
...
...
@@ -653,13 +616,8 @@ static int __init clock_init(void)
-
xtime
.
tv_sec
,
-
xtime
.
tv_nsec
);
return
0
;
}
if
(
tlb_type
==
hypervisor
)
{
xtime
.
tv_sec
=
hypervisor_get_time
();
xtime
.
tv_nsec
=
(
INITIAL_JIFFIES
%
HZ
)
*
(
NSEC_PER_SEC
/
HZ
);
set_normalized_timespec
(
&
wall_to_monotonic
,
-
xtime
.
tv_sec
,
-
xtime
.
tv_nsec
);
return
0
;
}
if
(
tlb_type
==
hypervisor
)
return
platform_device_register
(
&
rtc_sun4v_device
);
(
void
)
of_register_driver
(
&
rtc_driver
,
&
of_platform_bus_type
);
(
void
)
of_register_driver
(
&
mostek_driver
,
&
of_platform_bus_type
);
...
...
@@ -1037,24 +995,6 @@ static int starfire_set_rtc_time(struct rtc_time *time)
return
starfire_set_time
(
seconds
);
}
static
void
hypervisor_get_rtc_time
(
struct
rtc_time
*
time
)
{
u32
seconds
=
hypervisor_get_time
();
to_tm
(
seconds
,
time
);
time
->
tm_year
-=
1900
;
time
->
tm_mon
-=
1
;
}
static
int
hypervisor_set_rtc_time
(
struct
rtc_time
*
time
)
{
u32
seconds
=
mktime
(
time
->
tm_year
+
1900
,
time
->
tm_mon
+
1
,
time
->
tm_mday
,
time
->
tm_hour
,
time
->
tm_min
,
time
->
tm_sec
);
return
hypervisor_set_time
(
seconds
);
}
struct
mini_rtc_ops
{
void
(
*
get_rtc_time
)(
struct
rtc_time
*
);
int
(
*
set_rtc_time
)(
struct
rtc_time
*
);
...
...
@@ -1065,11 +1005,6 @@ static struct mini_rtc_ops starfire_rtc_ops = {
.
set_rtc_time
=
starfire_set_rtc_time
,
};
static
struct
mini_rtc_ops
hypervisor_rtc_ops
=
{
.
get_rtc_time
=
hypervisor_get_rtc_time
,
.
set_rtc_time
=
hypervisor_set_rtc_time
,
};
static
struct
mini_rtc_ops
*
mini_rtc_ops
;
static
inline
void
mini_get_rtc_time
(
struct
rtc_time
*
time
)
...
...
@@ -1192,9 +1127,7 @@ static int __init rtc_mini_init(void)
{
int
retval
;
if
(
tlb_type
==
hypervisor
)
mini_rtc_ops
=
&
hypervisor_rtc_ops
;
else
if
(
this_is_starfire
)
if
(
this_is_starfire
)
mini_rtc_ops
=
&
starfire_rtc_ops
;
else
return
-
ENODEV
;
...
...
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