diff options
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/iommu2.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c index ebbdae262f78..edf7cd4b6553 100644 --- a/arch/arm/mach-omap2/iommu2.c +++ b/arch/arm/mach-omap2/iommu2.c | |||
@@ -65,6 +65,26 @@ | |||
65 | ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 : \ | 65 | ((pgsz) == MMU_CAM_PGSZ_64K) ? 0xffff0000 : \ |
66 | ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0) | 66 | ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0) |
67 | 67 | ||
68 | |||
69 | static void __iommu_set_twl(struct iommu *obj, bool on) | ||
70 | { | ||
71 | u32 l = iommu_read_reg(obj, MMU_CNTL); | ||
72 | |||
73 | if (on) | ||
74 | iommu_write_reg(obj, MMU_IRQ_TWL_MASK, MMU_IRQENABLE); | ||
75 | else | ||
76 | iommu_write_reg(obj, MMU_IRQ_TLB_MISS_MASK, MMU_IRQENABLE); | ||
77 | |||
78 | l &= ~MMU_CNTL_MASK; | ||
79 | if (on) | ||
80 | l |= (MMU_CNTL_MMU_EN | MMU_CNTL_TWL_EN); | ||
81 | else | ||
82 | l |= (MMU_CNTL_MMU_EN); | ||
83 | |||
84 | iommu_write_reg(obj, l, MMU_CNTL); | ||
85 | } | ||
86 | |||
87 | |||
68 | static int omap2_iommu_enable(struct iommu *obj) | 88 | static int omap2_iommu_enable(struct iommu *obj) |
69 | { | 89 | { |
70 | u32 l, pa; | 90 | u32 l, pa; |
@@ -100,13 +120,9 @@ static int omap2_iommu_enable(struct iommu *obj) | |||
100 | l |= (MMU_SYS_IDLE_SMART | MMU_SYS_AUTOIDLE); | 120 | l |= (MMU_SYS_IDLE_SMART | MMU_SYS_AUTOIDLE); |
101 | iommu_write_reg(obj, l, MMU_SYSCONFIG); | 121 | iommu_write_reg(obj, l, MMU_SYSCONFIG); |
102 | 122 | ||
103 | iommu_write_reg(obj, MMU_IRQ_TWL_MASK, MMU_IRQENABLE); | ||
104 | iommu_write_reg(obj, pa, MMU_TTB); | 123 | iommu_write_reg(obj, pa, MMU_TTB); |
105 | 124 | ||
106 | l = iommu_read_reg(obj, MMU_CNTL); | 125 | __iommu_set_twl(obj, true); |
107 | l &= ~MMU_CNTL_MASK; | ||
108 | l |= (MMU_CNTL_MMU_EN | MMU_CNTL_TWL_EN); | ||
109 | iommu_write_reg(obj, l, MMU_CNTL); | ||
110 | 126 | ||
111 | return 0; | 127 | return 0; |
112 | } | 128 | } |
@@ -122,6 +138,11 @@ static void omap2_iommu_disable(struct iommu *obj) | |||
122 | dev_dbg(obj->dev, "%s is shutting down\n", obj->name); | 138 | dev_dbg(obj->dev, "%s is shutting down\n", obj->name); |
123 | } | 139 | } |
124 | 140 | ||
141 | static void omap2_iommu_set_twl(struct iommu *obj, bool on) | ||
142 | { | ||
143 | __iommu_set_twl(obj, false); | ||
144 | } | ||
145 | |||
125 | static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra) | 146 | static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra) |
126 | { | 147 | { |
127 | int i; | 148 | int i; |
@@ -304,6 +325,7 @@ static const struct iommu_functions omap2_iommu_ops = { | |||
304 | 325 | ||
305 | .enable = omap2_iommu_enable, | 326 | .enable = omap2_iommu_enable, |
306 | .disable = omap2_iommu_disable, | 327 | .disable = omap2_iommu_disable, |
328 | .set_twl = omap2_iommu_set_twl, | ||
307 | .fault_isr = omap2_iommu_fault_isr, | 329 | .fault_isr = omap2_iommu_fault_isr, |
308 | 330 | ||
309 | .tlb_read_cr = omap2_tlb_read_cr, | 331 | .tlb_read_cr = omap2_tlb_read_cr, |