[SPARC64]: Probe for power device on ISA bus too.

Signed-off-by: David S. Miller <davem@davemloft.net>

+51 -13
+51 -13
arch/sparc64/kernel/power.c
··· 17 17 18 18 #include <asm/system.h> 19 19 #include <asm/ebus.h> 20 + #include <asm/isa.h> 20 21 #include <asm/auxio.h> 21 22 22 23 #include <linux/unistd.h> ··· 101 100 return 0; 102 101 } 103 102 104 - static int __init has_button_interrupt(struct linux_ebus_device *edev) 103 + static int __init has_button_interrupt(unsigned int irq, int prom_node) 105 104 { 106 - if (edev->irqs[0] == PCI_IRQ_NONE) 105 + if (irq == PCI_IRQ_NONE) 107 106 return 0; 108 - if (!prom_node_has_property(edev->prom_node, "button")) 107 + if (!prom_node_has_property(prom_node, "button")) 109 108 return 0; 110 109 111 110 return 1; 112 111 } 113 112 114 - void __init power_init(void) 113 + static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p, int *prom_node_p) 115 114 { 116 115 struct linux_ebus *ebus; 117 116 struct linux_ebus_device *edev; 117 + 118 + for_each_ebus(ebus) { 119 + for_each_ebusdev(edev, ebus) { 120 + if (!strcmp(edev->prom_name, "power")) { 121 + *resp = &edev->resource[0]; 122 + *irq_p = edev->irqs[0]; 123 + *prom_node_p = edev->prom_node; 124 + return 0; 125 + } 126 + } 127 + } 128 + return -ENODEV; 129 + } 130 + 131 + static int __init power_probe_isa(struct resource **resp, unsigned int *irq_p, int *prom_node_p) 132 + { 133 + struct sparc_isa_bridge *isa_bus; 134 + struct sparc_isa_device *isa_dev; 135 + 136 + for_each_isa(isa_bus) { 137 + for_each_isadev(isa_dev, isa_bus) { 138 + if (!strcmp(isa_dev->prom_name, "power")) { 139 + *resp = &isa_dev->resource; 140 + *irq_p = isa_dev->irq; 141 + *prom_node_p = isa_dev->prom_node; 142 + return 0; 143 + } 144 + } 145 + } 146 + return -ENODEV; 147 + } 148 + 149 + void __init power_init(void) 150 + { 151 + struct resource *res = NULL; 152 + unsigned int irq; 153 + int prom_node; 118 154 static int invoked; 119 155 120 156 if (invoked) 121 157 return; 122 158 invoked = 1; 123 159 124 - for_each_ebus(ebus) { 125 - for_each_ebusdev(edev, ebus) { 126 - if (!strcmp(edev->prom_name, "power")) 127 - goto found; 128 - } 129 - } 160 + if (!power_probe_ebus(&res, &irq, &prom_node)) 161 + goto found; 162 + 163 + if (!power_probe_isa(&res, &irq, &prom_node)) 164 + goto found; 165 + 130 166 return; 131 167 132 168 found: 133 - power_reg = ioremap(edev->resource[0].start, 0x4); 169 + power_reg = ioremap(res->start, 0x4); 134 170 printk("power: Control reg at %p ... ", power_reg); 135 171 poweroff_method = machine_halt; /* able to use the standard halt */ 136 - if (has_button_interrupt(edev)) { 172 + if (has_button_interrupt(irq, prom_node)) { 137 173 if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { 138 174 printk("Failed to start power daemon.\n"); 139 175 return; 140 176 } 141 177 printk("powerd running.\n"); 142 178 143 - if (request_irq(edev->irqs[0], 179 + if (request_irq(irq, 144 180 power_handler, SA_SHIRQ, "power", NULL) < 0) 145 181 printk("power: Error, cannot register IRQ handler.\n"); 146 182 } else {