aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-06-22 22:12:03 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-24 02:15:28 -0400
commit690c8fd31f1e35985d0f35772fde514da59ec9d1 (patch)
tree8a5a0036b3780a9eb315ea2201a2562570de1ebe
parentde8d28b16f5614aeb12bb69c8f9a38578b8d3ada (diff)
[SPARC64]: Use in-kernel PROM tree for EBUS and ISA.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc64/kernel/auxio.c2
-rw-r--r--arch/sparc64/kernel/ebus.c141
-rw-r--r--arch/sparc64/kernel/isa.c144
-rw-r--r--arch/sparc64/kernel/power.c20
-rw-r--r--arch/sparc64/kernel/prom.c1
-rw-r--r--arch/sparc64/kernel/time.c368
-rw-r--r--drivers/char/rtc.c4
-rw-r--r--drivers/input/misc/sparcspkr.c4
-rw-r--r--drivers/input/serio/i8042-sparcio.h10
-rw-r--r--drivers/sbus/char/bbc_envctrl.c4
-rw-r--r--drivers/sbus/char/bbc_i2c.c4
-rw-r--r--drivers/sbus/char/display7seg.c2
-rw-r--r--drivers/sbus/char/envctrl.c71
-rw-r--r--drivers/sbus/char/flash.c16
-rw-r--r--drivers/serial/sunsab.c12
-rw-r--r--drivers/serial/sunsu.c4
-rw-r--r--include/asm-sparc64/ebus.h10
-rw-r--r--include/asm-sparc64/floppy.h27
-rw-r--r--include/asm-sparc64/isa.h8
-rw-r--r--include/asm-sparc64/parport.h25
-rw-r--r--sound/sparc/cs4231.c13
21 files changed, 440 insertions, 450 deletions
diff --git a/arch/sparc64/kernel/auxio.c b/arch/sparc64/kernel/auxio.c
index 8852c20c8d99..db36b66a4e3c 100644
--- a/arch/sparc64/kernel/auxio.c
+++ b/arch/sparc64/kernel/auxio.c
@@ -136,7 +136,7 @@ found_sdev:
136 136
137 for_each_ebus(ebus) { 137 for_each_ebus(ebus) {
138 for_each_ebusdev(edev, ebus) { 138 for_each_ebusdev(edev, ebus) {
139 if (!strcmp(edev->prom_name, "auxio")) 139 if (!strcmp(edev->prom_node->name, "auxio"))
140 goto ebus_done; 140 goto ebus_done;
141 } 141 }
142 } 142 }
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c
index 3125a5b49775..919a91d9e5de 100644
--- a/arch/sparc64/kernel/ebus.c
+++ b/arch/sparc64/kernel/ebus.c
@@ -285,36 +285,38 @@ static inline void *ebus_alloc(size_t size)
285 285
286static void __init ebus_ranges_init(struct linux_ebus *ebus) 286static void __init ebus_ranges_init(struct linux_ebus *ebus)
287{ 287{
288 int success; 288 struct linux_prom_ebus_ranges *rngs;
289 int len;
289 290
290 ebus->num_ebus_ranges = 0; 291 ebus->num_ebus_ranges = 0;
291 success = prom_getproperty(ebus->prom_node, "ranges", 292 rngs = of_get_property(ebus->prom_node, "ranges", &len);
292 (char *)ebus->ebus_ranges, 293 if (rngs) {
293 sizeof(ebus->ebus_ranges)); 294 memcpy(ebus->ebus_ranges, rngs, len);
294 if (success != -1) 295 ebus->num_ebus_ranges =
295 ebus->num_ebus_ranges = (success/sizeof(struct linux_prom_ebus_ranges)); 296 (len / sizeof(struct linux_prom_ebus_ranges));
297 }
296} 298}
297 299
298static void __init ebus_intmap_init(struct linux_ebus *ebus) 300static void __init ebus_intmap_init(struct linux_ebus *ebus)
299{ 301{
300 int success; 302 struct linux_prom_ebus_intmap *imap;
303 struct linux_prom_ebus_intmask *imask;
304 int len;
301 305
302 ebus->num_ebus_intmap = 0; 306 ebus->num_ebus_intmap = 0;
303 success = prom_getproperty(ebus->prom_node, "interrupt-map", 307 imap = of_get_property(ebus->prom_node, "interrupt-map", &len);
304 (char *)ebus->ebus_intmap, 308 if (!imap)
305 sizeof(ebus->ebus_intmap));
306 if (success == -1)
307 return; 309 return;
308 310
309 ebus->num_ebus_intmap = (success/sizeof(struct linux_prom_ebus_intmap)); 311 memcpy(ebus->ebus_intmap, imap, len);
312 ebus->num_ebus_intmap = (len / sizeof(struct linux_prom_ebus_intmap));
310 313
311 success = prom_getproperty(ebus->prom_node, "interrupt-map-mask", 314 imask = of_get_property(ebus->prom_node, "interrupt-map-mask", &len);
312 (char *)&ebus->ebus_intmask, 315 if (!imask) {
313 sizeof(ebus->ebus_intmask)); 316 prom_printf("EBUS: can't get interrupt-map-mask\n");
314 if (success == -1) {
315 prom_printf("%s: can't get interrupt-map-mask\n", __FUNCTION__);
316 prom_halt(); 317 prom_halt();
317 } 318 }
319 memcpy(&ebus->ebus_intmask, imask, sizeof(ebus->ebus_intmask));
318} 320}
319 321
320int __init ebus_intmap_match(struct linux_ebus *ebus, 322int __init ebus_intmap_match(struct linux_ebus *ebus,
@@ -341,19 +343,23 @@ int __init ebus_intmap_match(struct linux_ebus *ebus,
341 return -1; 343 return -1;
342} 344}
343 345
344void __init fill_ebus_child(int node, struct linux_prom_registers *preg, 346void __init fill_ebus_child(struct device_node *dp,
345 struct linux_ebus_child *dev, int non_standard_regs) 347 struct linux_prom_registers *preg,
348 struct linux_ebus_child *dev,
349 int non_standard_regs)
346{ 350{
347 int regs[PROMREG_MAX]; 351 int *regs;
348 int irqs[PROMREG_MAX]; 352 int *irqs;
349 int i, len; 353 int i, len;
350 354
351 dev->prom_node = node; 355 dev->prom_node = dp;
352 prom_getstring(node, "name", dev->prom_name, sizeof(dev->prom_name)); 356 printk(" (%s)", dp->name);
353 printk(" (%s)", dev->prom_name);
354 357
355 len = prom_getproperty(node, "reg", (void *)regs, sizeof(regs)); 358 regs = of_get_property(dp, "reg", &len);
356 dev->num_addrs = len / sizeof(regs[0]); 359 if (!regs)
360 dev->num_addrs = 0;
361 else
362 dev->num_addrs = len / sizeof(regs[0]);
357 363
358 if (non_standard_regs) { 364 if (non_standard_regs) {
359 /* This is to handle reg properties which are not 365 /* This is to handle reg properties which are not
@@ -370,21 +376,21 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg,
370 int rnum = regs[i]; 376 int rnum = regs[i];
371 if (rnum >= dev->parent->num_addrs) { 377 if (rnum >= dev->parent->num_addrs) {
372 prom_printf("UGH: property for %s was %d, need < %d\n", 378 prom_printf("UGH: property for %s was %d, need < %d\n",
373 dev->prom_name, len, dev->parent->num_addrs); 379 dp->name, len, dev->parent->num_addrs);
374 panic(__FUNCTION__); 380 prom_halt();
375 } 381 }
376 dev->resource[i].start = dev->parent->resource[i].start; 382 dev->resource[i].start = dev->parent->resource[i].start;
377 dev->resource[i].end = dev->parent->resource[i].end; 383 dev->resource[i].end = dev->parent->resource[i].end;
378 dev->resource[i].flags = IORESOURCE_MEM; 384 dev->resource[i].flags = IORESOURCE_MEM;
379 dev->resource[i].name = dev->prom_name; 385 dev->resource[i].name = dp->name;
380 } 386 }
381 } 387 }
382 388
383 for (i = 0; i < PROMINTR_MAX; i++) 389 for (i = 0; i < PROMINTR_MAX; i++)
384 dev->irqs[i] = PCI_IRQ_NONE; 390 dev->irqs[i] = PCI_IRQ_NONE;
385 391
386 len = prom_getproperty(node, "interrupts", (char *)&irqs, sizeof(irqs)); 392 irqs = of_get_property(dp, "interrupts", &len);
387 if ((len == -1) || (len == 0)) { 393 if (!irqs) {
388 dev->num_irqs = 0; 394 dev->num_irqs = 0;
389 /* 395 /*
390 * Oh, well, some PROMs don't export interrupts 396 * Oh, well, some PROMs don't export interrupts
@@ -392,8 +398,8 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg,
392 * 398 *
393 * Be smart about PS/2 keyboard and mouse. 399 * Be smart about PS/2 keyboard and mouse.
394 */ 400 */
395 if (!strcmp(dev->parent->prom_name, "8042")) { 401 if (!strcmp(dev->parent->prom_node->name, "8042")) {
396 if (!strcmp(dev->prom_name, "kb_ps2")) { 402 if (!strcmp(dev->prom_node->name, "kb_ps2")) {
397 dev->num_irqs = 1; 403 dev->num_irqs = 1;
398 dev->irqs[0] = dev->parent->irqs[0]; 404 dev->irqs[0] = dev->parent->irqs[0];
399 } else { 405 } else {
@@ -423,32 +429,32 @@ void __init fill_ebus_child(int node, struct linux_prom_registers *preg,
423 429
424static int __init child_regs_nonstandard(struct linux_ebus_device *dev) 430static int __init child_regs_nonstandard(struct linux_ebus_device *dev)
425{ 431{
426 if (!strcmp(dev->prom_name, "i2c") || 432 if (!strcmp(dev->prom_node->name, "i2c") ||
427 !strcmp(dev->prom_name, "SUNW,lombus")) 433 !strcmp(dev->prom_node->name, "SUNW,lombus"))
428 return 1; 434 return 1;
429 return 0; 435 return 0;
430} 436}
431 437
432void __init fill_ebus_device(int node, struct linux_ebus_device *dev) 438void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *dev)
433{ 439{
434 struct linux_prom_registers regs[PROMREG_MAX]; 440 struct linux_prom_registers *regs;
435 struct linux_ebus_child *child; 441 struct linux_ebus_child *child;
436 int irqs[PROMINTR_MAX]; 442 int *irqs;
437 int i, n, len; 443 int i, n, len;
438 444
439 dev->prom_node = node; 445 dev->prom_node = dp;
440 prom_getstring(node, "name", dev->prom_name, sizeof(dev->prom_name));
441 printk(" [%s", dev->prom_name);
442 446
443 len = prom_getproperty(node, "reg", (void *)regs, sizeof(regs)); 447 printk(" [%s", dp->name);
444 if (len == -1) { 448
449 regs = of_get_property(dp, "reg", &len);
450 if (!regs) {
445 dev->num_addrs = 0; 451 dev->num_addrs = 0;
446 goto probe_interrupts; 452 goto probe_interrupts;
447 } 453 }
448 454
449 if (len % sizeof(struct linux_prom_registers)) { 455 if (len % sizeof(struct linux_prom_registers)) {
450 prom_printf("UGH: proplen for %s was %d, need multiple of %d\n", 456 prom_printf("UGH: proplen for %s was %d, need multiple of %d\n",
451 dev->prom_name, len, 457 dev->prom_node->name, len,
452 (int)sizeof(struct linux_prom_registers)); 458 (int)sizeof(struct linux_prom_registers));
453 prom_halt(); 459 prom_halt();
454 } 460 }
@@ -466,7 +472,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
466 dev->resource[i].end = 472 dev->resource[i].end =
467 (dev->resource[i].start + (unsigned long)regs[i].reg_size - 1UL); 473 (dev->resource[i].start + (unsigned long)regs[i].reg_size - 1UL);
468 dev->resource[i].flags = IORESOURCE_MEM; 474 dev->resource[i].flags = IORESOURCE_MEM;
469 dev->resource[i].name = dev->prom_name; 475 dev->resource[i].name = dev->prom_node->name;
470 request_resource(&dev->bus->self->resource[n], 476 request_resource(&dev->bus->self->resource[n],
471 &dev->resource[i]); 477 &dev->resource[i]);
472 } 478 }
@@ -475,8 +481,8 @@ probe_interrupts:
475 for (i = 0; i < PROMINTR_MAX; i++) 481 for (i = 0; i < PROMINTR_MAX; i++)
476 dev->irqs[i] = PCI_IRQ_NONE; 482 dev->irqs[i] = PCI_IRQ_NONE;
477 483
478 len = prom_getproperty(node, "interrupts", (char *)&irqs, sizeof(irqs)); 484 irqs = of_get_property(dp, "interrupts", &len);
479 if ((len == -1) || (len == 0)) { 485 if (!irqs) {
480 dev->num_irqs = 0; 486 dev->num_irqs = 0;
481 } else { 487 } else {
482 dev->num_irqs = len / sizeof(irqs[0]); 488 dev->num_irqs = len / sizeof(irqs[0]);
@@ -497,7 +503,8 @@ probe_interrupts:
497 } 503 }
498 } 504 }
499 505
500 if ((node = prom_getchild(node))) { 506 dp = dp->child;
507 if (dp) {
501 printk(" ->"); 508 printk(" ->");
502 dev->children = ebus_alloc(sizeof(struct linux_ebus_child)); 509 dev->children = ebus_alloc(sizeof(struct linux_ebus_child));
503 510
@@ -505,18 +512,18 @@ probe_interrupts:
505 child->next = NULL; 512 child->next = NULL;
506 child->parent = dev; 513 child->parent = dev;
507 child->bus = dev->bus; 514 child->bus = dev->bus;
508 fill_ebus_child(node, &regs[0], 515 fill_ebus_child(dp, regs, child,
509 child, child_regs_nonstandard(dev)); 516 child_regs_nonstandard(dev));
510 517
511 while ((node = prom_getsibling(node)) != 0) { 518 while ((dp = dp->sibling) != NULL) {
512 child->next = ebus_alloc(sizeof(struct linux_ebus_child)); 519 child->next = ebus_alloc(sizeof(struct linux_ebus_child));
513 520
514 child = child->next; 521 child = child->next;
515 child->next = NULL; 522 child->next = NULL;
516 child->parent = dev; 523 child->parent = dev;
517 child->bus = dev->bus; 524 child->bus = dev->bus;
518 fill_ebus_child(node, &regs[0], 525 fill_ebus_child(dp, regs, child,
519 child, child_regs_nonstandard(dev)); 526 child_regs_nonstandard(dev));
520 } 527 }
521 } 528 }
522 printk("]"); 529 printk("]");
@@ -543,7 +550,8 @@ void __init ebus_init(void)
543 struct linux_ebus *ebus; 550 struct linux_ebus *ebus;
544 struct pci_dev *pdev; 551 struct pci_dev *pdev;
545 struct pcidev_cookie *cookie; 552 struct pcidev_cookie *cookie;
546 int nd, ebusnd, is_rio; 553 struct device_node *dp;
554 int is_rio;
547 int num_ebus = 0; 555 int num_ebus = 0;
548 556
549 pdev = find_next_ebus(NULL, &is_rio); 557 pdev = find_next_ebus(NULL, &is_rio);
@@ -553,20 +561,22 @@ void __init ebus_init(void)
553 } 561 }
554 562
555 cookie = pdev->sysdata; 563 cookie = pdev->sysdata;
556 ebusnd = cookie->prom_node->node; 564 dp = cookie->prom_node;
557 565
558 ebus_chain = ebus = ebus_alloc(sizeof(struct linux_ebus)); 566 ebus_chain = ebus = ebus_alloc(sizeof(struct linux_ebus));
559 ebus->next = NULL; 567 ebus->next = NULL;
560 ebus->is_rio = is_rio; 568 ebus->is_rio = is_rio;
561 569
562 while (ebusnd) { 570 while (dp) {
571 struct device_node *child;
572
563 /* SUNW,pci-qfe uses four empty ebuses on it. 573 /* SUNW,pci-qfe uses four empty ebuses on it.
564 I think we should not consider them here, 574 I think we should not consider them here,
565 as they have half of the properties this 575 as they have half of the properties this
566 code expects and once we do PCI hot-plug, 576 code expects and once we do PCI hot-plug,
567 we'd have to tweak with the ebus_chain 577 we'd have to tweak with the ebus_chain
568 in the runtime after initialization. -jj */ 578 in the runtime after initialization. -jj */
569 if (!prom_getchild (ebusnd)) { 579 if (!dp->child) {
570 pdev = find_next_ebus(pdev, &is_rio); 580 pdev = find_next_ebus(pdev, &is_rio);
571 if (!pdev) { 581 if (!pdev) {
572 if (ebus == ebus_chain) { 582 if (ebus == ebus_chain) {
@@ -578,22 +588,21 @@ void __init ebus_init(void)
578 } 588 }
579 ebus->is_rio = is_rio; 589 ebus->is_rio = is_rio;
580 cookie = pdev->sysdata; 590 cookie = pdev->sysdata;
581 ebusnd = cookie->prom_node->node; 591 dp = cookie->prom_node;
582 continue; 592 continue;
583 } 593 }
584 printk("ebus%d:", num_ebus); 594 printk("ebus%d:", num_ebus);
585 595
586 prom_getstring(ebusnd, "name", ebus->prom_name, sizeof(ebus->prom_name));
587 ebus->index = num_ebus; 596 ebus->index = num_ebus;
588 ebus->prom_node = ebusnd; 597 ebus->prom_node = dp;
589 ebus->self = pdev; 598 ebus->self = pdev;
590 ebus->parent = pbm = cookie->pbm; 599 ebus->parent = pbm = cookie->pbm;
591 600
592 ebus_ranges_init(ebus); 601 ebus_ranges_init(ebus);
593 ebus_intmap_init(ebus); 602 ebus_intmap_init(ebus);
594 603
595 nd = prom_getchild(ebusnd); 604 child = dp->child;
596 if (!nd) 605 if (!child)
597 goto next_ebus; 606 goto next_ebus;
598 607
599 ebus->devices = ebus_alloc(sizeof(struct linux_ebus_device)); 608 ebus->devices = ebus_alloc(sizeof(struct linux_ebus_device));
@@ -602,16 +611,16 @@ void __init ebus_init(void)
602 dev->next = NULL; 611 dev->next = NULL;
603 dev->children = NULL; 612 dev->children = NULL;
604 dev->bus = ebus; 613 dev->bus = ebus;
605 fill_ebus_device(nd, dev); 614 fill_ebus_device(child, dev);
606 615
607 while ((nd = prom_getsibling(nd)) != 0) { 616 while ((child = child->sibling) != NULL) {
608 dev->next = ebus_alloc(sizeof(struct linux_ebus_device)); 617 dev->next = ebus_alloc(sizeof(struct linux_ebus_device));
609 618
610 dev = dev->next; 619 dev = dev->next;
611 dev->next = NULL; 620 dev->next = NULL;
612 dev->children = NULL; 621 dev->children = NULL;
613 dev->bus = ebus; 622 dev->bus = ebus;
614 fill_ebus_device(nd, dev); 623 fill_ebus_device(child, dev);
615 } 624 }
616 625
617 next_ebus: 626 next_ebus:
@@ -622,7 +631,7 @@ void __init ebus_init(void)
622 break; 631 break;
623 632
624 cookie = pdev->sysdata; 633 cookie = pdev->sysdata;
625 ebusnd = cookie->prom_node->node; 634 dp = cookie->prom_node;
626 635
627 ebus->next = ebus_alloc(sizeof(struct linux_ebus)); 636 ebus->next = ebus_alloc(sizeof(struct linux_ebus));
628 ebus = ebus->next; 637 ebus = ebus->next;
diff --git a/arch/sparc64/kernel/isa.c b/arch/sparc64/kernel/isa.c
index ae02c3820eab..8c8c5a491ad6 100644
--- a/arch/sparc64/kernel/isa.c
+++ b/arch/sparc64/kernel/isa.c
@@ -15,23 +15,19 @@ static void __init fatal_err(const char *reason)
15static void __init report_dev(struct sparc_isa_device *isa_dev, int child) 15static void __init report_dev(struct sparc_isa_device *isa_dev, int child)
16{ 16{
17 if (child) 17 if (child)
18 printk(" (%s)", isa_dev->prom_name); 18 printk(" (%s)", isa_dev->prom_node->name);
19 else 19 else
20 printk(" [%s", isa_dev->prom_name); 20 printk(" [%s", isa_dev->prom_node->name);
21} 21}
22 22
23static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev, 23static struct linux_prom_registers * __init
24 struct linux_prom_registers *pregs, 24isa_dev_get_resource(struct sparc_isa_device *isa_dev)
25 int pregs_size)
26{ 25{
26 struct linux_prom_registers *pregs;
27 unsigned long base, len; 27 unsigned long base, len;
28 int prop_len; 28 int prop_len;
29 29
30 prop_len = prom_getproperty(isa_dev->prom_node, "reg", 30 pregs = of_get_property(isa_dev->prom_node, "reg", &prop_len);
31 (char *) pregs, pregs_size);
32
33 if (prop_len <= 0)
34 return;
35 31
36 /* Only the first one is interesting. */ 32 /* Only the first one is interesting. */
37 len = pregs[0].reg_size; 33 len = pregs[0].reg_size;
@@ -42,10 +38,12 @@ static void __init isa_dev_get_resource(struct sparc_isa_device *isa_dev,
42 isa_dev->resource.start = base; 38 isa_dev->resource.start = base;
43 isa_dev->resource.end = (base + len - 1UL); 39 isa_dev->resource.end = (base + len - 1UL);
44 isa_dev->resource.flags = IORESOURCE_IO; 40 isa_dev->resource.flags = IORESOURCE_IO;
45 isa_dev->resource.name = isa_dev->prom_name; 41 isa_dev->resource.name = isa_dev->prom_node->name;
46 42
47 request_resource(&isa_dev->bus->parent->io_space, 43 request_resource(&isa_dev->bus->parent->io_space,
48 &isa_dev->resource); 44 &isa_dev->resource);
45
46 return pregs;
49} 47}
50 48
51/* I can't believe they didn't put a real INO in the isa device 49/* I can't believe they didn't put a real INO in the isa device
@@ -98,8 +96,8 @@ static void __init isa_dev_get_irq(struct sparc_isa_device *isa_dev,
98{ 96{
99 int irq_prop; 97 int irq_prop;
100 98
101 irq_prop = prom_getintdefault(isa_dev->prom_node, 99 irq_prop = of_getintprop_default(isa_dev->prom_node,
102 "interrupts", -1); 100 "interrupts", -1);
103 if (irq_prop <= 0) { 101 if (irq_prop <= 0) {
104 goto no_irq; 102 goto no_irq;
105 } else { 103 } else {
@@ -141,16 +139,15 @@ no_irq:
141 139
142static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev) 140static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev)
143{ 141{
144 int node = prom_getchild(parent_isa_dev->prom_node); 142 struct device_node *dp = parent_isa_dev->prom_node->child;
145 143
146 if (node == 0) 144 if (!dp)
147 return; 145 return;
148 146
149 printk(" ->"); 147 printk(" ->");
150 while (node != 0) { 148 while (dp) {
151 struct linux_prom_registers regs[PROMREG_MAX]; 149 struct linux_prom_registers *regs;
152 struct sparc_isa_device *isa_dev; 150 struct sparc_isa_device *isa_dev;
153 int prop_len;
154 151
155 isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); 152 isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL);
156 if (!isa_dev) { 153 if (!isa_dev) {
@@ -165,40 +162,24 @@ static void __init isa_fill_children(struct sparc_isa_device *parent_isa_dev)
165 parent_isa_dev->child = isa_dev; 162 parent_isa_dev->child = isa_dev;
166 163
167 isa_dev->bus = parent_isa_dev->bus; 164 isa_dev->bus = parent_isa_dev->bus;
168 isa_dev->prom_node = node; 165 isa_dev->prom_node = dp;
169 prop_len = prom_getproperty(node, "name",
170 (char *) isa_dev->prom_name,
171 sizeof(isa_dev->prom_name));
172 if (prop_len <= 0) {
173 fatal_err("cannot get child isa_dev OBP node name");
174 prom_halt();
175 }
176
177 prop_len = prom_getproperty(node, "compatible",
178 (char *) isa_dev->compatible,
179 sizeof(isa_dev->compatible));
180 166
181 /* Not having this is OK. */ 167 regs = isa_dev_get_resource(isa_dev);
182 if (prop_len <= 0)
183 isa_dev->compatible[0] = '\0';
184
185 isa_dev_get_resource(isa_dev, regs, sizeof(regs));
186 isa_dev_get_irq(isa_dev, regs); 168 isa_dev_get_irq(isa_dev, regs);
187 169
188 report_dev(isa_dev, 1); 170 report_dev(isa_dev, 1);
189 171
190 node = prom_getsibling(node); 172 dp = dp->sibling;
191 } 173 }
192} 174}
193 175
194static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br) 176static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
195{ 177{
196 int node = prom_getchild(isa_br->prom_node); 178 struct device_node *dp = isa_br->prom_node->child;
197 179
198 while (node != 0) { 180 while (dp) {
199 struct linux_prom_registers regs[PROMREG_MAX]; 181 struct linux_prom_registers *regs;
200 struct sparc_isa_device *isa_dev; 182 struct sparc_isa_device *isa_dev;
201 int prop_len;
202 183
203 isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL); 184 isa_dev = kmalloc(sizeof(*isa_dev), GFP_KERNEL);
204 if (!isa_dev) { 185 if (!isa_dev) {
@@ -222,24 +203,9 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
222 } 203 }
223 204
224 isa_dev->bus = isa_br; 205 isa_dev->bus = isa_br;
225 isa_dev->prom_node = node; 206 isa_dev->prom_node = dp;
226 prop_len = prom_getproperty(node, "name",
227 (char *) isa_dev->prom_name,
228 sizeof(isa_dev->prom_name));
229 if (prop_len <= 0) {
230 fatal_err("cannot get isa_dev OBP node name");
231 prom_halt();
232 }
233
234 prop_len = prom_getproperty(node, "compatible",
235 (char *) isa_dev->compatible,
236 sizeof(isa_dev->compatible));
237
238 /* Not having this is OK. */
239 if (prop_len <= 0)
240 isa_dev->compatible[0] = '\0';
241 207
242 isa_dev_get_resource(isa_dev, regs, sizeof(regs)); 208 regs = isa_dev_get_resource(isa_dev);
243 isa_dev_get_irq(isa_dev, regs); 209 isa_dev_get_irq(isa_dev, regs);
244 210
245 report_dev(isa_dev, 0); 211 report_dev(isa_dev, 0);
@@ -248,10 +214,40 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
248 214
249 printk("]"); 215 printk("]");
250 216
251 node = prom_getsibling(node); 217 dp = dp->sibling;
252 } 218 }
253} 219}
254 220
221static void __init get_bridge_props(struct sparc_isa_bridge *isa_br)
222{
223 struct device_node *dp = isa_br->prom_node;
224 void *pval;
225 int len;
226
227 pval = of_get_property(dp, "ranges", &len);
228 if (pval) {
229 memcpy(isa_br->isa_ranges, pval, len);
230 isa_br->num_isa_ranges =
231 len / sizeof(struct linux_prom_isa_ranges);
232 } else {
233 isa_br->num_isa_ranges = 0;
234 }
235
236 pval = of_get_property(dp, "interrupt-map", &len);
237 if (pval) {
238 memcpy(isa_br->isa_intmap, pval, len);
239 isa_br->num_isa_intmap =
240 (len / sizeof(struct linux_prom_isa_intmap));
241 } else {
242 isa_br->num_isa_intmap = 0;
243 }
244
245 pval = of_get_property(dp, "interrupt-map-mask", &len);
246 if (pval)
247 memcpy(&isa_br->isa_intmask, pval,
248 sizeof(isa_br->isa_intmask));
249}
250
255void __init isa_init(void) 251void __init isa_init(void)
256{ 252{
257 struct pci_dev *pdev; 253 struct pci_dev *pdev;
@@ -266,7 +262,6 @@ void __init isa_init(void)
266 struct pcidev_cookie *pdev_cookie; 262 struct pcidev_cookie *pdev_cookie;
267 struct pci_pbm_info *pbm; 263 struct pci_pbm_info *pbm;
268 struct sparc_isa_bridge *isa_br; 264 struct sparc_isa_bridge *isa_br;
269 int prop_len;
270 265
271 pdev_cookie = pdev->sysdata; 266 pdev_cookie = pdev->sysdata;
272 if (!pdev_cookie) { 267 if (!pdev_cookie) {
@@ -291,34 +286,9 @@ void __init isa_init(void)
291 isa_br->parent = pbm; 286 isa_br->parent = pbm;
292 isa_br->self = pdev; 287 isa_br->self = pdev;
293 isa_br->index = index++; 288 isa_br->index = index++;
294 isa_br->prom_node = pdev_cookie->prom_node->node; 289 isa_br->prom_node = pdev_cookie->prom_node;
295 strncpy(isa_br->prom_name, pdev_cookie->prom_node->name, 290
296 sizeof(isa_br->prom_name)); 291 get_bridge_props(isa_br);
297
298 prop_len = prom_getproperty(isa_br->prom_node,
299 "ranges",
300 (char *) isa_br->isa_ranges,
301 sizeof(isa_br->isa_ranges));
302 if (prop_len <= 0)
303 isa_br->num_isa_ranges = 0;
304 else
305 isa_br->num_isa_ranges =
306 (prop_len / sizeof(struct linux_prom_isa_ranges));
307
308 prop_len = prom_getproperty(isa_br->prom_node,
309 "interrupt-map",
310 (char *) isa_br->isa_intmap,
311 sizeof(isa_br->isa_intmap));
312 if (prop_len <= 0)
313 isa_br->num_isa_intmap = 0;
314 else
315 isa_br->num_isa_intmap =
316 (prop_len / sizeof(struct linux_prom_isa_intmap));
317
318 prop_len = prom_getproperty(isa_br->prom_node,
319 "interrupt-map-mask",
320 (char *) &(isa_br->isa_intmask),
321 sizeof(isa_br->isa_intmask));
322 292
323 printk("isa%d:", isa_br->index); 293 printk("isa%d:", isa_br->index);
324 294
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 30bcaf58e3ab..75159a7843f1 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -105,24 +105,24 @@ again:
105 return 0; 105 return 0;
106} 106}
107 107
108static int __init has_button_interrupt(unsigned int irq, int prom_node) 108static int __init has_button_interrupt(unsigned int irq, struct device_node *dp)
109{ 109{
110 if (irq == PCI_IRQ_NONE) 110 if (irq == PCI_IRQ_NONE)
111 return 0; 111 return 0;
112 if (!prom_node_has_property(prom_node, "button")) 112 if (!of_find_property(dp, "button", NULL))
113 return 0; 113 return 0;
114 114
115 return 1; 115 return 1;
116} 116}
117 117
118static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p, int *prom_node_p) 118static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p, struct device_node **prom_node_p)
119{ 119{
120 struct linux_ebus *ebus; 120 struct linux_ebus *ebus;
121 struct linux_ebus_device *edev; 121 struct linux_ebus_device *edev;
122 122
123 for_each_ebus(ebus) { 123 for_each_ebus(ebus) {
124 for_each_ebusdev(edev, ebus) { 124 for_each_ebusdev(edev, ebus) {
125 if (!strcmp(edev->prom_name, "power")) { 125 if (!strcmp(edev->prom_node->name, "power")) {
126 *resp = &edev->resource[0]; 126 *resp = &edev->resource[0];
127 *irq_p = edev->irqs[0]; 127 *irq_p = edev->irqs[0];
128 *prom_node_p = edev->prom_node; 128 *prom_node_p = edev->prom_node;
@@ -133,14 +133,14 @@ static int __init power_probe_ebus(struct resource **resp, unsigned int *irq_p,
133 return -ENODEV; 133 return -ENODEV;
134} 134}
135 135
136static int __init power_probe_isa(struct resource **resp, unsigned int *irq_p, int *prom_node_p) 136static int __init power_probe_isa(struct resource **resp, unsigned int *irq_p, struct device_node **prom_node_p)
137{ 137{
138 struct sparc_isa_bridge *isa_bus; 138 struct sparc_isa_bridge *isa_bus;
139 struct sparc_isa_device *isa_dev; 139 struct sparc_isa_device *isa_dev;
140 140
141 for_each_isa(isa_bus) { 141 for_each_isa(isa_bus) {
142 for_each_isadev(isa_dev, isa_bus) { 142 for_each_isadev(isa_dev, isa_bus) {
143 if (!strcmp(isa_dev->prom_name, "power")) { 143 if (!strcmp(isa_dev->prom_node->name, "power")) {
144 *resp = &isa_dev->resource; 144 *resp = &isa_dev->resource;
145 *irq_p = isa_dev->irq; 145 *irq_p = isa_dev->irq;
146 *prom_node_p = isa_dev->prom_node; 146 *prom_node_p = isa_dev->prom_node;
@@ -155,17 +155,17 @@ void __init power_init(void)
155{ 155{
156 struct resource *res = NULL; 156 struct resource *res = NULL;
157 unsigned int irq; 157 unsigned int irq;
158 int prom_node; 158 struct device_node *dp;
159 static int invoked; 159 static int invoked;
160 160
161 if (invoked) 161 if (invoked)
162 return; 162 return;
163 invoked = 1; 163 invoked = 1;
164 164
165 if (!power_probe_ebus(&res, &irq, &prom_node)) 165 if (!power_probe_ebus(&res, &irq, &dp))
166 goto found; 166 goto found;
167 167
168 if (!power_probe_isa(&res, &irq, &prom_node)) 168 if (!power_probe_isa(&res, &irq, &dp))
169 goto found; 169 goto found;
170 170
171 return; 171 return;
@@ -174,7 +174,7 @@ found:
174 power_reg = ioremap(res->start, 0x4); 174 power_reg = ioremap(res->start, 0x4);
175 printk("power: Control reg at %p ... ", power_reg); 175 printk("power: Control reg at %p ... ", power_reg);
176 poweroff_method = machine_halt; /* able to use the standard halt */ 176 poweroff_method = machine_halt; /* able to use the standard halt */
177 if (has_button_interrupt(irq, prom_node)) { 177 if (has_button_interrupt(irq, dp)) {
178 if (kernel_thread(powerd, NULL, CLONE_FS) < 0) { 178 if (kernel_thread(powerd, NULL, CLONE_FS) < 0) {
179 printk("Failed to start power daemon.\n"); 179 printk("Failed to start power daemon.\n");
180 return; 180 return;
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index fb112c3c0485..7809100034b0 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -63,6 +63,7 @@ struct device_node *of_find_node_by_path(const char *path)
63 63
64 return np; 64 return np;
65} 65}
66EXPORT_SYMBOL(of_find_node_by_path);
66 67
67struct device_node *of_find_node_by_phandle(phandle handle) 68struct device_node *of_find_node_by_phandle(phandle handle)
68{ 69{
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index aa5438a4fd50..d072b8632ccd 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -756,24 +756,200 @@ retry:
756 return -EOPNOTSUPP; 756 return -EOPNOTSUPP;
757} 757}
758 758
759void __init clock_probe(void) 759static int __init clock_model_matches(char *model)
760{
761 if (strcmp(model, "mk48t02") &&
762 strcmp(model, "mk48t08") &&
763 strcmp(model, "mk48t59") &&
764 strcmp(model, "m5819") &&
765 strcmp(model, "m5819p") &&
766 strcmp(model, "m5823") &&
767 strcmp(model, "ds1287"))
768 return 0;
769
770 return 1;
771}
772
773static void __init __clock_assign_common(void __iomem *addr, char *model)
774{
775 if (model[5] == '0' && model[6] == '2') {
776 mstk48t02_regs = addr;
777 } else if(model[5] == '0' && model[6] == '8') {
778 mstk48t08_regs = addr;
779 mstk48t02_regs = mstk48t08_regs + MOSTEK_48T08_48T02;
780 } else {
781 mstk48t59_regs = addr;
782 mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
783 }
784}
785
786static void __init clock_assign_clk_reg(struct linux_prom_registers *clk_reg,
787 char *model)
788{
789 unsigned long addr;
790
791 addr = ((unsigned long) clk_reg[0].phys_addr |
792 (((unsigned long) clk_reg[0].which_io) << 32UL));
793
794 __clock_assign_common((void __iomem *) addr, model);
795}
796
797static int __init clock_probe_central(void)
760{ 798{
761 struct linux_prom_registers clk_reg[2]; 799 struct linux_prom_registers clk_reg[2];
762 char model[128]; 800 char model[64];
763 int node, busnd = -1, err; 801 int node;
764 unsigned long flags; 802
765 struct linux_central *cbus; 803 if (!central_bus)
804 return 0;
805
806 /* Get Central FHC's prom node. */
807 node = central_bus->child->prom_node;
808
809 /* Then get the first child device below it. */
810 node = prom_getchild(node);
811
812 while (node) {
813 prom_getstring(node, "model", model, sizeof(model));
814 if (!clock_model_matches(model))
815 goto next_sibling;
816
817 prom_getproperty(node, "reg", (char *)clk_reg,
818 sizeof(clk_reg));
819
820 apply_fhc_ranges(central_bus->child, clk_reg, 1);
821 apply_central_ranges(central_bus, clk_reg, 1);
822
823 clock_assign_clk_reg(clk_reg, model);
824 return 1;
825
826 next_sibling:
827 node = prom_getsibling(node);
828 }
829
830 return 0;
831}
832
766#ifdef CONFIG_PCI 833#ifdef CONFIG_PCI
767 struct linux_ebus *ebus = NULL; 834static void __init clock_isa_ebus_assign_regs(struct resource *res, char *model)
768 struct sparc_isa_bridge *isa_br = NULL; 835{
836 if (!strcmp(model, "ds1287") ||
837 !strcmp(model, "m5819") ||
838 !strcmp(model, "m5819p") ||
839 !strcmp(model, "m5823")) {
840 ds1287_regs = res->start;
841 } else {
842 mstk48t59_regs = (void __iomem *) res->start;
843 mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
844 }
845}
846
847static int __init clock_probe_one_ebus_dev(struct linux_ebus_device *edev)
848{
849 struct device_node *dp = edev->prom_node;
850 char *model;
851
852 model = of_get_property(dp, "model", NULL);
853 if (!clock_model_matches(model))
854 return 0;
855
856 clock_isa_ebus_assign_regs(&edev->resource[0], model);
857
858 return 1;
859}
860
861static int __init clock_probe_ebus(void)
862{
863 struct linux_ebus *ebus;
864
865 for_each_ebus(ebus) {
866 struct linux_ebus_device *edev;
867
868 for_each_ebusdev(edev, ebus) {
869 if (clock_probe_one_ebus_dev(edev))
870 return 1;
871 }
872 }
873
874 return 0;
875}
876
877static int __init clock_probe_one_isa_dev(struct sparc_isa_device *idev)
878{
879 struct device_node *dp = idev->prom_node;
880 char *model;
881
882 model = of_get_property(dp, "model", NULL);
883 if (!clock_model_matches(model))
884 return 0;
885
886 clock_isa_ebus_assign_regs(&idev->resource, model);
887
888 return 1;
889}
890
891static int __init clock_probe_isa(void)
892{
893 struct sparc_isa_bridge *isa_br;
894
895 for_each_isa(isa_br) {
896 struct sparc_isa_device *isa_dev;
897
898 for_each_isadev(isa_dev, isa_br) {
899 if (clock_probe_one_isa_dev(isa_dev))
900 return 1;
901 }
902 }
903
904 return 0;
905}
906#endif /* CONFIG_PCI */
907
908#ifdef CONFIG_SBUS
909static int __init clock_probe_one_sbus_dev(struct sbus_bus *sbus, struct sbus_dev *sdev)
910{
911 struct resource *res;
912 char model[64];
913 void __iomem *addr;
914
915 prom_getstring(sdev->prom_node, "model", model, sizeof(model));
916 if (!clock_model_matches(model))
917 return 0;
918
919 res = &sdev->resource[0];
920 addr = sbus_ioremap(res, 0, 0x800UL, "eeprom");
921
922 __clock_assign_common(addr, model);
923
924 return 1;
925}
926
927static int __init clock_probe_sbus(void)
928{
929 struct sbus_bus *sbus;
930
931 for_each_sbus(sbus) {
932 struct sbus_dev *sdev;
933
934 for_each_sbusdev(sdev, sbus) {
935 if (clock_probe_one_sbus_dev(sbus, sdev))
936 return 1;
937 }
938 }
939
940 return 0;
941}
769#endif 942#endif
943
944void __init clock_probe(void)
945{
770 static int invoked; 946 static int invoked;
947 unsigned long flags;
771 948
772 if (invoked) 949 if (invoked)
773 return; 950 return;
774 invoked = 1; 951 invoked = 1;
775 952
776
777 if (this_is_starfire) { 953 if (this_is_starfire) {
778 xtime.tv_sec = starfire_get_time(); 954 xtime.tv_sec = starfire_get_time();
779 xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); 955 xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
@@ -789,183 +965,27 @@ void __init clock_probe(void)
789 return; 965 return;
790 } 966 }
791 967
792 local_irq_save(flags);
793
794 cbus = central_bus;
795 if (cbus != NULL)
796 busnd = central_bus->child->prom_node;
797
798 /* Check FHC Central then EBUSs then ISA bridges then SBUSs. 968 /* Check FHC Central then EBUSs then ISA bridges then SBUSs.
799 * That way we handle the presence of multiple properly. 969 * That way we handle the presence of multiple properly.
800 * 970 *
801 * As a special case, machines with Central must provide the 971 * As a special case, machines with Central must provide the
802 * timer chip there. 972 * timer chip there.
803 */ 973 */
974 if (!clock_probe_central() &&
804#ifdef CONFIG_PCI 975#ifdef CONFIG_PCI
805 if (ebus_chain != NULL) { 976 !clock_probe_ebus() &&
806 ebus = ebus_chain; 977 !clock_probe_isa() &&
807 if (busnd == -1)
808 busnd = ebus->prom_node;
809 }
810 if (isa_chain != NULL) {
811 isa_br = isa_chain;
812 if (busnd == -1)
813 busnd = isa_br->prom_node;
814 }
815#endif
816 if (sbus_root != NULL && busnd == -1)
817 busnd = sbus_root->prom_node;
818
819 if (busnd == -1) {
820 prom_printf("clock_probe: problem, cannot find bus to search.\n");
821 prom_halt();
822 }
823
824 node = prom_getchild(busnd);
825
826 while (1) {
827 if (!node)
828 model[0] = 0;
829 else
830 prom_getstring(node, "model", model, sizeof(model));
831 if (strcmp(model, "mk48t02") &&
832 strcmp(model, "mk48t08") &&
833 strcmp(model, "mk48t59") &&
834 strcmp(model, "m5819") &&
835 strcmp(model, "m5819p") &&
836 strcmp(model, "m5823") &&
837 strcmp(model, "ds1287")) {
838 if (cbus != NULL) {
839 prom_printf("clock_probe: Central bus lacks timer chip.\n");
840 prom_halt();
841 }
842
843 if (node != 0)
844 node = prom_getsibling(node);
845#ifdef CONFIG_PCI
846 while ((node == 0) && ebus != NULL) {
847 ebus = ebus->next;
848 if (ebus != NULL) {
849 busnd = ebus->prom_node;
850 node = prom_getchild(busnd);
851 }
852 }
853 while ((node == 0) && isa_br != NULL) {
854 isa_br = isa_br->next;
855 if (isa_br != NULL) {
856 busnd = isa_br->prom_node;
857 node = prom_getchild(busnd);
858 }
859 }
860#endif 978#endif
861 if (node == 0) { 979#ifdef CONFIG_SBUS
862 prom_printf("clock_probe: Cannot find timer chip\n"); 980 !clock_probe_sbus()
863 prom_halt();
864 }
865 continue;
866 }
867
868 err = prom_getproperty(node, "reg", (char *)clk_reg,
869 sizeof(clk_reg));
870 if(err == -1) {
871 prom_printf("clock_probe: Cannot get Mostek reg property\n");
872 prom_halt();
873 }
874
875 if (cbus != NULL) {
876 apply_fhc_ranges(central_bus->child, clk_reg, 1);
877 apply_central_ranges(central_bus, clk_reg, 1);
878 }
879#ifdef CONFIG_PCI
880 else if (ebus != NULL) {
881 struct linux_ebus_device *edev;
882
883 for_each_ebusdev(edev, ebus)
884 if (edev->prom_node == node)
885 break;
886 if (edev == NULL) {
887 if (isa_chain != NULL)
888 goto try_isa_clock;
889 prom_printf("%s: Mostek not probed by EBUS\n",
890 __FUNCTION__);
891 prom_halt();
892 }
893
894 if (!strcmp(model, "ds1287") ||
895 !strcmp(model, "m5819") ||
896 !strcmp(model, "m5819p") ||
897 !strcmp(model, "m5823")) {
898 ds1287_regs = edev->resource[0].start;
899 } else {
900 mstk48t59_regs = (void __iomem *)
901 edev->resource[0].start;
902 mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
903 }
904 break;
905 }
906 else if (isa_br != NULL) {
907 struct sparc_isa_device *isadev;
908
909try_isa_clock:
910 for_each_isadev(isadev, isa_br)
911 if (isadev->prom_node == node)
912 break;
913 if (isadev == NULL) {
914 prom_printf("%s: Mostek not probed by ISA\n");
915 prom_halt();
916 }
917 if (!strcmp(model, "ds1287") ||
918 !strcmp(model, "m5819") ||
919 !strcmp(model, "m5819p") ||
920 !strcmp(model, "m5823")) {
921 ds1287_regs = isadev->resource.start;
922 } else {
923 mstk48t59_regs = (void __iomem *)
924 isadev->resource.start;
925 mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
926 }
927 break;
928 }
929#endif 981#endif
930 else { 982 ) {
931 if (sbus_root->num_sbus_ranges) { 983 printk(KERN_WARNING "No clock chip found.\n");
932 int nranges = sbus_root->num_sbus_ranges; 984 return;
933 int rngc;
934
935 for (rngc = 0; rngc < nranges; rngc++)
936 if (clk_reg[0].which_io ==
937 sbus_root->sbus_ranges[rngc].ot_child_space)
938 break;
939 if (rngc == nranges) {
940 prom_printf("clock_probe: Cannot find ranges for "
941 "clock regs.\n");
942 prom_halt();
943 }
944 clk_reg[0].which_io =
945 sbus_root->sbus_ranges[rngc].ot_parent_space;
946 clk_reg[0].phys_addr +=
947 sbus_root->sbus_ranges[rngc].ot_parent_base;
948 }
949 }
950
951 if(model[5] == '0' && model[6] == '2') {
952 mstk48t02_regs = (void __iomem *)
953 (((u64)clk_reg[0].phys_addr) |
954 (((u64)clk_reg[0].which_io)<<32UL));
955 } else if(model[5] == '0' && model[6] == '8') {
956 mstk48t08_regs = (void __iomem *)
957 (((u64)clk_reg[0].phys_addr) |
958 (((u64)clk_reg[0].which_io)<<32UL));
959 mstk48t02_regs = mstk48t08_regs + MOSTEK_48T08_48T02;
960 } else {
961 mstk48t59_regs = (void __iomem *)
962 (((u64)clk_reg[0].phys_addr) |
963 (((u64)clk_reg[0].which_io)<<32UL));
964 mstk48t02_regs = mstk48t59_regs + MOSTEK_48T59_48T02;
965 }
966 break;
967 } 985 }
968 986
987 local_irq_save(flags);
988
969 if (mstk48t02_regs != NULL) { 989 if (mstk48t02_regs != NULL) {
970 /* Report a low battery voltage condition. */ 990 /* Report a low battery voltage condition. */
971 if (has_low_battery()) 991 if (has_low_battery())
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index f6686fcce809..0897b0c8d528 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -928,7 +928,7 @@ static int __init rtc_init(void)
928#ifdef __sparc__ 928#ifdef __sparc__
929 for_each_ebus(ebus) { 929 for_each_ebus(ebus) {
930 for_each_ebusdev(edev, ebus) { 930 for_each_ebusdev(edev, ebus) {
931 if(strcmp(edev->prom_name, "rtc") == 0) { 931 if(strcmp(edev->prom_node->name, "rtc") == 0) {
932 rtc_port = edev->resource[0].start; 932 rtc_port = edev->resource[0].start;
933 rtc_irq = edev->irqs[0]; 933 rtc_irq = edev->irqs[0];
934 goto found; 934 goto found;
@@ -938,7 +938,7 @@ static int __init rtc_init(void)
938#ifdef __sparc_v9__ 938#ifdef __sparc_v9__
939 for_each_isa(isa_br) { 939 for_each_isa(isa_br) {
940 for_each_isadev(isa_dev, isa_br) { 940 for_each_isadev(isa_dev, isa_br) {
941 if (strcmp(isa_dev->prom_name, "rtc") == 0) { 941 if (strcmp(isa_dev->prom_node->name, "rtc") == 0) {
942 rtc_port = isa_dev->resource.start; 942 rtc_port = isa_dev->resource.start;
943 rtc_irq = isa_dev->irq; 943 rtc_irq = isa_dev->irq;
944 goto found; 944 goto found;
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index f0fd2c4740f1..ed95dc9420dd 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -199,7 +199,7 @@ static int __init sparcspkr_init(void)
199 199
200 for_each_ebus(ebus) { 200 for_each_ebus(ebus) {
201 for_each_ebusdev(edev, ebus) { 201 for_each_ebusdev(edev, ebus) {
202 if (!strcmp(edev->prom_name, "beep")) { 202 if (!strcmp(edev->prom_node->name, "beep")) {
203 beep_name = "Sparc EBUS Speaker"; 203 beep_name = "Sparc EBUS Speaker";
204 beep_event = ebus_spkr_event; 204 beep_event = ebus_spkr_event;
205 beep_iobase = edev->resource[0].start; 205 beep_iobase = edev->resource[0].start;
@@ -213,7 +213,7 @@ static int __init sparcspkr_init(void)
213 /* A hack, the beep device's base lives in 213 /* A hack, the beep device's base lives in
214 * the DMA isa node. 214 * the DMA isa node.
215 */ 215 */
216 if (!strcmp(isa_dev->prom_name, "dma")) { 216 if (!strcmp(isa_dev->prom_node->name, "dma")) {
217 beep_name = "Sparc ISA Speaker"; 217 beep_name = "Sparc ISA Speaker";
218 beep_event = isa_spkr_event, 218 beep_event = isa_spkr_event,
219 beep_iobase = isa_dev->resource.start; 219 beep_iobase = isa_dev->resource.start;
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h
index ed9446f6d7e3..6d66351805a2 100644
--- a/drivers/input/serio/i8042-sparcio.h
+++ b/drivers/input/serio/i8042-sparcio.h
@@ -74,7 +74,7 @@ static int __init i8042_platform_init(void)
74 74
75 for_each_ebus(ebus) { 75 for_each_ebus(ebus) {
76 for_each_ebusdev(edev, ebus) { 76 for_each_ebusdev(edev, ebus) {
77 if (!strcmp(edev->prom_name, "8042")) 77 if (!strcmp(edev->prom_node->name, "8042"))
78 goto edev_found; 78 goto edev_found;
79 } 79 }
80 } 80 }
@@ -82,14 +82,14 @@ static int __init i8042_platform_init(void)
82 82
83 edev_found: 83 edev_found:
84 for_each_edevchild(edev, child) { 84 for_each_edevchild(edev, child) {
85 if (!strcmp(child->prom_name, OBP_PS2KBD_NAME1) || 85 if (!strcmp(child->prom_node->name, OBP_PS2KBD_NAME1) ||
86 !strcmp(child->prom_name, OBP_PS2KBD_NAME2)) { 86 !strcmp(child->prom_node->name, OBP_PS2KBD_NAME2)) {
87 i8042_kbd_irq = child->irqs[0]; 87 i8042_kbd_irq = child->irqs[0];
88 kbd_iobase = 88 kbd_iobase =
89 ioremap(child->resource[0].start, 8); 89 ioremap(child->resource[0].start, 8);
90 } 90 }
91 if (!strcmp(child->prom_name, OBP_PS2MS_NAME1) || 91 if (!strcmp(child->prom_node->name, OBP_PS2MS_NAME1) ||
92 !strcmp(child->prom_name, OBP_PS2MS_NAME2)) 92 !strcmp(child->prom_node->name, OBP_PS2MS_NAME2))
93 i8042_aux_irq = child->irqs[0]; 93 i8042_aux_irq = child->irqs[0];
94 } 94 }
95 if (i8042_kbd_irq == -1 || 95 if (i8042_kbd_irq == -1 ||
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c
index d89f83f769f5..1cc706e11119 100644
--- a/drivers/sbus/char/bbc_envctrl.c
+++ b/drivers/sbus/char/bbc_envctrl.c
@@ -575,9 +575,9 @@ int bbc_envctrl_init(void)
575 int devidx = 0; 575 int devidx = 0;
576 576
577 while ((echild = bbc_i2c_getdev(devidx++)) != NULL) { 577 while ((echild = bbc_i2c_getdev(devidx++)) != NULL) {
578 if (!strcmp(echild->prom_name, "temperature")) 578 if (!strcmp(echild->prom_node->name, "temperature"))
579 attach_one_temp(echild, temp_index++); 579 attach_one_temp(echild, temp_index++);
580 if (!strcmp(echild->prom_name, "fan-control")) 580 if (!strcmp(echild->prom_node->name, "fan-control"))
581 attach_one_fan(echild, fan_index++); 581 attach_one_fan(echild, fan_index++);
582 } 582 }
583 if (temp_index != 0 && fan_index != 0) { 583 if (temp_index != 0 && fan_index != 0) {
diff --git a/drivers/sbus/char/bbc_i2c.c b/drivers/sbus/char/bbc_i2c.c
index 3e156e005f2e..73634371393b 100644
--- a/drivers/sbus/char/bbc_i2c.c
+++ b/drivers/sbus/char/bbc_i2c.c
@@ -423,7 +423,7 @@ static int __init bbc_present(void)
423 423
424 for_each_ebus(ebus) { 424 for_each_ebus(ebus) {
425 for_each_ebusdev(edev, ebus) { 425 for_each_ebusdev(edev, ebus) {
426 if (!strcmp(edev->prom_name, "bbc")) 426 if (!strcmp(edev->prom_node->name, "bbc"))
427 return 1; 427 return 1;
428 } 428 }
429 } 429 }
@@ -446,7 +446,7 @@ static int __init bbc_i2c_init(void)
446 446
447 for_each_ebus(ebus) { 447 for_each_ebus(ebus) {
448 for_each_ebusdev(edev, ebus) { 448 for_each_ebusdev(edev, ebus) {
449 if (!strcmp(edev->prom_name, "i2c")) { 449 if (!strcmp(edev->prom_node->name, "i2c")) {
450 if (!attach_one_i2c(edev, index)) 450 if (!attach_one_i2c(edev, index))
451 index++; 451 index++;
452 } 452 }
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index c3a51d1fae5d..d92bc8827a9e 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -184,7 +184,7 @@ static int __init d7s_init(void)
184 184
185 for_each_ebus(ebus) { 185 for_each_ebus(ebus) {
186 for_each_ebusdev(edev, ebus) { 186 for_each_ebusdev(edev, ebus) {
187 if (!strcmp(edev->prom_name, D7S_OBPNAME)) 187 if (!strcmp(edev->prom_node->name, D7S_OBPNAME))
188 goto ebus_done; 188 goto ebus_done;
189 } 189 }
190 } 190 }
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 19e8eddf887a..cf97e9efe9b6 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -768,16 +768,14 @@ static void envctrl_set_mon(struct i2c_child_t *pchild,
768 * decoding tables, monitor type, optional properties. 768 * decoding tables, monitor type, optional properties.
769 * Return: None. 769 * Return: None.
770 */ 770 */
771static void envctrl_init_adc(struct i2c_child_t *pchild, int node) 771static void envctrl_init_adc(struct i2c_child_t *pchild, struct device_node *dp)
772{ 772{
773 char chnls_desc[CHANNEL_DESC_SZ];
774 int i = 0, len; 773 int i = 0, len;
775 char *pos = chnls_desc; 774 char *pos;
775 unsigned int *pval;
776 776
777 /* Firmware describe channels into a stream separated by a '\0'. */ 777 /* Firmware describe channels into a stream separated by a '\0'. */
778 len = prom_getproperty(node, "channels-description", chnls_desc, 778 pos = of_get_property(dp, "channels-description", &len);
779 CHANNEL_DESC_SZ);
780 chnls_desc[CHANNEL_DESC_SZ - 1] = '\0';
781 779
782 while (len > 0) { 780 while (len > 0) {
783 int l = strlen(pos) + 1; 781 int l = strlen(pos) + 1;
@@ -787,10 +785,13 @@ static void envctrl_init_adc(struct i2c_child_t *pchild, int node)
787 } 785 }
788 786
789 /* Get optional properties. */ 787 /* Get optional properties. */
790 len = prom_getproperty(node, "warning-temp", (char *)&warning_temperature, 788 pval = of_get_property(dp, "warning-temp", NULL);
791 sizeof(warning_temperature)); 789 if (pval)
792 len = prom_getproperty(node, "shutdown-temp", (char *)&shutdown_temperature, 790 warning_temperature = *pval;
793 sizeof(shutdown_temperature)); 791
792 pval = of_get_property(dp, "shutdown-temp", NULL);
793 if (pval)
794 shutdown_temperature = *pval;
794} 795}
795 796
796/* Function Description: Initialize child device monitoring fan status. 797/* Function Description: Initialize child device monitoring fan status.
@@ -864,21 +865,18 @@ static void envctrl_init_voltage_status(struct i2c_child_t *pchild)
864static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child, 865static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
865 struct i2c_child_t *pchild) 866 struct i2c_child_t *pchild)
866{ 867{
867 int node, len, i, tbls_size = 0; 868 int len, i, tbls_size = 0;
868 869 struct device_node *dp = edev_child->prom_node;
869 node = edev_child->prom_node; 870 void *pval;
870 871
871 /* Get device address. */ 872 /* Get device address. */
872 len = prom_getproperty(node, "reg", 873 pval = of_get_property(dp, "reg", &len);
873 (char *) &(pchild->addr), 874 memcpy(&pchild->addr, pval, len);
874 sizeof(pchild->addr));
875 875
876 /* Get tables property. Read firmware temperature tables. */ 876 /* Get tables property. Read firmware temperature tables. */
877 len = prom_getproperty(node, "translation", 877 pval = of_get_property(dp, "translation", &len);
878 (char *) pchild->tblprop_array, 878 if (pval && len > 0) {
879 (PCF8584_MAX_CHANNELS * 879 memcpy(pchild->tblprop_array, pval, len);
880 sizeof(struct pcf8584_tblprop)));
881 if (len > 0) {
882 pchild->total_tbls = len / sizeof(struct pcf8584_tblprop); 880 pchild->total_tbls = len / sizeof(struct pcf8584_tblprop);
883 for (i = 0; i < pchild->total_tbls; i++) { 881 for (i = 0; i < pchild->total_tbls; i++) {
884 if ((pchild->tblprop_array[i].size + pchild->tblprop_array[i].offset) > tbls_size) { 882 if ((pchild->tblprop_array[i].size + pchild->tblprop_array[i].offset) > tbls_size) {
@@ -891,12 +889,12 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
891 printk("envctrl: Failed to allocate table.\n"); 889 printk("envctrl: Failed to allocate table.\n");
892 return; 890 return;
893 } 891 }
894 len = prom_getproperty(node, "tables", 892 pval = of_get_property(dp, "tables", &len);
895 (char *) pchild->tables, tbls_size); 893 if (!pval || len <= 0) {
896 if (len <= 0) {
897 printk("envctrl: Failed to get table.\n"); 894 printk("envctrl: Failed to get table.\n");
898 return; 895 return;
899 } 896 }
897 memcpy(pchild->tables, pval, len);
900 } 898 }
901 899
902 /* SPARCengine ASM Reference Manual (ref. SMI doc 805-7581-04) 900 /* SPARCengine ASM Reference Manual (ref. SMI doc 805-7581-04)
@@ -907,12 +905,11 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
907 * 'NULL' monitor type. 905 * 'NULL' monitor type.
908 */ 906 */
909 if (ENVCTRL_CPCI_IGNORED_NODE == pchild->addr) { 907 if (ENVCTRL_CPCI_IGNORED_NODE == pchild->addr) {
908 struct device_node *root_node;
910 int len; 909 int len;
911 char prop[56];
912 910
913 len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop)); 911 root_node = of_find_node_by_path("/");
914 if (0 < len && (0 == strncmp(prop, "SUNW,UltraSPARC-IIi-cEngine", len))) 912 if (!strcmp(root_node->name, "SUNW,UltraSPARC-IIi-cEngine")) {
915 {
916 for (len = 0; len < PCF8584_MAX_CHANNELS; ++len) { 913 for (len = 0; len < PCF8584_MAX_CHANNELS; ++len) {
917 pchild->mon_type[len] = ENVCTRL_NOMON; 914 pchild->mon_type[len] = ENVCTRL_NOMON;
918 } 915 }
@@ -921,16 +918,14 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
921 } 918 }
922 919
923 /* Get the monitor channels. */ 920 /* Get the monitor channels. */
924 len = prom_getproperty(node, "channels-in-use", 921 pval = of_get_property(dp, "channels-in-use", &len);
925 (char *) pchild->chnl_array, 922 memcpy(pchild->chnl_array, pval, len);
926 (PCF8584_MAX_CHANNELS *
927 sizeof(struct pcf8584_channel)));
928 pchild->total_chnls = len / sizeof(struct pcf8584_channel); 923 pchild->total_chnls = len / sizeof(struct pcf8584_channel);
929 924
930 for (i = 0; i < pchild->total_chnls; i++) { 925 for (i = 0; i < pchild->total_chnls; i++) {
931 switch (pchild->chnl_array[i].type) { 926 switch (pchild->chnl_array[i].type) {
932 case PCF8584_TEMP_TYPE: 927 case PCF8584_TEMP_TYPE:
933 envctrl_init_adc(pchild, node); 928 envctrl_init_adc(pchild, dp);
934 break; 929 break;
935 930
936 case PCF8584_GLOBALADDR_TYPE: 931 case PCF8584_GLOBALADDR_TYPE:
@@ -945,7 +940,7 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
945 940
946 case PCF8584_VOLTAGE_TYPE: 941 case PCF8584_VOLTAGE_TYPE:
947 if (pchild->i2ctype == I2C_ADC) { 942 if (pchild->i2ctype == I2C_ADC) {
948 envctrl_init_adc(pchild,node); 943 envctrl_init_adc(pchild,dp);
949 } else { 944 } else {
950 envctrl_init_voltage_status(pchild); 945 envctrl_init_voltage_status(pchild);
951 } 946 }
@@ -1046,7 +1041,7 @@ static int __init envctrl_init(void)
1046 1041
1047 for_each_ebus(ebus) { 1042 for_each_ebus(ebus) {
1048 for_each_ebusdev(edev, ebus) { 1043 for_each_ebusdev(edev, ebus) {
1049 if (!strcmp(edev->prom_name, "bbc")) { 1044 if (!strcmp(edev->prom_node->name, "bbc")) {
1050 /* If we find a boot-bus controller node, 1045 /* If we find a boot-bus controller node,
1051 * then this envctrl driver is not for us. 1046 * then this envctrl driver is not for us.
1052 */ 1047 */
@@ -1060,14 +1055,14 @@ static int __init envctrl_init(void)
1060 */ 1055 */
1061 for_each_ebus(ebus) { 1056 for_each_ebus(ebus) {
1062 for_each_ebusdev(edev, ebus) { 1057 for_each_ebusdev(edev, ebus) {
1063 if (!strcmp(edev->prom_name, "i2c")) { 1058 if (!strcmp(edev->prom_node->name, "i2c")) {
1064 i2c = ioremap(edev->resource[0].start, 0x2); 1059 i2c = ioremap(edev->resource[0].start, 0x2);
1065 for_each_edevchild(edev, edev_child) { 1060 for_each_edevchild(edev, edev_child) {
1066 if (!strcmp("gpio", edev_child->prom_name)) { 1061 if (!strcmp("gpio", edev_child->prom_node->name)) {
1067 i2c_childlist[i].i2ctype = I2C_GPIO; 1062 i2c_childlist[i].i2ctype = I2C_GPIO;
1068 envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++])); 1063 envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++]));
1069 } 1064 }
1070 if (!strcmp("adc", edev_child->prom_name)) { 1065 if (!strcmp("adc", edev_child->prom_node->name)) {
1071 i2c_childlist[i].i2ctype = I2C_ADC; 1066 i2c_childlist[i].i2ctype = I2C_ADC;
1072 envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++])); 1067 envctrl_init_i2c_child(edev_child, &(i2c_childlist[i++]));
1073 } 1068 }
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 2beb3dded087..5ae684c011f8 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -192,9 +192,11 @@ static int __init flash_init(void)
192 } 192 }
193 if (!sdev) { 193 if (!sdev) {
194#ifdef CONFIG_PCI 194#ifdef CONFIG_PCI
195 struct linux_prom_registers *ebus_regs;
196
195 for_each_ebus(ebus) { 197 for_each_ebus(ebus) {
196 for_each_ebusdev(edev, ebus) { 198 for_each_ebusdev(edev, ebus) {
197 if (!strcmp(edev->prom_name, "flashprom")) 199 if (!strcmp(edev->prom_node->name, "flashprom"))
198 goto ebus_done; 200 goto ebus_done;
199 } 201 }
200 } 202 }
@@ -202,23 +204,23 @@ static int __init flash_init(void)
202 if (!edev) 204 if (!edev)
203 return -ENODEV; 205 return -ENODEV;
204 206
205 len = prom_getproperty(edev->prom_node, "reg", (void *)regs, sizeof(regs)); 207 ebus_regs = of_get_property(edev->prom_node, "reg", &len);
206 if ((len % sizeof(regs[0])) != 0) { 208 if (!ebus_regs || (len % sizeof(regs[0])) != 0) {
207 printk("flash: Strange reg property size %d\n", len); 209 printk("flash: Strange reg property size %d\n", len);
208 return -ENODEV; 210 return -ENODEV;
209 } 211 }
210 212
211 nregs = len / sizeof(regs[0]); 213 nregs = len / sizeof(ebus_regs[0]);
212 214
213 flash.read_base = edev->resource[0].start; 215 flash.read_base = edev->resource[0].start;
214 flash.read_size = regs[0].reg_size; 216 flash.read_size = ebus_regs[0].reg_size;
215 217
216 if (nregs == 1) { 218 if (nregs == 1) {
217 flash.write_base = edev->resource[0].start; 219 flash.write_base = edev->resource[0].start;
218 flash.write_size = regs[0].reg_size; 220 flash.write_size = ebus_regs[0].reg_size;
219 } else if (nregs == 2) { 221 } else if (nregs == 2) {
220 flash.write_base = edev->resource[1].start; 222 flash.write_base = edev->resource[1].start;
221 flash.write_size = regs[1].reg_size; 223 flash.write_size = ebus_regs[1].reg_size;
222 } else { 224 } else {
223 printk("flash: Strange number of regs %d\n", nregs); 225 printk("flash: Strange number of regs %d\n", nregs);
224 return -ENODEV; 226 return -ENODEV;
diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c
index bfbe9dc90cca..e4c0fd2d6a9d 100644
--- a/drivers/serial/sunsab.c
+++ b/drivers/serial/sunsab.c
@@ -984,19 +984,19 @@ static void __init for_each_sab_edev(void (*callback)(struct linux_ebus_device *
984 984
985 for_each_ebus(ebus) { 985 for_each_ebus(ebus) {
986 for_each_ebusdev(edev, ebus) { 986 for_each_ebusdev(edev, ebus) {
987 if (!strcmp(edev->prom_name, "se")) { 987 if (!strcmp(edev->prom_node->name, "se")) {
988 callback(edev, arg); 988 callback(edev, arg);
989 continue; 989 continue;
990 } else if (!strcmp(edev->prom_name, "serial")) { 990 } else if (!strcmp(edev->prom_node->name, "serial")) {
991 char compat[32]; 991 char *compat;
992 int clen; 992 int clen;
993 993
994 /* On RIO this can be an SE, check it. We could 994 /* On RIO this can be an SE, check it. We could
995 * just check ebus->is_rio, but this is more portable. 995 * just check ebus->is_rio, but this is more portable.
996 */ 996 */
997 clen = prom_getproperty(edev->prom_node, "compatible", 997 compat = of_get_property(edev->prom_node,
998 compat, sizeof(compat)); 998 "compatible", &clen);
999 if (clen > 0) { 999 if (compat && clen > 0) {
1000 if (strncmp(compat, "sab82532", 8) == 0) { 1000 if (strncmp(compat, "sab82532", 8) == 0) {
1001 callback(edev, arg); 1001 callback(edev, arg);
1002 continue; 1002 continue;
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index 4cdb610cdd37..0268b307c01e 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1053,7 +1053,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up)
1053 */ 1053 */
1054 for_each_ebus(ebus) { 1054 for_each_ebus(ebus) {
1055 for_each_ebusdev(dev, ebus) { 1055 for_each_ebusdev(dev, ebus) {
1056 if (dev->prom_node == up->port_node) { 1056 if (dev->prom_node->node == up->port_node) {
1057 /* 1057 /*
1058 * The EBus is broken on sparc; it delivers 1058 * The EBus is broken on sparc; it delivers
1059 * virtual addresses in resources. Oh well... 1059 * virtual addresses in resources. Oh well...
@@ -1073,7 +1073,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up)
1073#ifdef CONFIG_SPARC64 1073#ifdef CONFIG_SPARC64
1074 for_each_isa(isa_br) { 1074 for_each_isa(isa_br) {
1075 for_each_isadev(isa_dev, isa_br) { 1075 for_each_isadev(isa_dev, isa_br) {
1076 if (isa_dev->prom_node == up->port_node) { 1076 if (isa_dev->prom_node->node == up->port_node) {
1077 /* Same on sparc64. Cool architecure... */ 1077 /* Same on sparc64. Cool architecure... */
1078 up->port.membase = (char *) isa_dev->resource.start; 1078 up->port.membase = (char *) isa_dev->resource.start;
1079 up->port.mapbase = isa_dev->resource.start; 1079 up->port.mapbase = isa_dev->resource.start;
diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index 7a408a030f52..876912f4d83b 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -10,13 +10,13 @@
10 10
11#include <asm/pbm.h> 11#include <asm/pbm.h>
12#include <asm/oplib.h> 12#include <asm/oplib.h>
13#include <asm/prom.h>
13 14
14struct linux_ebus_child { 15struct linux_ebus_child {
15 struct linux_ebus_child *next; 16 struct linux_ebus_child *next;
16 struct linux_ebus_device *parent; 17 struct linux_ebus_device *parent;
17 struct linux_ebus *bus; 18 struct linux_ebus *bus;
18 int prom_node; 19 struct device_node *prom_node;
19 char prom_name[64];
20 struct resource resource[PROMREG_MAX]; 20 struct resource resource[PROMREG_MAX];
21 int num_addrs; 21 int num_addrs;
22 unsigned int irqs[PROMINTR_MAX]; 22 unsigned int irqs[PROMINTR_MAX];
@@ -27,8 +27,7 @@ struct linux_ebus_device {
27 struct linux_ebus_device *next; 27 struct linux_ebus_device *next;
28 struct linux_ebus_child *children; 28 struct linux_ebus_child *children;
29 struct linux_ebus *bus; 29 struct linux_ebus *bus;
30 int prom_node; 30 struct device_node *prom_node;
31 char prom_name[64];
32 struct resource resource[PROMREG_MAX]; 31 struct resource resource[PROMREG_MAX];
33 int num_addrs; 32 int num_addrs;
34 unsigned int irqs[PROMINTR_MAX]; 33 unsigned int irqs[PROMINTR_MAX];
@@ -42,8 +41,7 @@ struct linux_ebus {
42 struct pci_dev *self; 41 struct pci_dev *self;
43 int index; 42 int index;
44 int is_rio; 43 int is_rio;
45 int prom_node; 44 struct device_node *prom_node;
46 char prom_name[64];
47 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX]; 45 struct linux_prom_ebus_ranges ebus_ranges[PROMREG_MAX];
48 int num_ebus_ranges; 46 int num_ebus_ranges;
49 struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX]; 47 struct linux_prom_ebus_intmap ebus_intmap[PROMREG_MAX];
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index 07ccd6f04b52..f8d57bb5570c 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -498,15 +498,14 @@ static int sun_pci_fd_test_drive(unsigned long port, int drive)
498#ifdef CONFIG_PCI 498#ifdef CONFIG_PCI
499static int __init ebus_fdthree_p(struct linux_ebus_device *edev) 499static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
500{ 500{
501 if (!strcmp(edev->prom_name, "fdthree")) 501 if (!strcmp(edev->prom_node->name, "fdthree"))
502 return 1; 502 return 1;
503 if (!strcmp(edev->prom_name, "floppy")) { 503 if (!strcmp(edev->prom_node->name, "floppy")) {
504 char compat[16]; 504 char *compat;
505 prom_getstring(edev->prom_node, 505
506 "compatible", 506 compat = of_get_property(edev->prom_node,
507 compat, sizeof(compat)); 507 "compatible", NULL);
508 compat[15] = '\0'; 508 if (compat && !strcmp(compat, "fdthree"))
509 if (!strcmp(compat, "fdthree"))
510 return 1; 509 return 1;
511 } 510 }
512 return 0; 511 return 0;
@@ -524,12 +523,12 @@ static unsigned long __init isa_floppy_init(void)
524 523
525 for_each_isa(isa_br) { 524 for_each_isa(isa_br) {
526 for_each_isadev(isa_dev, isa_br) { 525 for_each_isadev(isa_dev, isa_br) {
527 if (!strcmp(isa_dev->prom_name, "dma")) { 526 if (!strcmp(isa_dev->prom_node->name, "dma")) {
528 struct sparc_isa_device *child = 527 struct sparc_isa_device *child =
529 isa_dev->child; 528 isa_dev->child;
530 529
531 while (child) { 530 while (child) {
532 if (!strcmp(child->prom_name, 531 if (!strcmp(child->prom_node->name,
533 "floppy")) { 532 "floppy")) {
534 isa_dev = child; 533 isa_dev = child;
535 goto isa_done; 534 goto isa_done;
@@ -614,6 +613,7 @@ static unsigned long __init sun_floppy_init(void)
614 struct linux_ebus_device *edev = NULL; 613 struct linux_ebus_device *edev = NULL;
615 unsigned long config = 0; 614 unsigned long config = 0;
616 void __iomem *auxio_reg; 615 void __iomem *auxio_reg;
616 char *state_prop;
617 617
618 for_each_ebus(ebus) { 618 for_each_ebus(ebus) {
619 for_each_ebusdev(edev, ebus) { 619 for_each_ebusdev(edev, ebus) {
@@ -630,9 +630,8 @@ static unsigned long __init sun_floppy_init(void)
630#endif 630#endif
631 } 631 }
632 632
633 prom_getproperty(edev->prom_node, "status", 633 state_prop = of_get_property(edev->prom_node, "status", NULL);
634 state, sizeof(state)); 634 if (state_prop && !strncmp(state_prop, "disabled", 8))
635 if (!strncmp(state, "disabled", 8))
636 return 0; 635 return 0;
637 636
638 FLOPPY_IRQ = edev->irqs[0]; 637 FLOPPY_IRQ = edev->irqs[0];
@@ -703,7 +702,7 @@ static unsigned long __init sun_floppy_init(void)
703 */ 702 */
704 for_each_ebus(ebus) { 703 for_each_ebus(ebus) {
705 for_each_ebusdev(edev, ebus) { 704 for_each_ebusdev(edev, ebus) {
706 if (!strcmp(edev->prom_name, "ecpp")) { 705 if (!strcmp(edev->prom_node->name, "ecpp")) {
707 config = edev->resource[1].start; 706 config = edev->resource[1].start;
708 goto config_done; 707 goto config_done;
709 } 708 }
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h
index 4601bbfc3e7b..e110435b14ef 100644
--- a/include/asm-sparc64/isa.h
+++ b/include/asm-sparc64/isa.h
@@ -9,6 +9,7 @@
9 9
10#include <asm/pbm.h> 10#include <asm/pbm.h>
11#include <asm/oplib.h> 11#include <asm/oplib.h>
12#include <asm/prom.h>
12 13
13struct sparc_isa_bridge; 14struct sparc_isa_bridge;
14 15
@@ -16,9 +17,7 @@ struct sparc_isa_device {
16 struct sparc_isa_device *next; 17 struct sparc_isa_device *next;
17 struct sparc_isa_device *child; 18 struct sparc_isa_device *child;
18 struct sparc_isa_bridge *bus; 19 struct sparc_isa_bridge *bus;
19 int prom_node; 20 struct device_node *prom_node;
20 char prom_name[64];
21 char compatible[64];
22 struct resource resource; 21 struct resource resource;
23 unsigned int irq; 22 unsigned int irq;
24}; 23};
@@ -29,8 +28,7 @@ struct sparc_isa_bridge {
29 struct pci_pbm_info *parent; 28 struct pci_pbm_info *parent;
30 struct pci_dev *self; 29 struct pci_dev *self;
31 int index; 30 int index;
32 int prom_node; 31 struct device_node *prom_node;
33 char prom_name[64];
34#define linux_prom_isa_ranges linux_prom_ebus_ranges 32#define linux_prom_isa_ranges linux_prom_ebus_ranges
35 struct linux_prom_isa_ranges isa_ranges[PROMREG_MAX]; 33 struct linux_prom_isa_ranges isa_ranges[PROMREG_MAX];
36 int num_isa_ranges; 34 int num_isa_ranges;
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 56b5197d7898..d3895873e4c7 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -67,18 +67,17 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr)
67 67
68static int ebus_ecpp_p(struct linux_ebus_device *edev) 68static int ebus_ecpp_p(struct linux_ebus_device *edev)
69{ 69{
70 if (!strcmp(edev->prom_name, "ecpp")) 70 if (!strcmp(edev->prom_node->name, "ecpp"))
71 return 1; 71 return 1;
72 if (!strcmp(edev->prom_name, "parallel")) { 72 if (!strcmp(edev->prom_node->name, "parallel")) {
73 char compat[19]; 73 char *compat;
74 prom_getstring(edev->prom_node, 74
75 "compatible", 75 compat = of_get_property(edev->prom_node,
76 compat, sizeof(compat)); 76 "compatible", NULL);
77 compat[18] = '\0'; 77 if (compat &&
78 if (!strcmp(compat, "ecpp")) 78 (!strcmp(compat, "ecpp") ||
79 return 1; 79 !strcmp(compat, "ns87317-ecpp") ||
80 if (!strcmp(compat, "ns87317-ecpp") && 80 !strcmp(compat + 13, "ecpp")))
81 !strcmp(compat + 13, "ecpp"))
82 return 1; 81 return 1;
83 } 82 }
84 return 0; 83 return 0;
@@ -94,12 +93,12 @@ static int parport_isa_probe(int count)
94 struct sparc_isa_device *child; 93 struct sparc_isa_device *child;
95 unsigned long base; 94 unsigned long base;
96 95
97 if (strcmp(isa_dev->prom_name, "dma")) 96 if (strcmp(isa_dev->prom_node->name, "dma"))
98 continue; 97 continue;
99 98
100 child = isa_dev->child; 99 child = isa_dev->child;
101 while (child) { 100 while (child) {
102 if (!strcmp(child->prom_name, "parallel")) 101 if (!strcmp(child->prom_node->name, "parallel"))
103 break; 102 break;
104 child = child->next; 103 child = child->next;
105 } 104 }
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index b3efc9aa2916..da54d04a3e3a 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -2284,15 +2284,14 @@ static int __init cs4231_init(void)
2284 for_each_ebusdev(edev, ebus) { 2284 for_each_ebusdev(edev, ebus) {
2285 int match = 0; 2285 int match = 0;
2286 2286
2287 if (!strcmp(edev->prom_name, "SUNW,CS4231")) { 2287 if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) {
2288 match = 1; 2288 match = 1;
2289 } else if (!strcmp(edev->prom_name, "audio")) { 2289 } else if (!strcmp(edev->prom_node->name, "audio")) {
2290 char compat[16]; 2290 char *compat;
2291 2291
2292 prom_getstring(edev->prom_node, "compatible", 2292 compat = of_get_property(edev->prom_node,
2293 compat, sizeof(compat)); 2293 "compatible", NULL);
2294 compat[15] = '\0'; 2294 if (compat && !strcmp(compat, "SUNW,CS4231"))
2295 if (!strcmp(compat, "SUNW,CS4231"))
2296 match = 1; 2295 match = 1;
2297 } 2296 }
2298 2297