mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-14 17:35:42 +00:00
[SPARC64] power: Convert to of_driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f2ad06a201
commit
abbce6e2fd
@ -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 @@
|
|||||||
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)
|
|||||||
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
|
|||||||
} 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[] = {
|
|||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
|
|
||||||
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",
|
.name = "power",
|
||||||
.match_table = power_match,
|
.match_table = power_match,
|
||||||
.probe = ebus_power_probe,
|
.probe = 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",
|
|
||||||
.match_table = power_match,
|
|
||||||
.probe = isa_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 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user