diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-03 13:49:45 -0400 |
commit | 026477c1141b67e98e3bd8bdedb7d4b88a3ecd09 (patch) | |
tree | 2624a44924c625c367f3cebf937853b9da2de282 /arch/sparc64/kernel/power.c | |
parent | 9f2fa466383ce100b90fe52cb4489d7a26bf72a9 (diff) | |
parent | 29454dde27d8e340bb1987bad9aa504af7081eba (diff) |
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/
Diffstat (limited to 'arch/sparc64/kernel/power.c')
-rw-r--r-- | arch/sparc64/kernel/power.c | 60 |
1 files changed, 19 insertions, 41 deletions
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index 9496c773401..e55466c77b6 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c @@ -6,7 +6,6 @@ #define __KERNEL_SYSCALLS__ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> @@ -17,9 +16,10 @@ #include <linux/pm.h> #include <asm/system.h> -#include <asm/ebus.h> -#include <asm/isa.h> #include <asm/auxio.h> +#include <asm/prom.h> +#include <asm/of_device.h> +#include <asm/io.h> #include <linux/unistd.h> @@ -30,6 +30,7 @@ int scons_pwroff = 1; #ifdef CONFIG_PCI +#include <linux/pci.h> static void __iomem *power_reg; static DECLARE_WAIT_QUEUE_HEAD(powerd_wait); @@ -115,27 +116,33 @@ static int __init has_button_interrupt(unsigned int irq, struct device_node *dp) 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 */ - if (has_button_interrupt(irq, dev->node)) { + if (has_button_interrupt(irq, op->node)) { if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { printk("Failed to start power daemon.\n"); - return; + return 0; } printk("powerd running.\n"); if (request_irq(irq, - power_handler, SA_SHIRQ, "power", NULL) < 0) + power_handler, 0, "power", NULL) < 0) printk("power: Error, cannot register IRQ handler.\n"); } else { printk("not using powerd.\n"); } + + return 0; } static struct of_device_id power_match[] = { @@ -145,44 +152,15 @@ static struct of_device_id power_match[] = { {}, }; -static int __devinit ebus_power_probe(struct of_device *dev, const struct of_device_id *match) -{ - 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 = { +static struct of_platform_driver power_driver = { .name = "power", .match_table = power_match, - .probe = isa_power_probe, + .probe = power_probe, }; void __init power_init(void) { - of_register_driver(&ebus_power_driver, &ebus_bus_type); - of_register_driver(&isa_power_driver, &isa_bus_type); + of_register_driver(&power_driver, &of_bus_type); return; } #endif /* CONFIG_PCI */ |