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
Kirill Smelkov
linux
Commits
abbce6e2
Commit
abbce6e2
authored
Jun 29, 2006
by
David S. Miller
Committed by
David S. Miller
Jun 29, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC64] power: Convert to of_driver.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
f2ad06a2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
39 deletions
+18
-39
arch/sparc64/kernel/power.c
arch/sparc64/kernel/power.c
+18
-39
No files found.
arch/sparc64/kernel/power.c
View file @
abbce6e2
...
@@ -17,9 +17,10 @@
...
@@ -17,9 +17,10 @@
#include <linux/pm.h>
#include <linux/pm.h>
#include <asm/system.h>
#include <asm/system.h>
#include <asm/ebus.h>
#include <asm/isa.h>
#include <asm/auxio.h>
#include <asm/auxio.h>
#include <asm/prom.h>
#include <asm/of_device.h>
#include <asm/io.h>
#include <linux/unistd.h>
#include <linux/unistd.h>
...
@@ -30,6 +31,7 @@
...
@@ -30,6 +31,7 @@
int
scons_pwroff
=
1
;
int
scons_pwroff
=
1
;
#ifdef CONFIG_PCI
#ifdef CONFIG_PCI
#include <linux/pci.h>
static
void
__iomem
*
power_reg
;
static
void
__iomem
*
power_reg
;
static
DECLARE_WAIT_QUEUE_HEAD
(
powerd_wait
);
static
DECLARE_WAIT_QUEUE_HEAD
(
powerd_wait
);
...
@@ -115,18 +117,22 @@ static int __init has_button_interrupt(unsigned int irq, struct device_node *dp)
...
@@ -115,18 +117,22 @@ static int __init has_button_interrupt(unsigned int irq, struct device_node *dp)
return
1
;
return
1
;
}
}
static
void
__devinit
power_probe_common
(
struct
of_device
*
dev
,
struct
resource
*
res
,
unsigned
int
irq
)
static
int
__devinit
power_probe
(
struct
of_device
*
op
,
const
struct
of_device_id
*
match
)
{
{
power_reg
=
ioremap
(
res
->
start
,
0x4
);
struct
resource
*
res
=
&
op
->
resource
[
0
];
unsigned
int
irq
=
op
->
irqs
[
0
];
printk
(
"power: Control reg at %p ... "
,
power_reg
);
power_reg
=
of_ioremap
(
res
,
0
,
0x4
,
"power"
);
printk
(
"%s: Control reg at %lx ... "
,
op
->
node
->
name
,
res
->
start
);
poweroff_method
=
machine_halt
;
/* able to use the standard halt */
poweroff_method
=
machine_halt
;
/* able to use the standard halt */
if
(
has_button_interrupt
(
irq
,
dev
->
node
))
{
if
(
has_button_interrupt
(
irq
,
op
->
node
))
{
if
(
kernel_thread
(
powerd
,
NULL
,
CLONE_FS
)
<
0
)
{
if
(
kernel_thread
(
powerd
,
NULL
,
CLONE_FS
)
<
0
)
{
printk
(
"Failed to start power daemon.
\n
"
);
printk
(
"Failed to start power daemon.
\n
"
);
return
;
return
0
;
}
}
printk
(
"powerd running.
\n
"
);
printk
(
"powerd running.
\n
"
);
...
@@ -136,6 +142,8 @@ static void __devinit power_probe_common(struct of_device *dev, struct resource
...
@@ -136,6 +142,8 @@ static void __devinit power_probe_common(struct of_device *dev, struct resource
}
else
{
}
else
{
printk
(
"not using powerd.
\n
"
);
printk
(
"not using powerd.
\n
"
);
}
}
return
0
;
}
}
static
struct
of_device_id
power_match
[]
=
{
static
struct
of_device_id
power_match
[]
=
{
...
@@ -145,44 +153,15 @@ static struct of_device_id power_match[] = {
...
@@ -145,44 +153,15 @@ static struct of_device_id power_match[] = {
{},
{},
};
};
static
int
__devinit
ebus_power_probe
(
struct
of_device
*
dev
,
const
struct
of_device_id
*
match
)
static
struct
of_platform_driver
power_driver
=
{
{
struct
linux_ebus_device
*
edev
=
to_ebus_device
(
&
dev
->
dev
);
struct
resource
*
res
=
&
edev
->
resource
[
0
];
unsigned
int
irq
=
edev
->
irqs
[
0
];
power_probe_common
(
dev
,
res
,
irq
);
return
0
;
}
static
struct
of_platform_driver
ebus_power_driver
=
{
.
name
=
"power"
,
.
match_table
=
power_match
,
.
probe
=
ebus_power_probe
,
};
static
int
__devinit
isa_power_probe
(
struct
of_device
*
dev
,
const
struct
of_device_id
*
match
)
{
struct
sparc_isa_device
*
idev
=
to_isa_device
(
&
dev
->
dev
);
struct
resource
*
res
=
&
idev
->
resource
;
unsigned
int
irq
=
idev
->
irq
;
power_probe_common
(
dev
,
res
,
irq
);
return
0
;
}
static
struct
of_platform_driver
isa_power_driver
=
{
.
name
=
"power"
,
.
name
=
"power"
,
.
match_table
=
power_match
,
.
match_table
=
power_match
,
.
probe
=
isa_
power_probe
,
.
probe
=
power_probe
,
};
};
void
__init
power_init
(
void
)
void
__init
power_init
(
void
)
{
{
of_register_driver
(
&
ebus_power_driver
,
&
ebus_bus_type
);
of_register_driver
(
&
power_driver
,
&
of_bus_type
);
of_register_driver
(
&
isa_power_driver
,
&
isa_bus_type
);
return
;
return
;
}
}
#endif
/* CONFIG_PCI */
#endif
/* CONFIG_PCI */
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