diff options
author | David S. Miller <davem@davemloft.net> | 2006-06-23 18:55:45 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-24 02:15:50 -0400 |
commit | 576c352e89e57cfa6c9f493e549d10d86f60a0cf (patch) | |
tree | 4f393f05beef86284a037b106bfb353ff0d72c8a /arch | |
parent | fd5314311634245172d40ccb418d89dac91d6ad6 (diff) |
[SBUS]: Rewrite and plug into of_device framework.
I severely apologize, I was still learning how to program
in C when I wrote this stuff 10 years ago...
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/kernel/ioport.c | 85 | ||||
-rw-r--r-- | arch/sparc64/kernel/sbus.c | 31 |
2 files changed, 115 insertions, 1 deletions
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 00cf41182912..ae4c667c906f 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -39,6 +39,8 @@ | |||
39 | #include <asm/io.h> | 39 | #include <asm/io.h> |
40 | #include <asm/vaddrs.h> | 40 | #include <asm/vaddrs.h> |
41 | #include <asm/oplib.h> | 41 | #include <asm/oplib.h> |
42 | #include <asm/prom.h> | ||
43 | #include <asm/sbus.h> | ||
42 | #include <asm/page.h> | 44 | #include <asm/page.h> |
43 | #include <asm/pgalloc.h> | 45 | #include <asm/pgalloc.h> |
44 | #include <asm/dma.h> | 46 | #include <asm/dma.h> |
@@ -458,6 +460,89 @@ void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, struct scatterlist *sg, | |||
458 | { | 460 | { |
459 | printk("sbus_dma_sync_sg_for_device: not implemented yet\n"); | 461 | printk("sbus_dma_sync_sg_for_device: not implemented yet\n"); |
460 | } | 462 | } |
463 | |||
464 | /* Support code for sbus_init(). */ | ||
465 | /* | ||
466 | * XXX This functions appears to be a distorted version of | ||
467 | * prom_sbus_ranges_init(), with all sun4d stuff cut away. | ||
468 | * Ask DaveM what is going on here, how is sun4d supposed to work... XXX | ||
469 | */ | ||
470 | /* added back sun4d patch from Thomas Bogendoerfer - should be OK (crn) */ | ||
471 | void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus) | ||
472 | { | ||
473 | int parent_node = pn->node; | ||
474 | |||
475 | if (sparc_cpu_model == sun4d) { | ||
476 | struct linux_prom_ranges iounit_ranges[PROMREG_MAX]; | ||
477 | int num_iounit_ranges, len; | ||
478 | |||
479 | len = prom_getproperty(parent_node, "ranges", | ||
480 | (char *) iounit_ranges, | ||
481 | sizeof (iounit_ranges)); | ||
482 | if (len != -1) { | ||
483 | num_iounit_ranges = | ||
484 | (len / sizeof(struct linux_prom_ranges)); | ||
485 | prom_adjust_ranges(sbus->sbus_ranges, | ||
486 | sbus->num_sbus_ranges, | ||
487 | iounit_ranges, num_iounit_ranges); | ||
488 | } | ||
489 | } | ||
490 | } | ||
491 | |||
492 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | ||
493 | { | ||
494 | struct device_node *parent = dp->parent; | ||
495 | |||
496 | if (sparc_cpu_model != sun4d && | ||
497 | parent != NULL && | ||
498 | !strcmp(parent->name, "iommu")) { | ||
499 | extern void iommu_init(int iommu_node, struct sbus_bus *sbus); | ||
500 | |||
501 | iommu_init(parent->node, sbus); | ||
502 | } | ||
503 | |||
504 | if (sparc_cpu_model == sun4d) { | ||
505 | extern void iounit_init(int sbi_node, int iounit_node, | ||
506 | struct sbus_bus *sbus); | ||
507 | |||
508 | iounit_init(dp->node, parent->node, sbus); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp) | ||
513 | { | ||
514 | if (sparc_cpu_model == sun4d) { | ||
515 | struct device_node *parent = dp->parent; | ||
516 | |||
517 | sbus->devid = of_getintprop_default(parent, "device-id", 0); | ||
518 | sbus->board = of_getintprop_default(parent, "board#", 0); | ||
519 | } | ||
520 | } | ||
521 | |||
522 | int __init sbus_arch_preinit(void) | ||
523 | { | ||
524 | extern void register_proc_sparc_ioport(void); | ||
525 | |||
526 | register_proc_sparc_ioport(); | ||
527 | |||
528 | #ifdef CONFIG_SUN4 | ||
529 | { | ||
530 | extern void sun4_dvma_init(void); | ||
531 | sun4_dvma_init(); | ||
532 | } | ||
533 | return 1; | ||
534 | #else | ||
535 | return 0; | ||
536 | #endif | ||
537 | } | ||
538 | |||
539 | void __init sbus_arch_postinit(void) | ||
540 | { | ||
541 | if (sparc_cpu_model == sun4d) { | ||
542 | extern void sun4d_init_sbi_irq(void); | ||
543 | sun4d_init_sbi_irq(); | ||
544 | } | ||
545 | } | ||
461 | #endif /* CONFIG_SBUS */ | 546 | #endif /* CONFIG_SBUS */ |
462 | 547 | ||
463 | #ifdef CONFIG_PCI | 548 | #ifdef CONFIG_PCI |
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c index a72bba398809..d3da23cdc264 100644 --- a/arch/sparc64/kernel/sbus.c +++ b/arch/sparc64/kernel/sbus.c | |||
@@ -1099,7 +1099,7 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus) | |||
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | /* Boot time initialization. */ | 1101 | /* Boot time initialization. */ |
1102 | void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) | 1102 | static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) |
1103 | { | 1103 | { |
1104 | struct linux_prom64_registers *pr; | 1104 | struct linux_prom64_registers *pr; |
1105 | struct device_node *dp; | 1105 | struct device_node *dp; |
@@ -1247,3 +1247,32 @@ void sbus_fill_device_irq(struct sbus_dev *sdev) | |||
1247 | sdev->irqs[0] = sbus_build_irq(sdev->bus, pri); | 1247 | sdev->irqs[0] = sbus_build_irq(sdev->bus, pri); |
1248 | } | 1248 | } |
1249 | } | 1249 | } |
1250 | |||
1251 | void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus) | ||
1252 | { | ||
1253 | } | ||
1254 | |||
1255 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | ||
1256 | { | ||
1257 | sbus_iommu_init(dp->node, sbus); | ||
1258 | } | ||
1259 | |||
1260 | void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp) | ||
1261 | { | ||
1262 | } | ||
1263 | |||
1264 | int __init sbus_arch_preinit(void) | ||
1265 | { | ||
1266 | return 0; | ||
1267 | } | ||
1268 | |||
1269 | void __init sbus_arch_postinit(void) | ||
1270 | { | ||
1271 | extern void firetruck_init(void); | ||
1272 | extern void auxio_probe(void); | ||
1273 | extern void clock_probe(void); | ||
1274 | |||
1275 | firetruck_init(); | ||
1276 | auxio_probe(); | ||
1277 | clock_probe(); | ||
1278 | } | ||