diff options
author | David S. Miller <davem@davemloft.net> | 2006-06-29 18:22:46 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-29 19:37:57 -0400 |
commit | abbce6e2fd156cbcab2fc1247c7dec8a0c68e7e3 (patch) | |
tree | 62619be12e2db209db0c5d232dd56414c2bb5976 /arch/sparc64/kernel | |
parent | f2ad06a20133125e5b6ab6497c6d90e63ded4761 (diff) |
[SPARC64] power: Convert to of_driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel')
-rw-r--r-- | arch/sparc64/kernel/power.c | 57 |
1 files changed, 18 insertions, 39 deletions
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c index df0a82d082b3..4febeda958a3 100644 --- a/arch/sparc64/kernel/power.c +++ b/arch/sparc64/kernel/power.c | |||
@@ -17,9 +17,10 @@ | |||
17 | #include <linux/pm.h> | 17 | #include <linux/pm.h> |
18 | 18 | ||
19 | #include <asm/system.h> | 19 | #include <asm/system.h> |
20 | #include <asm/ebus.h> | ||
21 | #include <asm/isa.h> | ||
22 | #include <asm/auxio.h> | 20 | #include <asm/auxio.h> |
21 | #include <asm/prom.h> | ||
22 | #include <asm/of_device.h> | ||
23 | #include <asm/io.h> | ||
23 | 24 | ||
24 | #include <linux/unistd.h> | 25 | #include <linux/unistd.h> |
25 | 26 | ||
@@ -30,6 +31,7 @@ | |||
30 | int scons_pwroff = 1; | 31 | int scons_pwroff = 1; |
31 | 32 | ||
32 | #ifdef CONFIG_PCI | 33 | #ifdef CONFIG_PCI |
34 | #include <linux/pci.h> | ||
33 | static void __iomem *power_reg; | 35 | static void __iomem *power_reg; |
34 | 36 | ||
35 | static DECLARE_WAIT_QUEUE_HEAD(powerd_wait); | 37 | 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 | return 1; | 117 | return 1; |
116 | } | 118 | } |
117 | 119 | ||
118 | static void __devinit power_probe_common(struct of_device *dev, struct resource *res, unsigned int irq) | 120 | static int __devinit power_probe(struct of_device *op, const struct of_device_id *match) |
119 | { | 121 | { |
120 | power_reg = ioremap(res->start, 0x4); | 122 | struct resource *res = &op->resource[0]; |
123 | unsigned int irq= op->irqs[0]; | ||
121 | 124 | ||
122 | printk("power: Control reg at %p ... ", power_reg); | 125 | power_reg = of_ioremap(res, 0, 0x4, "power"); |
126 | |||
127 | printk("%s: Control reg at %lx ... ", | ||
128 | op->node->name, res->start); | ||
123 | 129 | ||
124 | poweroff_method = machine_halt; /* able to use the standard halt */ | 130 | poweroff_method = machine_halt; /* able to use the standard halt */ |
125 | 131 | ||
126 | if (has_button_interrupt(irq, dev->node)) { | 132 | if (has_button_interrupt(irq, op->node)) { |
127 | if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { | 133 | if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { |
128 | printk("Failed to start power daemon.\n"); | 134 | printk("Failed to start power daemon.\n"); |
129 | return; | 135 | return 0; |
130 | } | 136 | } |
131 | printk("powerd running.\n"); | 137 | printk("powerd running.\n"); |
132 | 138 | ||
@@ -136,6 +142,8 @@ static void __devinit power_probe_common(struct of_device *dev, struct resource | |||
136 | } else { | 142 | } else { |
137 | printk("not using powerd.\n"); | 143 | printk("not using powerd.\n"); |
138 | } | 144 | } |
145 | |||
146 | return 0; | ||
139 | } | 147 | } |
140 | 148 | ||
141 | static struct of_device_id power_match[] = { | 149 | static struct of_device_id power_match[] = { |
@@ -145,44 +153,15 @@ static struct of_device_id power_match[] = { | |||
145 | {}, | 153 | {}, |
146 | }; | 154 | }; |
147 | 155 | ||
148 | static int __devinit ebus_power_probe(struct of_device *dev, const struct of_device_id *match) | 156 | static struct of_platform_driver power_driver = { |
149 | { | ||
150 | struct linux_ebus_device *edev = to_ebus_device(&dev->dev); | ||
151 | struct resource *res = &edev->resource[0]; | ||
152 | unsigned int irq = edev->irqs[0]; | ||
153 | |||
154 | power_probe_common(dev, res,irq); | ||
155 | |||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static struct of_platform_driver ebus_power_driver = { | ||
160 | .name = "power", | ||
161 | .match_table = power_match, | ||
162 | .probe = ebus_power_probe, | ||
163 | }; | ||
164 | |||
165 | static int __devinit isa_power_probe(struct of_device *dev, const struct of_device_id *match) | ||
166 | { | ||
167 | struct sparc_isa_device *idev = to_isa_device(&dev->dev); | ||
168 | struct resource *res = &idev->resource; | ||
169 | unsigned int irq = idev->irq; | ||
170 | |||
171 | power_probe_common(dev, res,irq); | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static struct of_platform_driver isa_power_driver = { | ||
177 | .name = "power", | 157 | .name = "power", |
178 | .match_table = power_match, | 158 | .match_table = power_match, |
179 | .probe = isa_power_probe, | 159 | .probe = power_probe, |
180 | }; | 160 | }; |
181 | 161 | ||
182 | void __init power_init(void) | 162 | void __init power_init(void) |
183 | { | 163 | { |
184 | of_register_driver(&ebus_power_driver, &ebus_bus_type); | 164 | of_register_driver(&power_driver, &of_bus_type); |
185 | of_register_driver(&isa_power_driver, &isa_bus_type); | ||
186 | return; | 165 | return; |
187 | } | 166 | } |
188 | #endif /* CONFIG_PCI */ | 167 | #endif /* CONFIG_PCI */ |