diff options
Diffstat (limited to 'arch/powerpc/platforms/chrp/setup.c')
-rw-r--r-- | arch/powerpc/platforms/chrp/setup.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c index 117c9a0055bd..1870038a8e0a 100644 --- a/arch/powerpc/platforms/chrp/setup.c +++ b/arch/powerpc/platforms/chrp/setup.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/adb.h> | 28 | #include <linux/adb.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/ide.h> | ||
32 | #include <linux/console.h> | 31 | #include <linux/console.h> |
33 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
34 | #include <linux/root_dev.h> | 33 | #include <linux/root_dev.h> |
@@ -111,9 +110,9 @@ void chrp_show_cpuinfo(struct seq_file *m) | |||
111 | struct device_node *root; | 110 | struct device_node *root; |
112 | const char *model = ""; | 111 | const char *model = ""; |
113 | 112 | ||
114 | root = find_path_device("/"); | 113 | root = of_find_node_by_path("/"); |
115 | if (root) | 114 | if (root) |
116 | model = get_property(root, "model", NULL); | 115 | model = of_get_property(root, "model", NULL); |
117 | seq_printf(m, "machine\t\t: CHRP %s\n", model); | 116 | seq_printf(m, "machine\t\t: CHRP %s\n", model); |
118 | 117 | ||
119 | /* longtrail (goldengate) stuff */ | 118 | /* longtrail (goldengate) stuff */ |
@@ -161,6 +160,7 @@ void chrp_show_cpuinfo(struct seq_file *m) | |||
161 | gg2_cachetypes[(t>>2) & 3], | 160 | gg2_cachetypes[(t>>2) & 3], |
162 | gg2_cachemodes[t & 3]); | 161 | gg2_cachemodes[t & 3]); |
163 | } | 162 | } |
163 | of_node_put(root); | ||
164 | } | 164 | } |
165 | 165 | ||
166 | /* | 166 | /* |
@@ -205,13 +205,15 @@ static void __init sio_init(void) | |||
205 | { | 205 | { |
206 | struct device_node *root; | 206 | struct device_node *root; |
207 | 207 | ||
208 | if ((root = find_path_device("/")) && | 208 | if ((root = of_find_node_by_path("/")) && |
209 | !strncmp(get_property(root, "model", NULL), "IBM,LongTrail", 13)) { | 209 | !strncmp(of_get_property(root, "model", NULL), |
210 | "IBM,LongTrail", 13)) { | ||
210 | /* logical device 0 (KBC/Keyboard) */ | 211 | /* logical device 0 (KBC/Keyboard) */ |
211 | sio_fixup_irq("keyboard", 0, 1, 2); | 212 | sio_fixup_irq("keyboard", 0, 1, 2); |
212 | /* select logical device 1 (KBC/Mouse) */ | 213 | /* select logical device 1 (KBC/Mouse) */ |
213 | sio_fixup_irq("mouse", 1, 12, 2); | 214 | sio_fixup_irq("mouse", 1, 12, 2); |
214 | } | 215 | } |
216 | of_node_put(root); | ||
215 | } | 217 | } |
216 | 218 | ||
217 | 219 | ||
@@ -224,12 +226,12 @@ static void __init pegasos_set_l2cr(void) | |||
224 | return; | 226 | return; |
225 | 227 | ||
226 | /* Enable L2 cache if needed */ | 228 | /* Enable L2 cache if needed */ |
227 | np = find_type_devices("cpu"); | 229 | np = of_find_node_by_type(NULL, "cpu"); |
228 | if (np != NULL) { | 230 | if (np != NULL) { |
229 | const unsigned int *l2cr = get_property(np, "l2cr", NULL); | 231 | const unsigned int *l2cr = of_get_property(np, "l2cr", NULL); |
230 | if (l2cr == NULL) { | 232 | if (l2cr == NULL) { |
231 | printk ("Pegasos l2cr : no cpu l2cr property found\n"); | 233 | printk ("Pegasos l2cr : no cpu l2cr property found\n"); |
232 | return; | 234 | goto out; |
233 | } | 235 | } |
234 | if (!((*l2cr) & 0x80000000)) { | 236 | if (!((*l2cr) & 0x80000000)) { |
235 | printk ("Pegasos l2cr : L2 cache was not active, " | 237 | printk ("Pegasos l2cr : L2 cache was not active, " |
@@ -238,6 +240,8 @@ static void __init pegasos_set_l2cr(void) | |||
238 | _set_L2CR((*l2cr) | 0x80000000); | 240 | _set_L2CR((*l2cr) | 0x80000000); |
239 | } | 241 | } |
240 | } | 242 | } |
243 | out: | ||
244 | of_node_put(np); | ||
241 | } | 245 | } |
242 | 246 | ||
243 | static void briq_restart(char *cmd) | 247 | static void briq_restart(char *cmd) |
@@ -250,14 +254,14 @@ static void briq_restart(char *cmd) | |||
250 | 254 | ||
251 | void __init chrp_setup_arch(void) | 255 | void __init chrp_setup_arch(void) |
252 | { | 256 | { |
253 | struct device_node *root = find_path_device ("/"); | 257 | struct device_node *root = of_find_node_by_path("/"); |
254 | const char *machine = NULL; | 258 | const char *machine = NULL; |
255 | 259 | ||
256 | /* init to some ~sane value until calibrate_delay() runs */ | 260 | /* init to some ~sane value until calibrate_delay() runs */ |
257 | loops_per_jiffy = 50000000/HZ; | 261 | loops_per_jiffy = 50000000/HZ; |
258 | 262 | ||
259 | if (root) | 263 | if (root) |
260 | machine = get_property(root, "model", NULL); | 264 | machine = of_get_property(root, "model", NULL); |
261 | if (machine && strncmp(machine, "Pegasos", 7) == 0) { | 265 | if (machine && strncmp(machine, "Pegasos", 7) == 0) { |
262 | _chrp_type = _CHRP_Pegasos; | 266 | _chrp_type = _CHRP_Pegasos; |
263 | } else if (machine && strncmp(machine, "IBM", 3) == 0) { | 267 | } else if (machine && strncmp(machine, "IBM", 3) == 0) { |
@@ -273,6 +277,7 @@ void __init chrp_setup_arch(void) | |||
273 | /* Let's assume it is an IBM chrp if all else fails */ | 277 | /* Let's assume it is an IBM chrp if all else fails */ |
274 | _chrp_type = _CHRP_IBM; | 278 | _chrp_type = _CHRP_IBM; |
275 | } | 279 | } |
280 | of_node_put(root); | ||
276 | printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]); | 281 | printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]); |
277 | 282 | ||
278 | rtas_initialize(); | 283 | rtas_initialize(); |
@@ -361,8 +366,8 @@ static void __init chrp_find_openpic(void) | |||
361 | return; | 366 | return; |
362 | root = of_find_node_by_path("/"); | 367 | root = of_find_node_by_path("/"); |
363 | if (root) { | 368 | if (root) { |
364 | opprop = get_property(root, "platform-open-pic", &oplen); | 369 | opprop = of_get_property(root, "platform-open-pic", &oplen); |
365 | na = prom_n_addr_cells(root); | 370 | na = of_n_addr_cells(root); |
366 | } | 371 | } |
367 | if (opprop && oplen >= na * sizeof(unsigned int)) { | 372 | if (opprop && oplen >= na * sizeof(unsigned int)) { |
368 | opaddr = opprop[na-1]; /* assume 32-bit */ | 373 | opaddr = opprop[na-1]; /* assume 32-bit */ |
@@ -378,7 +383,7 @@ static void __init chrp_find_openpic(void) | |||
378 | 383 | ||
379 | printk(KERN_INFO "OpenPIC at %lx\n", opaddr); | 384 | printk(KERN_INFO "OpenPIC at %lx\n", opaddr); |
380 | 385 | ||
381 | iranges = get_property(np, "interrupt-ranges", &len); | 386 | iranges = of_get_property(np, "interrupt-ranges", &len); |
382 | if (iranges == NULL) | 387 | if (iranges == NULL) |
383 | len = 0; /* non-distributed mpic */ | 388 | len = 0; /* non-distributed mpic */ |
384 | else | 389 | else |
@@ -427,7 +432,7 @@ static void __init chrp_find_openpic(void) | |||
427 | of_node_put(np); | 432 | of_node_put(np); |
428 | } | 433 | } |
429 | 434 | ||
430 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) | 435 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON) |
431 | static struct irqaction xmon_irqaction = { | 436 | static struct irqaction xmon_irqaction = { |
432 | .handler = xmon_irq, | 437 | .handler = xmon_irq, |
433 | .mask = CPU_MASK_NONE, | 438 | .mask = CPU_MASK_NONE, |
@@ -463,15 +468,16 @@ static void __init chrp_find_8259(void) | |||
463 | * Also, Pegasos-type platforms don't have a proper node to start | 468 | * Also, Pegasos-type platforms don't have a proper node to start |
464 | * from anyway | 469 | * from anyway |
465 | */ | 470 | */ |
466 | for (np = find_devices("pci"); np != NULL; np = np->next) { | 471 | for_each_node_by_name(np, "pci") { |
467 | const unsigned int *addrp = get_property(np, | 472 | const unsigned int *addrp = of_get_property(np, |
468 | "8259-interrupt-acknowledge", NULL); | 473 | "8259-interrupt-acknowledge", NULL); |
469 | 474 | ||
470 | if (addrp == NULL) | 475 | if (addrp == NULL) |
471 | continue; | 476 | continue; |
472 | chrp_int_ack = addrp[prom_n_addr_cells(np)-1]; | 477 | chrp_int_ack = addrp[of_n_addr_cells(np)-1]; |
473 | break; | 478 | break; |
474 | } | 479 | } |
480 | of_node_put(np); | ||
475 | if (np == NULL) | 481 | if (np == NULL) |
476 | printk(KERN_WARNING "Cannot find PCI interrupt acknowledge" | 482 | printk(KERN_WARNING "Cannot find PCI interrupt acknowledge" |
477 | " address, polling\n"); | 483 | " address, polling\n"); |
@@ -493,7 +499,7 @@ static void __init chrp_find_8259(void) | |||
493 | 499 | ||
494 | void __init chrp_init_IRQ(void) | 500 | void __init chrp_init_IRQ(void) |
495 | { | 501 | { |
496 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) | 502 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON) |
497 | struct device_node *kbd; | 503 | struct device_node *kbd; |
498 | #endif | 504 | #endif |
499 | chrp_find_openpic(); | 505 | chrp_find_openpic(); |
@@ -510,13 +516,14 @@ void __init chrp_init_IRQ(void) | |||
510 | if (_chrp_type == _CHRP_Pegasos) | 516 | if (_chrp_type == _CHRP_Pegasos) |
511 | ppc_md.get_irq = i8259_irq; | 517 | ppc_md.get_irq = i8259_irq; |
512 | 518 | ||
513 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) | 519 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON) |
514 | /* see if there is a keyboard in the device tree | 520 | /* see if there is a keyboard in the device tree |
515 | with a parent of type "adb" */ | 521 | with a parent of type "adb" */ |
516 | for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next) | 522 | for_each_node_by_name(kbd, "keyboard") |
517 | if (kbd->parent && kbd->parent->type | 523 | if (kbd->parent && kbd->parent->type |
518 | && strcmp(kbd->parent->type, "adb") == 0) | 524 | && strcmp(kbd->parent->type, "adb") == 0) |
519 | break; | 525 | break; |
526 | of_node_put(kbd); | ||
520 | if (kbd) | 527 | if (kbd) |
521 | setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction); | 528 | setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction); |
522 | #endif | 529 | #endif |
@@ -542,9 +549,9 @@ chrp_init2(void) | |||
542 | /* Get the event scan rate for the rtas so we know how | 549 | /* Get the event scan rate for the rtas so we know how |
543 | * often it expects a heartbeat. -- Cort | 550 | * often it expects a heartbeat. -- Cort |
544 | */ | 551 | */ |
545 | device = find_devices("rtas"); | 552 | device = of_find_node_by_name(NULL, "rtas"); |
546 | if (device) | 553 | if (device) |
547 | p = get_property(device, "rtas-event-scan-rate", NULL); | 554 | p = of_get_property(device, "rtas-event-scan-rate", NULL); |
548 | if (p && *p) { | 555 | if (p && *p) { |
549 | /* | 556 | /* |
550 | * Arrange to call chrp_event_scan at least *p times | 557 | * Arrange to call chrp_event_scan at least *p times |
@@ -571,6 +578,7 @@ chrp_init2(void) | |||
571 | printk("RTAS Event Scan Rate: %u (%lu jiffies)\n", | 578 | printk("RTAS Event Scan Rate: %u (%lu jiffies)\n", |
572 | *p, interval); | 579 | *p, interval); |
573 | } | 580 | } |
581 | of_node_put(device); | ||
574 | 582 | ||
575 | if (ppc_md.progress) | 583 | if (ppc_md.progress) |
576 | ppc_md.progress(" Have fun! ", 0x7777); | 584 | ppc_md.progress(" Have fun! ", 0x7777); |