aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2006-06-23 18:55:45 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-06-24 02:15:50 -0400
commit576c352e89e57cfa6c9f493e549d10d86f60a0cf (patch)
tree4f393f05beef86284a037b106bfb353ff0d72c8a /arch/sparc
parentfd5314311634245172d40ccb418d89dac91d6ad6 (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/sparc')
-rw-r--r--arch/sparc/kernel/ioport.c85
1 files changed, 85 insertions, 0 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) */
471void __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
492void __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
512void __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
522int __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
539void __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