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