diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/iommu2.c | 31 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/iommu.h | 55 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/iommu2.h | 4 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/iopgtable.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/iovmm.h | 19 |
5 files changed, 61 insertions, 50 deletions
diff --git a/arch/arm/mach-omap2/iommu2.c b/arch/arm/mach-omap2/iommu2.c index f286012783c6..eefc37912ef3 100644 --- a/arch/arm/mach-omap2/iommu2.c +++ b/arch/arm/mach-omap2/iommu2.c | |||
@@ -66,7 +66,7 @@ | |||
66 | ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0) | 66 | ((pgsz) == MMU_CAM_PGSZ_4K) ? 0xfffff000 : 0) |
67 | 67 | ||
68 | 68 | ||
69 | static void __iommu_set_twl(struct iommu *obj, bool on) | 69 | static void __iommu_set_twl(struct omap_iommu *obj, bool on) |
70 | { | 70 | { |
71 | u32 l = iommu_read_reg(obj, MMU_CNTL); | 71 | u32 l = iommu_read_reg(obj, MMU_CNTL); |
72 | 72 | ||
@@ -85,7 +85,7 @@ static void __iommu_set_twl(struct iommu *obj, bool on) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | static int omap2_iommu_enable(struct iommu *obj) | 88 | static int omap2_iommu_enable(struct omap_iommu *obj) |
89 | { | 89 | { |
90 | u32 l, pa; | 90 | u32 l, pa; |
91 | unsigned long timeout; | 91 | unsigned long timeout; |
@@ -127,7 +127,7 @@ static int omap2_iommu_enable(struct iommu *obj) | |||
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
129 | 129 | ||
130 | static void omap2_iommu_disable(struct iommu *obj) | 130 | static void omap2_iommu_disable(struct omap_iommu *obj) |
131 | { | 131 | { |
132 | u32 l = iommu_read_reg(obj, MMU_CNTL); | 132 | u32 l = iommu_read_reg(obj, MMU_CNTL); |
133 | 133 | ||
@@ -138,12 +138,12 @@ static void omap2_iommu_disable(struct iommu *obj) | |||
138 | dev_dbg(obj->dev, "%s is shutting down\n", obj->name); | 138 | dev_dbg(obj->dev, "%s is shutting down\n", obj->name); |
139 | } | 139 | } |
140 | 140 | ||
141 | static void omap2_iommu_set_twl(struct iommu *obj, bool on) | 141 | static void omap2_iommu_set_twl(struct omap_iommu *obj, bool on) |
142 | { | 142 | { |
143 | __iommu_set_twl(obj, false); | 143 | __iommu_set_twl(obj, false); |
144 | } | 144 | } |
145 | 145 | ||
146 | static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra) | 146 | static u32 omap2_iommu_fault_isr(struct omap_iommu *obj, u32 *ra) |
147 | { | 147 | { |
148 | u32 stat, da; | 148 | u32 stat, da; |
149 | u32 errs = 0; | 149 | u32 errs = 0; |
@@ -173,13 +173,13 @@ static u32 omap2_iommu_fault_isr(struct iommu *obj, u32 *ra) | |||
173 | return errs; | 173 | return errs; |
174 | } | 174 | } |
175 | 175 | ||
176 | static void omap2_tlb_read_cr(struct iommu *obj, struct cr_regs *cr) | 176 | static void omap2_tlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr) |
177 | { | 177 | { |
178 | cr->cam = iommu_read_reg(obj, MMU_READ_CAM); | 178 | cr->cam = iommu_read_reg(obj, MMU_READ_CAM); |
179 | cr->ram = iommu_read_reg(obj, MMU_READ_RAM); | 179 | cr->ram = iommu_read_reg(obj, MMU_READ_RAM); |
180 | } | 180 | } |
181 | 181 | ||
182 | static void omap2_tlb_load_cr(struct iommu *obj, struct cr_regs *cr) | 182 | static void omap2_tlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr) |
183 | { | 183 | { |
184 | iommu_write_reg(obj, cr->cam | MMU_CAM_V, MMU_CAM); | 184 | iommu_write_reg(obj, cr->cam | MMU_CAM_V, MMU_CAM); |
185 | iommu_write_reg(obj, cr->ram, MMU_RAM); | 185 | iommu_write_reg(obj, cr->ram, MMU_RAM); |
@@ -193,7 +193,8 @@ static u32 omap2_cr_to_virt(struct cr_regs *cr) | |||
193 | return cr->cam & mask; | 193 | return cr->cam & mask; |
194 | } | 194 | } |
195 | 195 | ||
196 | static struct cr_regs *omap2_alloc_cr(struct iommu *obj, struct iotlb_entry *e) | 196 | static struct cr_regs *omap2_alloc_cr(struct omap_iommu *obj, |
197 | struct iotlb_entry *e) | ||
197 | { | 198 | { |
198 | struct cr_regs *cr; | 199 | struct cr_regs *cr; |
199 | 200 | ||
@@ -230,7 +231,8 @@ static u32 omap2_get_pte_attr(struct iotlb_entry *e) | |||
230 | return attr; | 231 | return attr; |
231 | } | 232 | } |
232 | 233 | ||
233 | static ssize_t omap2_dump_cr(struct iommu *obj, struct cr_regs *cr, char *buf) | 234 | static ssize_t |
235 | omap2_dump_cr(struct omap_iommu *obj, struct cr_regs *cr, char *buf) | ||
234 | { | 236 | { |
235 | char *p = buf; | 237 | char *p = buf; |
236 | 238 | ||
@@ -254,7 +256,8 @@ static ssize_t omap2_dump_cr(struct iommu *obj, struct cr_regs *cr, char *buf) | |||
254 | goto out; \ | 256 | goto out; \ |
255 | } while (0) | 257 | } while (0) |
256 | 258 | ||
257 | static ssize_t omap2_iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t len) | 259 | static ssize_t |
260 | omap2_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len) | ||
258 | { | 261 | { |
259 | char *p = buf; | 262 | char *p = buf; |
260 | 263 | ||
@@ -280,7 +283,7 @@ out: | |||
280 | return p - buf; | 283 | return p - buf; |
281 | } | 284 | } |
282 | 285 | ||
283 | static void omap2_iommu_save_ctx(struct iommu *obj) | 286 | static void omap2_iommu_save_ctx(struct omap_iommu *obj) |
284 | { | 287 | { |
285 | int i; | 288 | int i; |
286 | u32 *p = obj->ctx; | 289 | u32 *p = obj->ctx; |
@@ -293,7 +296,7 @@ static void omap2_iommu_save_ctx(struct iommu *obj) | |||
293 | BUG_ON(p[0] != IOMMU_ARCH_VERSION); | 296 | BUG_ON(p[0] != IOMMU_ARCH_VERSION); |
294 | } | 297 | } |
295 | 298 | ||
296 | static void omap2_iommu_restore_ctx(struct iommu *obj) | 299 | static void omap2_iommu_restore_ctx(struct omap_iommu *obj) |
297 | { | 300 | { |
298 | int i; | 301 | int i; |
299 | u32 *p = obj->ctx; | 302 | u32 *p = obj->ctx; |
@@ -343,13 +346,13 @@ static const struct iommu_functions omap2_iommu_ops = { | |||
343 | 346 | ||
344 | static int __init omap2_iommu_init(void) | 347 | static int __init omap2_iommu_init(void) |
345 | { | 348 | { |
346 | return install_iommu_arch(&omap2_iommu_ops); | 349 | return omap_install_iommu_arch(&omap2_iommu_ops); |
347 | } | 350 | } |
348 | module_init(omap2_iommu_init); | 351 | module_init(omap2_iommu_init); |
349 | 352 | ||
350 | static void __exit omap2_iommu_exit(void) | 353 | static void __exit omap2_iommu_exit(void) |
351 | { | 354 | { |
352 | uninstall_iommu_arch(&omap2_iommu_ops); | 355 | omap_uninstall_iommu_arch(&omap2_iommu_ops); |
353 | } | 356 | } |
354 | module_exit(omap2_iommu_exit); | 357 | module_exit(omap2_iommu_exit); |
355 | 358 | ||
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h index 9ae1e279864a..7f1df0e18d51 100644 --- a/arch/arm/plat-omap/include/plat/iommu.h +++ b/arch/arm/plat-omap/include/plat/iommu.h | |||
@@ -25,7 +25,7 @@ struct iotlb_entry { | |||
25 | }; | 25 | }; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | struct iommu { | 28 | struct omap_iommu { |
29 | const char *name; | 29 | const char *name; |
30 | struct module *owner; | 30 | struct module *owner; |
31 | struct clk *clk; | 31 | struct clk *clk; |
@@ -48,7 +48,7 @@ struct iommu { | |||
48 | struct list_head mmap; | 48 | struct list_head mmap; |
49 | struct mutex mmap_lock; /* protect mmap */ | 49 | struct mutex mmap_lock; /* protect mmap */ |
50 | 50 | ||
51 | int (*isr)(struct iommu *obj, u32 da, u32 iommu_errs, void *priv); | 51 | int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs, void *priv); |
52 | 52 | ||
53 | void *ctx; /* iommu context: registres saved area */ | 53 | void *ctx; /* iommu context: registres saved area */ |
54 | u32 da_start; | 54 | u32 da_start; |
@@ -81,25 +81,27 @@ struct iotlb_lock { | |||
81 | struct iommu_functions { | 81 | struct iommu_functions { |
82 | unsigned long version; | 82 | unsigned long version; |
83 | 83 | ||
84 | int (*enable)(struct iommu *obj); | 84 | int (*enable)(struct omap_iommu *obj); |
85 | void (*disable)(struct iommu *obj); | 85 | void (*disable)(struct omap_iommu *obj); |
86 | void (*set_twl)(struct iommu *obj, bool on); | 86 | void (*set_twl)(struct omap_iommu *obj, bool on); |
87 | u32 (*fault_isr)(struct iommu *obj, u32 *ra); | 87 | u32 (*fault_isr)(struct omap_iommu *obj, u32 *ra); |
88 | 88 | ||
89 | void (*tlb_read_cr)(struct iommu *obj, struct cr_regs *cr); | 89 | void (*tlb_read_cr)(struct omap_iommu *obj, struct cr_regs *cr); |
90 | void (*tlb_load_cr)(struct iommu *obj, struct cr_regs *cr); | 90 | void (*tlb_load_cr)(struct omap_iommu *obj, struct cr_regs *cr); |
91 | 91 | ||
92 | struct cr_regs *(*alloc_cr)(struct iommu *obj, struct iotlb_entry *e); | 92 | struct cr_regs *(*alloc_cr)(struct omap_iommu *obj, |
93 | struct iotlb_entry *e); | ||
93 | int (*cr_valid)(struct cr_regs *cr); | 94 | int (*cr_valid)(struct cr_regs *cr); |
94 | u32 (*cr_to_virt)(struct cr_regs *cr); | 95 | u32 (*cr_to_virt)(struct cr_regs *cr); |
95 | void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e); | 96 | void (*cr_to_e)(struct cr_regs *cr, struct iotlb_entry *e); |
96 | ssize_t (*dump_cr)(struct iommu *obj, struct cr_regs *cr, char *buf); | 97 | ssize_t (*dump_cr)(struct omap_iommu *obj, struct cr_regs *cr, |
98 | char *buf); | ||
97 | 99 | ||
98 | u32 (*get_pte_attr)(struct iotlb_entry *e); | 100 | u32 (*get_pte_attr)(struct iotlb_entry *e); |
99 | 101 | ||
100 | void (*save_ctx)(struct iommu *obj); | 102 | void (*save_ctx)(struct omap_iommu *obj); |
101 | void (*restore_ctx)(struct iommu *obj); | 103 | void (*restore_ctx)(struct omap_iommu *obj); |
102 | ssize_t (*dump_ctx)(struct iommu *obj, char *buf, ssize_t len); | 104 | ssize_t (*dump_ctx)(struct omap_iommu *obj, char *buf, ssize_t len); |
103 | }; | 105 | }; |
104 | 106 | ||
105 | struct iommu_platform_data { | 107 | struct iommu_platform_data { |
@@ -150,28 +152,31 @@ struct iommu_platform_data { | |||
150 | /* | 152 | /* |
151 | * global functions | 153 | * global functions |
152 | */ | 154 | */ |
153 | extern u32 iommu_arch_version(void); | 155 | extern u32 omap_iommu_arch_version(void); |
154 | 156 | ||
155 | extern void iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); | 157 | extern void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e); |
156 | 158 | ||
157 | extern int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e); | 159 | extern int |
160 | omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e); | ||
158 | 161 | ||
159 | extern int iommu_set_isr(const char *name, | 162 | extern int omap_iommu_set_isr(const char *name, |
160 | int (*isr)(struct iommu *obj, u32 da, u32 iommu_errs, | 163 | int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs, |
161 | void *priv), | 164 | void *priv), |
162 | void *isr_priv); | 165 | void *isr_priv); |
163 | 166 | ||
164 | extern void iommu_save_ctx(struct iommu *obj); | 167 | extern void omap_iommu_save_ctx(struct omap_iommu *obj); |
165 | extern void iommu_restore_ctx(struct iommu *obj); | 168 | extern void omap_iommu_restore_ctx(struct omap_iommu *obj); |
166 | 169 | ||
167 | extern int install_iommu_arch(const struct iommu_functions *ops); | 170 | extern int omap_install_iommu_arch(const struct iommu_functions *ops); |
168 | extern void uninstall_iommu_arch(const struct iommu_functions *ops); | 171 | extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops); |
169 | 172 | ||
170 | extern int foreach_iommu_device(void *data, | 173 | extern int omap_foreach_iommu_device(void *data, |
171 | int (*fn)(struct device *, void *)); | 174 | int (*fn)(struct device *, void *)); |
172 | 175 | ||
173 | extern ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t len); | 176 | extern ssize_t |
174 | extern size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t len); | 177 | omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); |
178 | extern size_t | ||
179 | omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len); | ||
175 | struct device *omap_find_iommu_device(const char *name); | 180 | struct device *omap_find_iommu_device(const char *name); |
176 | 181 | ||
177 | #endif /* __MACH_IOMMU_H */ | 182 | #endif /* __MACH_IOMMU_H */ |
diff --git a/arch/arm/plat-omap/include/plat/iommu2.h b/arch/arm/plat-omap/include/plat/iommu2.h index 10ad05f410e9..d4116b595e40 100644 --- a/arch/arm/plat-omap/include/plat/iommu2.h +++ b/arch/arm/plat-omap/include/plat/iommu2.h | |||
@@ -83,12 +83,12 @@ | |||
83 | /* | 83 | /* |
84 | * register accessors | 84 | * register accessors |
85 | */ | 85 | */ |
86 | static inline u32 iommu_read_reg(struct iommu *obj, size_t offs) | 86 | static inline u32 iommu_read_reg(struct omap_iommu *obj, size_t offs) |
87 | { | 87 | { |
88 | return __raw_readl(obj->regbase + offs); | 88 | return __raw_readl(obj->regbase + offs); |
89 | } | 89 | } |
90 | 90 | ||
91 | static inline void iommu_write_reg(struct iommu *obj, u32 val, size_t offs) | 91 | static inline void iommu_write_reg(struct omap_iommu *obj, u32 val, size_t offs) |
92 | { | 92 | { |
93 | __raw_writel(val, obj->regbase + offs); | 93 | __raw_writel(val, obj->regbase + offs); |
94 | } | 94 | } |
diff --git a/arch/arm/plat-omap/include/plat/iopgtable.h b/arch/arm/plat-omap/include/plat/iopgtable.h index 33c7aa986f53..66a813977d52 100644 --- a/arch/arm/plat-omap/include/plat/iopgtable.h +++ b/arch/arm/plat-omap/include/plat/iopgtable.h | |||
@@ -115,6 +115,6 @@ static inline u32 iotlb_init_entry(struct iotlb_entry *e, u32 da, u32 pa, | |||
115 | } | 115 | } |
116 | 116 | ||
117 | #define to_iommu(dev) \ | 117 | #define to_iommu(dev) \ |
118 | (struct iommu *)platform_get_drvdata(to_platform_device(dev)) | 118 | (struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)) |
119 | 119 | ||
120 | #endif /* __PLAT_OMAP_IOMMU_H */ | 120 | #endif /* __PLAT_OMAP_IOMMU_H */ |
diff --git a/arch/arm/plat-omap/include/plat/iovmm.h b/arch/arm/plat-omap/include/plat/iovmm.h index fc9aa6fe590f..6af1a91c0f36 100644 --- a/arch/arm/plat-omap/include/plat/iovmm.h +++ b/arch/arm/plat-omap/include/plat/iovmm.h | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/iommu.h> | 16 | #include <linux/iommu.h> |
17 | 17 | ||
18 | struct iovm_struct { | 18 | struct iovm_struct { |
19 | struct iommu *iommu; /* iommu object which this belongs to */ | 19 | struct omap_iommu *iommu; /* iommu object which this belongs to */ |
20 | u32 da_start; /* area definition */ | 20 | u32 da_start; /* area definition */ |
21 | u32 da_end; | 21 | u32 da_end; |
22 | u32 flags; /* IOVMF_: see below */ | 22 | u32 flags; /* IOVMF_: see below */ |
@@ -72,15 +72,18 @@ struct iovm_struct { | |||
72 | #define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT)) | 72 | #define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT)) |
73 | 73 | ||
74 | 74 | ||
75 | extern struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da); | 75 | extern struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da); |
76 | extern u32 iommu_vmap(struct iommu_domain *domain, struct iommu *obj, u32 da, | 76 | extern u32 |
77 | omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | ||
77 | const struct sg_table *sgt, u32 flags); | 78 | const struct sg_table *sgt, u32 flags); |
78 | extern struct sg_table *iommu_vunmap(struct iommu_domain *domain, | 79 | extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain, |
79 | struct iommu *obj, u32 da); | 80 | struct omap_iommu *obj, u32 da); |
80 | extern u32 iommu_vmalloc(struct iommu_domain *domain, struct iommu *obj, | 81 | extern u32 |
82 | omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, | ||
81 | u32 da, size_t bytes, u32 flags); | 83 | u32 da, size_t bytes, u32 flags); |
82 | extern void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, | 84 | extern void |
85 | omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj, | ||
83 | const u32 da); | 86 | const u32 da); |
84 | extern void *da_to_va(struct iommu *obj, u32 da); | 87 | extern void *omap_da_to_va(struct omap_iommu *obj, u32 da); |
85 | 88 | ||
86 | #endif /* __IOMMU_MMAP_H */ | 89 | #endif /* __IOMMU_MMAP_H */ |