diff options
Diffstat (limited to 'arch/sparc/mm/io-unit.c')
-rw-r--r-- | arch/sparc/mm/io-unit.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index 0f97ab30df3f..caf551ad9d8c 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c | |||
@@ -34,18 +34,10 @@ | |||
34 | #define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID) | 34 | #define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID) |
35 | #define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM) | 35 | #define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM) |
36 | 36 | ||
37 | void __init iounit_init(struct sbus_bus *sbus) | 37 | static void __init iounit_iommu_init(struct of_device *op) |
38 | { | 38 | { |
39 | struct device_node *dp = sbus->ofdev.node; | ||
40 | struct iounit_struct *iounit; | 39 | struct iounit_struct *iounit; |
41 | iopte_t *xpt, *xptend; | 40 | iopte_t *xpt, *xptend; |
42 | struct of_device *op; | ||
43 | |||
44 | op = of_find_device_by_node(dp); | ||
45 | if (!op) { | ||
46 | prom_printf("SUN4D: Cannot find SBI of_device.\n"); | ||
47 | prom_halt(); | ||
48 | } | ||
49 | 41 | ||
50 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); | 42 | iounit = kzalloc(sizeof(struct iounit_struct), GFP_ATOMIC); |
51 | if (!iounit) { | 43 | if (!iounit) { |
@@ -66,7 +58,6 @@ void __init iounit_init(struct sbus_bus *sbus) | |||
66 | prom_halt(); | 58 | prom_halt(); |
67 | } | 59 | } |
68 | 60 | ||
69 | sbus->ofdev.dev.archdata.iommu = iounit; | ||
70 | op->dev.archdata.iommu = iounit; | 61 | op->dev.archdata.iommu = iounit; |
71 | iounit->page_table = xpt; | 62 | iounit->page_table = xpt; |
72 | spin_lock_init(&iounit->lock); | 63 | spin_lock_init(&iounit->lock); |
@@ -76,6 +67,25 @@ void __init iounit_init(struct sbus_bus *sbus) | |||
76 | iopte_val(*xpt++) = 0; | 67 | iopte_val(*xpt++) = 0; |
77 | } | 68 | } |
78 | 69 | ||
70 | static int __init iounit_init(void) | ||
71 | { | ||
72 | extern void sun4d_init_sbi_irq(void); | ||
73 | struct device_node *dp; | ||
74 | |||
75 | for_each_node_by_name(dp, "sbi") { | ||
76 | struct of_device *op = of_find_device_by_node(dp); | ||
77 | |||
78 | iounit_iommu_init(op); | ||
79 | of_propagate_archdata(op); | ||
80 | } | ||
81 | |||
82 | sun4d_init_sbi_irq(); | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | subsys_initcall(iounit_init); | ||
88 | |||
79 | /* One has to hold iounit->lock to call this */ | 89 | /* One has to hold iounit->lock to call this */ |
80 | static unsigned long iounit_get_area(struct iounit_struct *iounit, unsigned long vaddr, int size) | 90 | static unsigned long iounit_get_area(struct iounit_struct *iounit, unsigned long vaddr, int size) |
81 | { | 91 | { |