Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 31316
b: refs/heads/master
c: abbce6e
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller authored and David S. Miller committed Jun 29, 2006
1 parent 6409e96 commit dfcd9f3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 40 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f2ad06a20133125e5b6ab6497c6d90e63ded4761
refs/heads/master: abbce6e2fd156cbcab2fc1247c7dec8a0c68e7e3
57 changes: 18 additions & 39 deletions trunk/arch/sparc64/kernel/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,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>

Expand All @@ -30,6 +31,7 @@
int scons_pwroff = 1;

#ifdef CONFIG_PCI
#include <linux/pci.h>
static void __iomem *power_reg;

static DECLARE_WAIT_QUEUE_HEAD(powerd_wait);
Expand Down Expand Up @@ -115,18 +117,22 @@ 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");

Expand All @@ -136,6 +142,8 @@ static void __devinit power_probe_common(struct of_device *dev, struct resource
} else {
printk("not using powerd.\n");
}

return 0;
}

static struct of_device_id power_match[] = {
Expand All @@ -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)
{
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 */

0 comments on commit dfcd9f3

Please sign in to comment.