aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/mm/iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/mm/iommu.c')
-rw-r--r--arch/sparc/mm/iommu.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index 35384cb60b21..491511d37e37 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -58,6 +58,8 @@ static void __init sbus_iommu_init(struct platform_device *op)
58 struct iommu_struct *iommu; 58 struct iommu_struct *iommu;
59 unsigned int impl, vers; 59 unsigned int impl, vers;
60 unsigned long *bitmap; 60 unsigned long *bitmap;
61 unsigned long control;
62 unsigned long base;
61 unsigned long tmp; 63 unsigned long tmp;
62 64
63 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL); 65 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL);
@@ -72,12 +74,14 @@ static void __init sbus_iommu_init(struct platform_device *op)
72 prom_printf("Cannot map IOMMU registers\n"); 74 prom_printf("Cannot map IOMMU registers\n");
73 prom_halt(); 75 prom_halt();
74 } 76 }
75 impl = (iommu->regs->control & IOMMU_CTRL_IMPL) >> 28; 77
76 vers = (iommu->regs->control & IOMMU_CTRL_VERS) >> 24; 78 control = sbus_readl(&iommu->regs->control);
77 tmp = iommu->regs->control; 79 impl = (control & IOMMU_CTRL_IMPL) >> 28;
78 tmp &= ~(IOMMU_CTRL_RNGE); 80 vers = (control & IOMMU_CTRL_VERS) >> 24;
79 tmp |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB); 81 control &= ~(IOMMU_CTRL_RNGE);
80 iommu->regs->control = tmp; 82 control |= (IOMMU_RNGE_256MB | IOMMU_CTRL_ENAB);
83 sbus_writel(control, &iommu->regs->control);
84
81 iommu_invalidate(iommu->regs); 85 iommu_invalidate(iommu->regs);
82 iommu->start = IOMMU_START; 86 iommu->start = IOMMU_START;
83 iommu->end = 0xffffffff; 87 iommu->end = 0xffffffff;
@@ -99,7 +103,9 @@ static void __init sbus_iommu_init(struct platform_device *op)
99 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t)); 103 memset(iommu->page_table, 0, IOMMU_NPTES*sizeof(iopte_t));
100 flush_cache_all(); 104 flush_cache_all();
101 flush_tlb_all(); 105 flush_tlb_all();
102 iommu->regs->base = __pa((unsigned long) iommu->page_table) >> 4; 106
107 base = __pa((unsigned long)iommu->page_table) >> 4;
108 sbus_writel(base, &iommu->regs->base);
103 iommu_invalidate(iommu->regs); 109 iommu_invalidate(iommu->regs);
104 110
105 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL); 111 bitmap = kmalloc(IOMMU_NPTES>>3, GFP_KERNEL);