aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2011-08-17 15:57:56 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2011-08-26 05:46:01 -0400
commit6c32df437c7c5b1fc29d3ca29b0ff44f8dfafc56 (patch)
tree939d751cbae86291f6b5152cee4615284165fece /drivers
parent384fa675795ae3796dbc263e5d0f35b9a27d6462 (diff)
omap: iommu: omapify 'struct iommu' and exposed API
Prepend 'omap_' to OMAP's 'struct iommu' and exposed API, to prevent namespace pollution and generally to improve readability of the code that still uses the driver directly. Update the users as needed as well. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iommu/omap-iommu-debug.c34
-rw-r--r--drivers/iommu/omap-iommu.c146
-rw-r--r--drivers/iommu/omap-iovmm.c62
-rw-r--r--drivers/media/video/omap3isp/isp.c6
-rw-r--r--drivers/media/video/omap3isp/isp.h2
-rw-r--r--drivers/media/video/omap3isp/ispccdc.c23
-rw-r--r--drivers/media/video/omap3isp/ispstat.c9
-rw-r--r--drivers/media/video/omap3isp/ispvideo.c4
8 files changed, 147 insertions, 139 deletions
diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c
index 0f8c8dd55018..9c192e79f806 100644
--- a/drivers/iommu/omap-iommu-debug.c
+++ b/drivers/iommu/omap-iommu-debug.c
@@ -32,7 +32,7 @@ static struct dentry *iommu_debug_root;
32static ssize_t debug_read_ver(struct file *file, char __user *userbuf, 32static ssize_t debug_read_ver(struct file *file, char __user *userbuf,
33 size_t count, loff_t *ppos) 33 size_t count, loff_t *ppos)
34{ 34{
35 u32 ver = iommu_arch_version(); 35 u32 ver = omap_iommu_arch_version();
36 char buf[MAXCOLUMN], *p = buf; 36 char buf[MAXCOLUMN], *p = buf;
37 37
38 p += sprintf(p, "H/W version: %d.%d\n", (ver >> 4) & 0xf , ver & 0xf); 38 p += sprintf(p, "H/W version: %d.%d\n", (ver >> 4) & 0xf , ver & 0xf);
@@ -43,7 +43,7 @@ static ssize_t debug_read_ver(struct file *file, char __user *userbuf,
43static ssize_t debug_read_regs(struct file *file, char __user *userbuf, 43static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
44 size_t count, loff_t *ppos) 44 size_t count, loff_t *ppos)
45{ 45{
46 struct iommu *obj = file->private_data; 46 struct omap_iommu *obj = file->private_data;
47 char *p, *buf; 47 char *p, *buf;
48 ssize_t bytes; 48 ssize_t bytes;
49 49
@@ -54,7 +54,7 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
54 54
55 mutex_lock(&iommu_debug_lock); 55 mutex_lock(&iommu_debug_lock);
56 56
57 bytes = iommu_dump_ctx(obj, p, count); 57 bytes = omap_iommu_dump_ctx(obj, p, count);
58 bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes); 58 bytes = simple_read_from_buffer(userbuf, count, ppos, buf, bytes);
59 59
60 mutex_unlock(&iommu_debug_lock); 60 mutex_unlock(&iommu_debug_lock);
@@ -66,7 +66,7 @@ static ssize_t debug_read_regs(struct file *file, char __user *userbuf,
66static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, 66static ssize_t debug_read_tlb(struct file *file, char __user *userbuf,
67 size_t count, loff_t *ppos) 67 size_t count, loff_t *ppos)
68{ 68{
69 struct iommu *obj = file->private_data; 69 struct omap_iommu *obj = file->private_data;
70 char *p, *buf; 70 char *p, *buf;
71 ssize_t bytes, rest; 71 ssize_t bytes, rest;
72 72
@@ -80,7 +80,7 @@ static ssize_t debug_read_tlb(struct file *file, char __user *userbuf,
80 p += sprintf(p, "%8s %8s\n", "cam:", "ram:"); 80 p += sprintf(p, "%8s %8s\n", "cam:", "ram:");
81 p += sprintf(p, "-----------------------------------------\n"); 81 p += sprintf(p, "-----------------------------------------\n");
82 rest = count - (p - buf); 82 rest = count - (p - buf);
83 p += dump_tlb_entries(obj, p, rest); 83 p += omap_dump_tlb_entries(obj, p, rest);
84 84
85 bytes = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf); 85 bytes = simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
86 86
@@ -96,7 +96,7 @@ static ssize_t debug_write_pagetable(struct file *file,
96 struct iotlb_entry e; 96 struct iotlb_entry e;
97 struct cr_regs cr; 97 struct cr_regs cr;
98 int err; 98 int err;
99 struct iommu *obj = file->private_data; 99 struct omap_iommu *obj = file->private_data;
100 char buf[MAXCOLUMN], *p = buf; 100 char buf[MAXCOLUMN], *p = buf;
101 101
102 count = min(count, sizeof(buf)); 102 count = min(count, sizeof(buf));
@@ -113,8 +113,8 @@ static ssize_t debug_write_pagetable(struct file *file,
113 return -EINVAL; 113 return -EINVAL;
114 } 114 }
115 115
116 iotlb_cr_to_e(&cr, &e); 116 omap_iotlb_cr_to_e(&cr, &e);
117 err = iopgtable_store_entry(obj, &e); 117 err = omap_iopgtable_store_entry(obj, &e);
118 if (err) 118 if (err)
119 dev_err(obj->dev, "%s: fail to store cr\n", __func__); 119 dev_err(obj->dev, "%s: fail to store cr\n", __func__);
120 120
@@ -136,7 +136,7 @@ static ssize_t debug_write_pagetable(struct file *file,
136 __err; \ 136 __err; \
137 }) 137 })
138 138
139static ssize_t dump_ioptable(struct iommu *obj, char *buf, ssize_t len) 139static ssize_t dump_ioptable(struct omap_iommu *obj, char *buf, ssize_t len)
140{ 140{
141 int i; 141 int i;
142 u32 *iopgd; 142 u32 *iopgd;
@@ -183,7 +183,7 @@ out:
183static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, 183static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf,
184 size_t count, loff_t *ppos) 184 size_t count, loff_t *ppos)
185{ 185{
186 struct iommu *obj = file->private_data; 186 struct omap_iommu *obj = file->private_data;
187 char *p, *buf; 187 char *p, *buf;
188 size_t bytes; 188 size_t bytes;
189 189
@@ -211,7 +211,7 @@ static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf,
211static ssize_t debug_read_mmap(struct file *file, char __user *userbuf, 211static ssize_t debug_read_mmap(struct file *file, char __user *userbuf,
212 size_t count, loff_t *ppos) 212 size_t count, loff_t *ppos)
213{ 213{
214 struct iommu *obj = file->private_data; 214 struct omap_iommu *obj = file->private_data;
215 char *p, *buf; 215 char *p, *buf;
216 struct iovm_struct *tmp; 216 struct iovm_struct *tmp;
217 int uninitialized_var(i); 217 int uninitialized_var(i);
@@ -253,7 +253,7 @@ static ssize_t debug_read_mmap(struct file *file, char __user *userbuf,
253static ssize_t debug_read_mem(struct file *file, char __user *userbuf, 253static ssize_t debug_read_mem(struct file *file, char __user *userbuf,
254 size_t count, loff_t *ppos) 254 size_t count, loff_t *ppos)
255{ 255{
256 struct iommu *obj = file->private_data; 256 struct omap_iommu *obj = file->private_data;
257 char *p, *buf; 257 char *p, *buf;
258 struct iovm_struct *area; 258 struct iovm_struct *area;
259 ssize_t bytes; 259 ssize_t bytes;
@@ -267,7 +267,7 @@ static ssize_t debug_read_mem(struct file *file, char __user *userbuf,
267 267
268 mutex_lock(&iommu_debug_lock); 268 mutex_lock(&iommu_debug_lock);
269 269
270 area = find_iovm_area(obj, (u32)ppos); 270 area = omap_find_iovm_area(obj, (u32)ppos);
271 if (IS_ERR(area)) { 271 if (IS_ERR(area)) {
272 bytes = -EINVAL; 272 bytes = -EINVAL;
273 goto err_out; 273 goto err_out;
@@ -286,7 +286,7 @@ err_out:
286static ssize_t debug_write_mem(struct file *file, const char __user *userbuf, 286static ssize_t debug_write_mem(struct file *file, const char __user *userbuf,
287 size_t count, loff_t *ppos) 287 size_t count, loff_t *ppos)
288{ 288{
289 struct iommu *obj = file->private_data; 289 struct omap_iommu *obj = file->private_data;
290 struct iovm_struct *area; 290 struct iovm_struct *area;
291 char *p, *buf; 291 char *p, *buf;
292 292
@@ -304,7 +304,7 @@ static ssize_t debug_write_mem(struct file *file, const char __user *userbuf,
304 goto err_out; 304 goto err_out;
305 } 305 }
306 306
307 area = find_iovm_area(obj, (u32)ppos); 307 area = omap_find_iovm_area(obj, (u32)ppos);
308 if (IS_ERR(area)) { 308 if (IS_ERR(area)) {
309 count = -EINVAL; 309 count = -EINVAL;
310 goto err_out; 310 goto err_out;
@@ -360,7 +360,7 @@ DEBUG_FOPS(mem);
360static int iommu_debug_register(struct device *dev, void *data) 360static int iommu_debug_register(struct device *dev, void *data)
361{ 361{
362 struct platform_device *pdev = to_platform_device(dev); 362 struct platform_device *pdev = to_platform_device(dev);
363 struct iommu *obj = platform_get_drvdata(pdev); 363 struct omap_iommu *obj = platform_get_drvdata(pdev);
364 struct dentry *d, *parent; 364 struct dentry *d, *parent;
365 365
366 if (!obj || !obj->dev) 366 if (!obj || !obj->dev)
@@ -396,7 +396,7 @@ static int __init iommu_debug_init(void)
396 return -ENOMEM; 396 return -ENOMEM;
397 iommu_debug_root = d; 397 iommu_debug_root = d;
398 398
399 err = foreach_iommu_device(d, iommu_debug_register); 399 err = omap_foreach_iommu_device(d, iommu_debug_register);
400 if (err) 400 if (err)
401 goto err_out; 401 goto err_out;
402 return 0; 402 return 0;
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index d0f28e73be67..dad45ab8cce3 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -42,7 +42,7 @@
42 */ 42 */
43struct omap_iommu_domain { 43struct omap_iommu_domain {
44 u32 *pgtable; 44 u32 *pgtable;
45 struct iommu *iommu_dev; 45 struct omap_iommu *iommu_dev;
46 spinlock_t lock; 46 spinlock_t lock;
47}; 47};
48 48
@@ -53,13 +53,13 @@ static struct platform_driver omap_iommu_driver;
53static struct kmem_cache *iopte_cachep; 53static struct kmem_cache *iopte_cachep;
54 54
55/** 55/**
56 * install_iommu_arch - Install archtecure specific iommu functions 56 * omap_install_iommu_arch - Install archtecure specific iommu functions
57 * @ops: a pointer to architecture specific iommu functions 57 * @ops: a pointer to architecture specific iommu functions
58 * 58 *
59 * There are several kind of iommu algorithm(tlb, pagetable) among 59 * There are several kind of iommu algorithm(tlb, pagetable) among
60 * omap series. This interface installs such an iommu algorighm. 60 * omap series. This interface installs such an iommu algorighm.
61 **/ 61 **/
62int install_iommu_arch(const struct iommu_functions *ops) 62int omap_install_iommu_arch(const struct iommu_functions *ops)
63{ 63{
64 if (arch_iommu) 64 if (arch_iommu)
65 return -EBUSY; 65 return -EBUSY;
@@ -67,53 +67,53 @@ int install_iommu_arch(const struct iommu_functions *ops)
67 arch_iommu = ops; 67 arch_iommu = ops;
68 return 0; 68 return 0;
69} 69}
70EXPORT_SYMBOL_GPL(install_iommu_arch); 70EXPORT_SYMBOL_GPL(omap_install_iommu_arch);
71 71
72/** 72/**
73 * uninstall_iommu_arch - Uninstall archtecure specific iommu functions 73 * omap_uninstall_iommu_arch - Uninstall archtecure specific iommu functions
74 * @ops: a pointer to architecture specific iommu functions 74 * @ops: a pointer to architecture specific iommu functions
75 * 75 *
76 * This interface uninstalls the iommu algorighm installed previously. 76 * This interface uninstalls the iommu algorighm installed previously.
77 **/ 77 **/
78void uninstall_iommu_arch(const struct iommu_functions *ops) 78void omap_uninstall_iommu_arch(const struct iommu_functions *ops)
79{ 79{
80 if (arch_iommu != ops) 80 if (arch_iommu != ops)
81 pr_err("%s: not your arch\n", __func__); 81 pr_err("%s: not your arch\n", __func__);
82 82
83 arch_iommu = NULL; 83 arch_iommu = NULL;
84} 84}
85EXPORT_SYMBOL_GPL(uninstall_iommu_arch); 85EXPORT_SYMBOL_GPL(omap_uninstall_iommu_arch);
86 86
87/** 87/**
88 * iommu_save_ctx - Save registers for pm off-mode support 88 * omap_iommu_save_ctx - Save registers for pm off-mode support
89 * @obj: target iommu 89 * @obj: target iommu
90 **/ 90 **/
91void iommu_save_ctx(struct iommu *obj) 91void omap_iommu_save_ctx(struct omap_iommu *obj)
92{ 92{
93 arch_iommu->save_ctx(obj); 93 arch_iommu->save_ctx(obj);
94} 94}
95EXPORT_SYMBOL_GPL(iommu_save_ctx); 95EXPORT_SYMBOL_GPL(omap_iommu_save_ctx);
96 96
97/** 97/**
98 * iommu_restore_ctx - Restore registers for pm off-mode support 98 * omap_iommu_restore_ctx - Restore registers for pm off-mode support
99 * @obj: target iommu 99 * @obj: target iommu
100 **/ 100 **/
101void iommu_restore_ctx(struct iommu *obj) 101void omap_iommu_restore_ctx(struct omap_iommu *obj)
102{ 102{
103 arch_iommu->restore_ctx(obj); 103 arch_iommu->restore_ctx(obj);
104} 104}
105EXPORT_SYMBOL_GPL(iommu_restore_ctx); 105EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx);
106 106
107/** 107/**
108 * iommu_arch_version - Return running iommu arch version 108 * omap_iommu_arch_version - Return running iommu arch version
109 **/ 109 **/
110u32 iommu_arch_version(void) 110u32 omap_iommu_arch_version(void)
111{ 111{
112 return arch_iommu->version; 112 return arch_iommu->version;
113} 113}
114EXPORT_SYMBOL_GPL(iommu_arch_version); 114EXPORT_SYMBOL_GPL(omap_iommu_arch_version);
115 115
116static int iommu_enable(struct iommu *obj) 116static int iommu_enable(struct omap_iommu *obj)
117{ 117{
118 int err; 118 int err;
119 119
@@ -131,7 +131,7 @@ static int iommu_enable(struct iommu *obj)
131 return err; 131 return err;
132} 132}
133 133
134static void iommu_disable(struct iommu *obj) 134static void iommu_disable(struct omap_iommu *obj)
135{ 135{
136 if (!obj) 136 if (!obj)
137 return; 137 return;
@@ -146,13 +146,13 @@ static void iommu_disable(struct iommu *obj)
146/* 146/*
147 * TLB operations 147 * TLB operations
148 */ 148 */
149void iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e) 149void omap_iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e)
150{ 150{
151 BUG_ON(!cr || !e); 151 BUG_ON(!cr || !e);
152 152
153 arch_iommu->cr_to_e(cr, e); 153 arch_iommu->cr_to_e(cr, e);
154} 154}
155EXPORT_SYMBOL_GPL(iotlb_cr_to_e); 155EXPORT_SYMBOL_GPL(omap_iotlb_cr_to_e);
156 156
157static inline int iotlb_cr_valid(struct cr_regs *cr) 157static inline int iotlb_cr_valid(struct cr_regs *cr)
158{ 158{
@@ -162,7 +162,7 @@ static inline int iotlb_cr_valid(struct cr_regs *cr)
162 return arch_iommu->cr_valid(cr); 162 return arch_iommu->cr_valid(cr);
163} 163}
164 164
165static inline struct cr_regs *iotlb_alloc_cr(struct iommu *obj, 165static inline struct cr_regs *iotlb_alloc_cr(struct omap_iommu *obj,
166 struct iotlb_entry *e) 166 struct iotlb_entry *e)
167{ 167{
168 if (!e) 168 if (!e)
@@ -181,12 +181,12 @@ static u32 get_iopte_attr(struct iotlb_entry *e)
181 return arch_iommu->get_pte_attr(e); 181 return arch_iommu->get_pte_attr(e);
182} 182}
183 183
184static u32 iommu_report_fault(struct iommu *obj, u32 *da) 184static u32 iommu_report_fault(struct omap_iommu *obj, u32 *da)
185{ 185{
186 return arch_iommu->fault_isr(obj, da); 186 return arch_iommu->fault_isr(obj, da);
187} 187}
188 188
189static void iotlb_lock_get(struct iommu *obj, struct iotlb_lock *l) 189static void iotlb_lock_get(struct omap_iommu *obj, struct iotlb_lock *l)
190{ 190{
191 u32 val; 191 u32 val;
192 192
@@ -197,7 +197,7 @@ static void iotlb_lock_get(struct iommu *obj, struct iotlb_lock *l)
197 197
198} 198}
199 199
200static void iotlb_lock_set(struct iommu *obj, struct iotlb_lock *l) 200static void iotlb_lock_set(struct omap_iommu *obj, struct iotlb_lock *l)
201{ 201{
202 u32 val; 202 u32 val;
203 203
@@ -207,12 +207,12 @@ static void iotlb_lock_set(struct iommu *obj, struct iotlb_lock *l)
207 iommu_write_reg(obj, val, MMU_LOCK); 207 iommu_write_reg(obj, val, MMU_LOCK);
208} 208}
209 209
210static void iotlb_read_cr(struct iommu *obj, struct cr_regs *cr) 210static void iotlb_read_cr(struct omap_iommu *obj, struct cr_regs *cr)
211{ 211{
212 arch_iommu->tlb_read_cr(obj, cr); 212 arch_iommu->tlb_read_cr(obj, cr);
213} 213}
214 214
215static void iotlb_load_cr(struct iommu *obj, struct cr_regs *cr) 215static void iotlb_load_cr(struct omap_iommu *obj, struct cr_regs *cr)
216{ 216{
217 arch_iommu->tlb_load_cr(obj, cr); 217 arch_iommu->tlb_load_cr(obj, cr);
218 218
@@ -226,7 +226,7 @@ static void iotlb_load_cr(struct iommu *obj, struct cr_regs *cr)
226 * @cr: contents of cam and ram register 226 * @cr: contents of cam and ram register
227 * @buf: output buffer 227 * @buf: output buffer
228 **/ 228 **/
229static inline ssize_t iotlb_dump_cr(struct iommu *obj, struct cr_regs *cr, 229static inline ssize_t iotlb_dump_cr(struct omap_iommu *obj, struct cr_regs *cr,
230 char *buf) 230 char *buf)
231{ 231{
232 BUG_ON(!cr || !buf); 232 BUG_ON(!cr || !buf);
@@ -235,7 +235,7 @@ static inline ssize_t iotlb_dump_cr(struct iommu *obj, struct cr_regs *cr,
235} 235}
236 236
237/* only used in iotlb iteration for-loop */ 237/* only used in iotlb iteration for-loop */
238static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n) 238static struct cr_regs __iotlb_read_cr(struct omap_iommu *obj, int n)
239{ 239{
240 struct cr_regs cr; 240 struct cr_regs cr;
241 struct iotlb_lock l; 241 struct iotlb_lock l;
@@ -254,7 +254,7 @@ static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n)
254 * @e: an iommu tlb entry info 254 * @e: an iommu tlb entry info
255 **/ 255 **/
256#ifdef PREFETCH_IOTLB 256#ifdef PREFETCH_IOTLB
257static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) 257static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)
258{ 258{
259 int err = 0; 259 int err = 0;
260 struct iotlb_lock l; 260 struct iotlb_lock l;
@@ -313,14 +313,14 @@ out:
313 313
314#else /* !PREFETCH_IOTLB */ 314#else /* !PREFETCH_IOTLB */
315 315
316static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) 316static int load_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)
317{ 317{
318 return 0; 318 return 0;
319} 319}
320 320
321#endif /* !PREFETCH_IOTLB */ 321#endif /* !PREFETCH_IOTLB */
322 322
323static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) 323static int prefetch_iotlb_entry(struct omap_iommu *obj, struct iotlb_entry *e)
324{ 324{
325 return load_iotlb_entry(obj, e); 325 return load_iotlb_entry(obj, e);
326} 326}
@@ -332,7 +332,7 @@ static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e)
332 * 332 *
333 * Clear an iommu tlb entry which includes 'da' address. 333 * Clear an iommu tlb entry which includes 'da' address.
334 **/ 334 **/
335static void flush_iotlb_page(struct iommu *obj, u32 da) 335static void flush_iotlb_page(struct omap_iommu *obj, u32 da)
336{ 336{
337 int i; 337 int i;
338 struct cr_regs cr; 338 struct cr_regs cr;
@@ -366,7 +366,7 @@ static void flush_iotlb_page(struct iommu *obj, u32 da)
366 * flush_iotlb_all - Clear all iommu tlb entries 366 * flush_iotlb_all - Clear all iommu tlb entries
367 * @obj: target iommu 367 * @obj: target iommu
368 **/ 368 **/
369static void flush_iotlb_all(struct iommu *obj) 369static void flush_iotlb_all(struct omap_iommu *obj)
370{ 370{
371 struct iotlb_lock l; 371 struct iotlb_lock l;
372 372
@@ -383,7 +383,7 @@ static void flush_iotlb_all(struct iommu *obj)
383 383
384#if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE) 384#if defined(CONFIG_OMAP_IOMMU_DEBUG_MODULE)
385 385
386ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes) 386ssize_t omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t bytes)
387{ 387{
388 if (!obj || !buf) 388 if (!obj || !buf)
389 return -EINVAL; 389 return -EINVAL;
@@ -396,9 +396,10 @@ ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes)
396 396
397 return bytes; 397 return bytes;
398} 398}
399EXPORT_SYMBOL_GPL(iommu_dump_ctx); 399EXPORT_SYMBOL_GPL(omap_iommu_dump_ctx);
400 400
401static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num) 401static int
402__dump_tlb_entries(struct omap_iommu *obj, struct cr_regs *crs, int num)
402{ 403{
403 int i; 404 int i;
404 struct iotlb_lock saved; 405 struct iotlb_lock saved;
@@ -421,11 +422,11 @@ static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num)
421} 422}
422 423
423/** 424/**
424 * dump_tlb_entries - dump cr arrays to given buffer 425 * omap_dump_tlb_entries - dump cr arrays to given buffer
425 * @obj: target iommu 426 * @obj: target iommu
426 * @buf: output buffer 427 * @buf: output buffer
427 **/ 428 **/
428size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t bytes) 429size_t omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t bytes)
429{ 430{
430 int i, num; 431 int i, num;
431 struct cr_regs *cr; 432 struct cr_regs *cr;
@@ -445,14 +446,14 @@ size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t bytes)
445 446
446 return p - buf; 447 return p - buf;
447} 448}
448EXPORT_SYMBOL_GPL(dump_tlb_entries); 449EXPORT_SYMBOL_GPL(omap_dump_tlb_entries);
449 450
450int foreach_iommu_device(void *data, int (*fn)(struct device *, void *)) 451int omap_foreach_iommu_device(void *data, int (*fn)(struct device *, void *))
451{ 452{
452 return driver_for_each_device(&omap_iommu_driver.driver, 453 return driver_for_each_device(&omap_iommu_driver.driver,
453 NULL, data, fn); 454 NULL, data, fn);
454} 455}
455EXPORT_SYMBOL_GPL(foreach_iommu_device); 456EXPORT_SYMBOL_GPL(omap_foreach_iommu_device);
456 457
457#endif /* CONFIG_OMAP_IOMMU_DEBUG_MODULE */ 458#endif /* CONFIG_OMAP_IOMMU_DEBUG_MODULE */
458 459
@@ -485,7 +486,7 @@ static void iopte_free(u32 *iopte)
485 kmem_cache_free(iopte_cachep, iopte); 486 kmem_cache_free(iopte_cachep, iopte);
486} 487}
487 488
488static u32 *iopte_alloc(struct iommu *obj, u32 *iopgd, u32 da) 489static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd, u32 da)
489{ 490{
490 u32 *iopte; 491 u32 *iopte;
491 492
@@ -523,7 +524,7 @@ pte_ready:
523 return iopte; 524 return iopte;
524} 525}
525 526
526static int iopgd_alloc_section(struct iommu *obj, u32 da, u32 pa, u32 prot) 527static int iopgd_alloc_section(struct omap_iommu *obj, u32 da, u32 pa, u32 prot)
527{ 528{
528 u32 *iopgd = iopgd_offset(obj, da); 529 u32 *iopgd = iopgd_offset(obj, da);
529 530
@@ -538,7 +539,7 @@ static int iopgd_alloc_section(struct iommu *obj, u32 da, u32 pa, u32 prot)
538 return 0; 539 return 0;
539} 540}
540 541
541static int iopgd_alloc_super(struct iommu *obj, u32 da, u32 pa, u32 prot) 542static int iopgd_alloc_super(struct omap_iommu *obj, u32 da, u32 pa, u32 prot)
542{ 543{
543 u32 *iopgd = iopgd_offset(obj, da); 544 u32 *iopgd = iopgd_offset(obj, da);
544 int i; 545 int i;
@@ -555,7 +556,7 @@ static int iopgd_alloc_super(struct iommu *obj, u32 da, u32 pa, u32 prot)
555 return 0; 556 return 0;
556} 557}
557 558
558static int iopte_alloc_page(struct iommu *obj, u32 da, u32 pa, u32 prot) 559static int iopte_alloc_page(struct omap_iommu *obj, u32 da, u32 pa, u32 prot)
559{ 560{
560 u32 *iopgd = iopgd_offset(obj, da); 561 u32 *iopgd = iopgd_offset(obj, da);
561 u32 *iopte = iopte_alloc(obj, iopgd, da); 562 u32 *iopte = iopte_alloc(obj, iopgd, da);
@@ -572,7 +573,7 @@ static int iopte_alloc_page(struct iommu *obj, u32 da, u32 pa, u32 prot)
572 return 0; 573 return 0;
573} 574}
574 575
575static int iopte_alloc_large(struct iommu *obj, u32 da, u32 pa, u32 prot) 576static int iopte_alloc_large(struct omap_iommu *obj, u32 da, u32 pa, u32 prot)
576{ 577{
577 u32 *iopgd = iopgd_offset(obj, da); 578 u32 *iopgd = iopgd_offset(obj, da);
578 u32 *iopte = iopte_alloc(obj, iopgd, da); 579 u32 *iopte = iopte_alloc(obj, iopgd, da);
@@ -593,9 +594,10 @@ static int iopte_alloc_large(struct iommu *obj, u32 da, u32 pa, u32 prot)
593 return 0; 594 return 0;
594} 595}
595 596
596static int iopgtable_store_entry_core(struct iommu *obj, struct iotlb_entry *e) 597static int
598iopgtable_store_entry_core(struct omap_iommu *obj, struct iotlb_entry *e)
597{ 599{
598 int (*fn)(struct iommu *, u32, u32, u32); 600 int (*fn)(struct omap_iommu *, u32, u32, u32);
599 u32 prot; 601 u32 prot;
600 int err; 602 int err;
601 603
@@ -631,11 +633,11 @@ static int iopgtable_store_entry_core(struct iommu *obj, struct iotlb_entry *e)
631} 633}
632 634
633/** 635/**
634 * iopgtable_store_entry - Make an iommu pte entry 636 * omap_iopgtable_store_entry - Make an iommu pte entry
635 * @obj: target iommu 637 * @obj: target iommu
636 * @e: an iommu tlb entry info 638 * @e: an iommu tlb entry info
637 **/ 639 **/
638int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e) 640int omap_iopgtable_store_entry(struct omap_iommu *obj, struct iotlb_entry *e)
639{ 641{
640 int err; 642 int err;
641 643
@@ -645,7 +647,7 @@ int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e)
645 prefetch_iotlb_entry(obj, e); 647 prefetch_iotlb_entry(obj, e);
646 return err; 648 return err;
647} 649}
648EXPORT_SYMBOL_GPL(iopgtable_store_entry); 650EXPORT_SYMBOL_GPL(omap_iopgtable_store_entry);
649 651
650/** 652/**
651 * iopgtable_lookup_entry - Lookup an iommu pte entry 653 * iopgtable_lookup_entry - Lookup an iommu pte entry
@@ -670,7 +672,7 @@ out:
670 *ppte = iopte; 672 *ppte = iopte;
671} 673}
672 674
673static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da) 675static size_t iopgtable_clear_entry_core(struct omap_iommu *obj, u32 da)
674{ 676{
675 size_t bytes; 677 size_t bytes;
676 u32 *iopgd = iopgd_offset(obj, da); 678 u32 *iopgd = iopgd_offset(obj, da);
@@ -723,7 +725,7 @@ out:
723 * @obj: target iommu 725 * @obj: target iommu
724 * @da: iommu device virtual address 726 * @da: iommu device virtual address
725 **/ 727 **/
726static size_t iopgtable_clear_entry(struct iommu *obj, u32 da) 728static size_t iopgtable_clear_entry(struct omap_iommu *obj, u32 da)
727{ 729{
728 size_t bytes; 730 size_t bytes;
729 731
@@ -737,7 +739,7 @@ static size_t iopgtable_clear_entry(struct iommu *obj, u32 da)
737 return bytes; 739 return bytes;
738} 740}
739 741
740static void iopgtable_clear_entry_all(struct iommu *obj) 742static void iopgtable_clear_entry_all(struct omap_iommu *obj)
741{ 743{
742 int i; 744 int i;
743 745
@@ -772,7 +774,7 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)
772{ 774{
773 u32 da, errs; 775 u32 da, errs;
774 u32 *iopgd, *iopte; 776 u32 *iopgd, *iopte;
775 struct iommu *obj = data; 777 struct omap_iommu *obj = data;
776 778
777 if (!obj->refcount) 779 if (!obj->refcount)
778 return IRQ_NONE; 780 return IRQ_NONE;
@@ -808,7 +810,7 @@ static irqreturn_t iommu_fault_handler(int irq, void *data)
808 810
809static int device_match_by_alias(struct device *dev, void *data) 811static int device_match_by_alias(struct device *dev, void *data)
810{ 812{
811 struct iommu *obj = to_iommu(dev); 813 struct omap_iommu *obj = to_iommu(dev);
812 const char *name = data; 814 const char *name = data;
813 815
814 pr_debug("%s: %s %s\n", __func__, obj->name, name); 816 pr_debug("%s: %s %s\n", __func__, obj->name, name);
@@ -842,10 +844,10 @@ EXPORT_SYMBOL_GPL(omap_find_iommu_device);
842 * @dev: target omap iommu device 844 * @dev: target omap iommu device
843 * @iopgd: page table 845 * @iopgd: page table
844 **/ 846 **/
845static struct iommu *omap_iommu_attach(struct device *dev, u32 *iopgd) 847static struct omap_iommu *omap_iommu_attach(struct device *dev, u32 *iopgd)
846{ 848{
847 int err = -ENOMEM; 849 int err = -ENOMEM;
848 struct iommu *obj = to_iommu(dev); 850 struct omap_iommu *obj = to_iommu(dev);
849 851
850 spin_lock(&obj->iommu_lock); 852 spin_lock(&obj->iommu_lock);
851 853
@@ -883,7 +885,7 @@ err_enable:
883 * omap_iommu_detach - release iommu device 885 * omap_iommu_detach - release iommu device
884 * @obj: target iommu 886 * @obj: target iommu
885 **/ 887 **/
886static void omap_iommu_detach(struct iommu *obj) 888static void omap_iommu_detach(struct omap_iommu *obj)
887{ 889{
888 if (!obj || IS_ERR(obj)) 890 if (!obj || IS_ERR(obj))
889 return; 891 return;
@@ -902,13 +904,13 @@ static void omap_iommu_detach(struct iommu *obj)
902 dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name); 904 dev_dbg(obj->dev, "%s: %s\n", __func__, obj->name);
903} 905}
904 906
905int iommu_set_isr(const char *name, 907int omap_iommu_set_isr(const char *name,
906 int (*isr)(struct iommu *obj, u32 da, u32 iommu_errs, 908 int (*isr)(struct omap_iommu *obj, u32 da, u32 iommu_errs,
907 void *priv), 909 void *priv),
908 void *isr_priv) 910 void *isr_priv)
909{ 911{
910 struct device *dev; 912 struct device *dev;
911 struct iommu *obj; 913 struct omap_iommu *obj;
912 914
913 dev = driver_find_device(&omap_iommu_driver.driver, NULL, (void *)name, 915 dev = driver_find_device(&omap_iommu_driver.driver, NULL, (void *)name,
914 device_match_by_alias); 916 device_match_by_alias);
@@ -927,7 +929,7 @@ int iommu_set_isr(const char *name,
927 929
928 return 0; 930 return 0;
929} 931}
930EXPORT_SYMBOL_GPL(iommu_set_isr); 932EXPORT_SYMBOL_GPL(omap_iommu_set_isr);
931 933
932/* 934/*
933 * OMAP Device MMU(IOMMU) detection 935 * OMAP Device MMU(IOMMU) detection
@@ -936,7 +938,7 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev)
936{ 938{
937 int err = -ENODEV; 939 int err = -ENODEV;
938 int irq; 940 int irq;
939 struct iommu *obj; 941 struct omap_iommu *obj;
940 struct resource *res; 942 struct resource *res;
941 struct iommu_platform_data *pdata = pdev->dev.platform_data; 943 struct iommu_platform_data *pdata = pdev->dev.platform_data;
942 944
@@ -1011,7 +1013,7 @@ static int __devexit omap_iommu_remove(struct platform_device *pdev)
1011{ 1013{
1012 int irq; 1014 int irq;
1013 struct resource *res; 1015 struct resource *res;
1014 struct iommu *obj = platform_get_drvdata(pdev); 1016 struct omap_iommu *obj = platform_get_drvdata(pdev);
1015 1017
1016 platform_set_drvdata(pdev, NULL); 1018 platform_set_drvdata(pdev, NULL);
1017 1019
@@ -1046,7 +1048,7 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
1046 phys_addr_t pa, int order, int prot) 1048 phys_addr_t pa, int order, int prot)
1047{ 1049{
1048 struct omap_iommu_domain *omap_domain = domain->priv; 1050 struct omap_iommu_domain *omap_domain = domain->priv;
1049 struct iommu *oiommu = omap_domain->iommu_dev; 1051 struct omap_iommu *oiommu = omap_domain->iommu_dev;
1050 struct device *dev = oiommu->dev; 1052 struct device *dev = oiommu->dev;
1051 size_t bytes = PAGE_SIZE << order; 1053 size_t bytes = PAGE_SIZE << order;
1052 struct iotlb_entry e; 1054 struct iotlb_entry e;
@@ -1066,9 +1068,9 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
1066 1068
1067 iotlb_init_entry(&e, da, pa, flags); 1069 iotlb_init_entry(&e, da, pa, flags);
1068 1070
1069 ret = iopgtable_store_entry(oiommu, &e); 1071 ret = omap_iopgtable_store_entry(oiommu, &e);
1070 if (ret) { 1072 if (ret) {
1071 dev_err(dev, "iopgtable_store_entry failed: %d\n", ret); 1073 dev_err(dev, "omap_iopgtable_store_entry failed: %d\n", ret);
1072 return ret; 1074 return ret;
1073 } 1075 }
1074 1076
@@ -1079,7 +1081,7 @@ static int omap_iommu_unmap(struct iommu_domain *domain, unsigned long da,
1079 int order) 1081 int order)
1080{ 1082{
1081 struct omap_iommu_domain *omap_domain = domain->priv; 1083 struct omap_iommu_domain *omap_domain = domain->priv;
1082 struct iommu *oiommu = omap_domain->iommu_dev; 1084 struct omap_iommu *oiommu = omap_domain->iommu_dev;
1083 struct device *dev = oiommu->dev; 1085 struct device *dev = oiommu->dev;
1084 size_t bytes = PAGE_SIZE << order; 1086 size_t bytes = PAGE_SIZE << order;
1085 size_t ret; 1087 size_t ret;
@@ -1099,7 +1101,7 @@ static int
1099omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) 1101omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev)
1100{ 1102{
1101 struct omap_iommu_domain *omap_domain = domain->priv; 1103 struct omap_iommu_domain *omap_domain = domain->priv;
1102 struct iommu *oiommu; 1104 struct omap_iommu *oiommu;
1103 int ret = 0; 1105 int ret = 0;
1104 1106
1105 spin_lock(&omap_domain->lock); 1107 spin_lock(&omap_domain->lock);
@@ -1130,7 +1132,7 @@ static void omap_iommu_detach_dev(struct iommu_domain *domain,
1130 struct device *dev) 1132 struct device *dev)
1131{ 1133{
1132 struct omap_iommu_domain *omap_domain = domain->priv; 1134 struct omap_iommu_domain *omap_domain = domain->priv;
1133 struct iommu *oiommu = to_iommu(dev); 1135 struct omap_iommu *oiommu = to_iommu(dev);
1134 1136
1135 spin_lock(&omap_domain->lock); 1137 spin_lock(&omap_domain->lock);
1136 1138
@@ -1200,7 +1202,7 @@ static phys_addr_t omap_iommu_iova_to_phys(struct iommu_domain *domain,
1200 unsigned long da) 1202 unsigned long da)
1201{ 1203{
1202 struct omap_iommu_domain *omap_domain = domain->priv; 1204 struct omap_iommu_domain *omap_domain = domain->priv;
1203 struct iommu *oiommu = omap_domain->iommu_dev; 1205 struct omap_iommu *oiommu = omap_domain->iommu_dev;
1204 struct device *dev = oiommu->dev; 1206 struct device *dev = oiommu->dev;
1205 u32 *pgd, *pte; 1207 u32 *pgd, *pte;
1206 phys_addr_t ret = 0; 1208 phys_addr_t ret = 0;
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c
index 996bec0b4a2b..5e7f97dc76ef 100644
--- a/drivers/iommu/omap-iovmm.c
+++ b/drivers/iommu/omap-iovmm.c
@@ -191,7 +191,8 @@ static inline void vunmap_sg(const void *va)
191 vunmap(va); 191 vunmap(va);
192} 192}
193 193
194static struct iovm_struct *__find_iovm_area(struct iommu *obj, const u32 da) 194static struct iovm_struct *__find_iovm_area(struct omap_iommu *obj,
195 const u32 da)
195{ 196{
196 struct iovm_struct *tmp; 197 struct iovm_struct *tmp;
197 198
@@ -213,12 +214,12 @@ static struct iovm_struct *__find_iovm_area(struct iommu *obj, const u32 da)
213} 214}
214 215
215/** 216/**
216 * find_iovm_area - find iovma which includes @da 217 * omap_find_iovm_area - find iovma which includes @da
217 * @da: iommu device virtual address 218 * @da: iommu device virtual address
218 * 219 *
219 * Find the existing iovma starting at @da 220 * Find the existing iovma starting at @da
220 */ 221 */
221struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da) 222struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da)
222{ 223{
223 struct iovm_struct *area; 224 struct iovm_struct *area;
224 225
@@ -228,13 +229,13 @@ struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da)
228 229
229 return area; 230 return area;
230} 231}
231EXPORT_SYMBOL_GPL(find_iovm_area); 232EXPORT_SYMBOL_GPL(omap_find_iovm_area);
232 233
233/* 234/*
234 * This finds the hole(area) which fits the requested address and len 235 * This finds the hole(area) which fits the requested address and len
235 * in iovmas mmap, and returns the new allocated iovma. 236 * in iovmas mmap, and returns the new allocated iovma.
236 */ 237 */
237static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, 238static struct iovm_struct *alloc_iovm_area(struct omap_iommu *obj, u32 da,
238 size_t bytes, u32 flags) 239 size_t bytes, u32 flags)
239{ 240{
240 struct iovm_struct *new, *tmp; 241 struct iovm_struct *new, *tmp;
@@ -309,7 +310,7 @@ found:
309 return new; 310 return new;
310} 311}
311 312
312static void free_iovm_area(struct iommu *obj, struct iovm_struct *area) 313static void free_iovm_area(struct omap_iommu *obj, struct iovm_struct *area)
313{ 314{
314 size_t bytes; 315 size_t bytes;
315 316
@@ -325,14 +326,14 @@ static void free_iovm_area(struct iommu *obj, struct iovm_struct *area)
325} 326}
326 327
327/** 328/**
328 * da_to_va - convert (d) to (v) 329 * omap_da_to_va - convert (d) to (v)
329 * @obj: objective iommu 330 * @obj: objective iommu
330 * @da: iommu device virtual address 331 * @da: iommu device virtual address
331 * @va: mpu virtual address 332 * @va: mpu virtual address
332 * 333 *
333 * Returns mpu virtual addr which corresponds to a given device virtual addr 334 * Returns mpu virtual addr which corresponds to a given device virtual addr
334 */ 335 */
335void *da_to_va(struct iommu *obj, u32 da) 336void *omap_da_to_va(struct omap_iommu *obj, u32 da)
336{ 337{
337 void *va = NULL; 338 void *va = NULL;
338 struct iovm_struct *area; 339 struct iovm_struct *area;
@@ -350,7 +351,7 @@ out:
350 351
351 return va; 352 return va;
352} 353}
353EXPORT_SYMBOL_GPL(da_to_va); 354EXPORT_SYMBOL_GPL(omap_da_to_va);
354 355
355static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va) 356static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va)
356{ 357{
@@ -364,7 +365,7 @@ static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va)
364 const size_t bytes = PAGE_SIZE; 365 const size_t bytes = PAGE_SIZE;
365 366
366 /* 367 /*
367 * iommu 'superpage' isn't supported with 'iommu_vmalloc()' 368 * iommu 'superpage' isn't supported with 'omap_iommu_vmalloc()'
368 */ 369 */
369 pg = vmalloc_to_page(va); 370 pg = vmalloc_to_page(va);
370 BUG_ON(!pg); 371 BUG_ON(!pg);
@@ -443,7 +444,7 @@ err_out:
443} 444}
444 445
445/* release 'da' <-> 'pa' mapping */ 446/* release 'da' <-> 'pa' mapping */
446static void unmap_iovm_area(struct iommu_domain *domain, struct iommu *obj, 447static void unmap_iovm_area(struct iommu_domain *domain, struct omap_iommu *obj,
447 struct iovm_struct *area) 448 struct iovm_struct *area)
448{ 449{
449 u32 start; 450 u32 start;
@@ -480,7 +481,7 @@ static void unmap_iovm_area(struct iommu_domain *domain, struct iommu *obj,
480 481
481/* template function for all unmapping */ 482/* template function for all unmapping */
482static struct sg_table *unmap_vm_area(struct iommu_domain *domain, 483static struct sg_table *unmap_vm_area(struct iommu_domain *domain,
483 struct iommu *obj, const u32 da, 484 struct omap_iommu *obj, const u32 da,
484 void (*fn)(const void *), u32 flags) 485 void (*fn)(const void *), u32 flags)
485{ 486{
486 struct sg_table *sgt = NULL; 487 struct sg_table *sgt = NULL;
@@ -521,7 +522,7 @@ out:
521 return sgt; 522 return sgt;
522} 523}
523 524
524static u32 map_iommu_region(struct iommu_domain *domain, struct iommu *obj, 525static u32 map_iommu_region(struct iommu_domain *domain, struct omap_iommu *obj,
525 u32 da, const struct sg_table *sgt, void *va, 526 u32 da, const struct sg_table *sgt, void *va,
526 size_t bytes, u32 flags) 527 size_t bytes, u32 flags)
527{ 528{
@@ -555,7 +556,8 @@ err_alloc_iovma:
555 return err; 556 return err;
556} 557}
557 558
558static inline u32 __iommu_vmap(struct iommu_domain *domain, struct iommu *obj, 559static inline u32
560__iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj,
559 u32 da, const struct sg_table *sgt, 561 u32 da, const struct sg_table *sgt,
560 void *va, size_t bytes, u32 flags) 562 void *va, size_t bytes, u32 flags)
561{ 563{
@@ -563,7 +565,7 @@ static inline u32 __iommu_vmap(struct iommu_domain *domain, struct iommu *obj,
563} 565}
564 566
565/** 567/**
566 * iommu_vmap - (d)-(p)-(v) address mapper 568 * omap_iommu_vmap - (d)-(p)-(v) address mapper
567 * @obj: objective iommu 569 * @obj: objective iommu
568 * @sgt: address of scatter gather table 570 * @sgt: address of scatter gather table
569 * @flags: iovma and page property 571 * @flags: iovma and page property
@@ -571,7 +573,7 @@ static inline u32 __iommu_vmap(struct iommu_domain *domain, struct iommu *obj,
571 * Creates 1-n-1 mapping with given @sgt and returns @da. 573 * Creates 1-n-1 mapping with given @sgt and returns @da.
572 * All @sgt element must be io page size aligned. 574 * All @sgt element must be io page size aligned.
573 */ 575 */
574u32 iommu_vmap(struct iommu_domain *domain, struct iommu *obj, u32 da, 576u32 omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da,
575 const struct sg_table *sgt, u32 flags) 577 const struct sg_table *sgt, u32 flags)
576{ 578{
577 size_t bytes; 579 size_t bytes;
@@ -600,22 +602,22 @@ u32 iommu_vmap(struct iommu_domain *domain, struct iommu *obj, u32 da,
600 602
601 return da; 603 return da;
602} 604}
603EXPORT_SYMBOL_GPL(iommu_vmap); 605EXPORT_SYMBOL_GPL(omap_iommu_vmap);
604 606
605/** 607/**
606 * iommu_vunmap - release virtual mapping obtained by 'iommu_vmap()' 608 * omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()'
607 * @obj: objective iommu 609 * @obj: objective iommu
608 * @da: iommu device virtual address 610 * @da: iommu device virtual address
609 * 611 *
610 * Free the iommu virtually contiguous memory area starting at 612 * Free the iommu virtually contiguous memory area starting at
611 * @da, which was returned by 'iommu_vmap()'. 613 * @da, which was returned by 'omap_iommu_vmap()'.
612 */ 614 */
613struct sg_table * 615struct sg_table *
614iommu_vunmap(struct iommu_domain *domain, struct iommu *obj, u32 da) 616omap_iommu_vunmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da)
615{ 617{
616 struct sg_table *sgt; 618 struct sg_table *sgt;
617 /* 619 /*
618 * 'sgt' is allocated before 'iommu_vmalloc()' is called. 620 * 'sgt' is allocated before 'omap_iommu_vmalloc()' is called.
619 * Just returns 'sgt' to the caller to free 621 * Just returns 'sgt' to the caller to free
620 */ 622 */
621 sgt = unmap_vm_area(domain, obj, da, vunmap_sg, 623 sgt = unmap_vm_area(domain, obj, da, vunmap_sg,
@@ -624,10 +626,10 @@ iommu_vunmap(struct iommu_domain *domain, struct iommu *obj, u32 da)
624 dev_dbg(obj->dev, "%s: No sgt\n", __func__); 626 dev_dbg(obj->dev, "%s: No sgt\n", __func__);
625 return sgt; 627 return sgt;
626} 628}
627EXPORT_SYMBOL_GPL(iommu_vunmap); 629EXPORT_SYMBOL_GPL(omap_iommu_vunmap);
628 630
629/** 631/**
630 * iommu_vmalloc - (d)-(p)-(v) address allocator and mapper 632 * omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper
631 * @obj: objective iommu 633 * @obj: objective iommu
632 * @da: contiguous iommu virtual memory 634 * @da: contiguous iommu virtual memory
633 * @bytes: allocation size 635 * @bytes: allocation size
@@ -636,7 +638,8 @@ EXPORT_SYMBOL_GPL(iommu_vunmap);
636 * Allocate @bytes linearly and creates 1-n-1 mapping and returns 638 * Allocate @bytes linearly and creates 1-n-1 mapping and returns
637 * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. 639 * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set.
638 */ 640 */
639u32 iommu_vmalloc(struct iommu_domain *domain, struct iommu *obj, u32 da, 641u32
642omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, u32 da,
640 size_t bytes, u32 flags) 643 size_t bytes, u32 flags)
641{ 644{
642 void *va; 645 void *va;
@@ -674,17 +677,18 @@ err_sgt_alloc:
674 vfree(va); 677 vfree(va);
675 return da; 678 return da;
676} 679}
677EXPORT_SYMBOL_GPL(iommu_vmalloc); 680EXPORT_SYMBOL_GPL(omap_iommu_vmalloc);
678 681
679/** 682/**
680 * iommu_vfree - release memory allocated by 'iommu_vmalloc()' 683 * omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()'
681 * @obj: objective iommu 684 * @obj: objective iommu
682 * @da: iommu device virtual address 685 * @da: iommu device virtual address
683 * 686 *
684 * Frees the iommu virtually continuous memory area starting at 687 * Frees the iommu virtually continuous memory area starting at
685 * @da, as obtained from 'iommu_vmalloc()'. 688 * @da, as obtained from 'omap_iommu_vmalloc()'.
686 */ 689 */
687void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, const u32 da) 690void omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj,
691 const u32 da)
688{ 692{
689 struct sg_table *sgt; 693 struct sg_table *sgt;
690 694
@@ -694,7 +698,7 @@ void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, const u32 da)
694 dev_dbg(obj->dev, "%s: No sgt\n", __func__); 698 dev_dbg(obj->dev, "%s: No sgt\n", __func__);
695 sgtable_free(sgt); 699 sgtable_free(sgt);
696} 700}
697EXPORT_SYMBOL_GPL(iommu_vfree); 701EXPORT_SYMBOL_GPL(omap_iommu_vfree);
698 702
699static int __init iovmm_init(void) 703static int __init iovmm_init(void)
700{ 704{
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c
index 0db45ac7489b..a4baa6165c2c 100644
--- a/drivers/media/video/omap3isp/isp.c
+++ b/drivers/media/video/omap3isp/isp.c
@@ -85,7 +85,7 @@
85 * any omap-specific iommu API 85 * any omap-specific iommu API
86 */ 86 */
87#define to_iommu(dev) \ 87#define to_iommu(dev) \
88 (struct iommu *)platform_get_drvdata(to_platform_device(dev)) 88 (struct omap_iommu *)platform_get_drvdata(to_platform_device(dev))
89 89
90static unsigned int autoidle; 90static unsigned int autoidle;
91module_param(autoidle, int, 0444); 91module_param(autoidle, int, 0444);
@@ -1115,7 +1115,7 @@ static void isp_save_ctx(struct isp_device *isp)
1115{ 1115{
1116 isp_save_context(isp, isp_reg_list); 1116 isp_save_context(isp, isp_reg_list);
1117 if (isp->iommu) 1117 if (isp->iommu)
1118 iommu_save_ctx(isp->iommu); 1118 omap_iommu_save_ctx(isp->iommu);
1119} 1119}
1120 1120
1121/* 1121/*
@@ -1129,7 +1129,7 @@ static void isp_restore_ctx(struct isp_device *isp)
1129{ 1129{
1130 isp_restore_context(isp, isp_reg_list); 1130 isp_restore_context(isp, isp_reg_list);
1131 if (isp->iommu) 1131 if (isp->iommu)
1132 iommu_restore_ctx(isp->iommu); 1132 omap_iommu_restore_ctx(isp->iommu);
1133 omap3isp_ccdc_restore_context(isp); 1133 omap3isp_ccdc_restore_context(isp);
1134 omap3isp_preview_restore_context(isp); 1134 omap3isp_preview_restore_context(isp);
1135} 1135}
diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h
index c9ec7a2e53ea..81fdd85deb60 100644
--- a/drivers/media/video/omap3isp/isp.h
+++ b/drivers/media/video/omap3isp/isp.h
@@ -295,7 +295,7 @@ struct isp_device {
295 unsigned int sbl_resources; 295 unsigned int sbl_resources;
296 unsigned int subclk_resources; 296 unsigned int subclk_resources;
297 297
298 struct iommu *iommu; 298 struct omap_iommu *iommu;
299 struct iommu_domain *domain; 299 struct iommu_domain *domain;
300 struct device *iommu_dev; 300 struct device *iommu_dev;
301 301
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index de2547413739..9891dde2af77 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -365,7 +365,7 @@ static void ccdc_lsc_free_request(struct isp_ccdc_device *ccdc,
365 dma_unmap_sg(isp->dev, req->iovm->sgt->sgl, 365 dma_unmap_sg(isp->dev, req->iovm->sgt->sgl,
366 req->iovm->sgt->nents, DMA_TO_DEVICE); 366 req->iovm->sgt->nents, DMA_TO_DEVICE);
367 if (req->table) 367 if (req->table)
368 iommu_vfree(isp->domain, isp->iommu, req->table); 368 omap_iommu_vfree(isp->domain, isp->iommu, req->table);
369 kfree(req); 369 kfree(req);
370} 370}
371 371
@@ -437,7 +437,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,
437 437
438 req->enable = 1; 438 req->enable = 1;
439 439
440 req->table = iommu_vmalloc(isp->domain, isp->iommu, 0, 440 req->table = omap_iommu_vmalloc(isp->domain, isp->iommu, 0,
441 req->config.size, IOMMU_FLAG); 441 req->config.size, IOMMU_FLAG);
442 if (IS_ERR_VALUE(req->table)) { 442 if (IS_ERR_VALUE(req->table)) {
443 req->table = 0; 443 req->table = 0;
@@ -445,7 +445,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,
445 goto done; 445 goto done;
446 } 446 }
447 447
448 req->iovm = find_iovm_area(isp->iommu, req->table); 448 req->iovm = omap_find_iovm_area(isp->iommu, req->table);
449 if (req->iovm == NULL) { 449 if (req->iovm == NULL) {
450 ret = -ENOMEM; 450 ret = -ENOMEM;
451 goto done; 451 goto done;
@@ -461,7 +461,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc,
461 dma_sync_sg_for_cpu(isp->dev, req->iovm->sgt->sgl, 461 dma_sync_sg_for_cpu(isp->dev, req->iovm->sgt->sgl,
462 req->iovm->sgt->nents, DMA_TO_DEVICE); 462 req->iovm->sgt->nents, DMA_TO_DEVICE);
463 463
464 table = da_to_va(isp->iommu, req->table); 464 table = omap_da_to_va(isp->iommu, req->table);
465 if (copy_from_user(table, config->lsc, req->config.size)) { 465 if (copy_from_user(table, config->lsc, req->config.size)) {
466 ret = -EFAULT; 466 ret = -EFAULT;
467 goto done; 467 goto done;
@@ -730,18 +730,19 @@ static int ccdc_config(struct isp_ccdc_device *ccdc,
730 730
731 /* 731 /*
732 * table_new must be 64-bytes aligned, but it's 732 * table_new must be 64-bytes aligned, but it's
733 * already done by iommu_vmalloc(). 733 * already done by omap_iommu_vmalloc().
734 */ 734 */
735 size = ccdc->fpc.fpnum * 4; 735 size = ccdc->fpc.fpnum * 4;
736 table_new = iommu_vmalloc(isp->domain, isp->iommu, 0, 736 table_new = omap_iommu_vmalloc(isp->domain, isp->iommu,
737 size, IOMMU_FLAG); 737 0, size, IOMMU_FLAG);
738 if (IS_ERR_VALUE(table_new)) 738 if (IS_ERR_VALUE(table_new))
739 return -ENOMEM; 739 return -ENOMEM;
740 740
741 if (copy_from_user(da_to_va(isp->iommu, table_new), 741 if (copy_from_user(omap_da_to_va(isp->iommu, table_new),
742 (__force void __user *) 742 (__force void __user *)
743 ccdc->fpc.fpcaddr, size)) { 743 ccdc->fpc.fpcaddr, size)) {
744 iommu_vfree(isp->domain, isp->iommu, table_new); 744 omap_iommu_vfree(isp->domain, isp->iommu,
745 table_new);
745 return -EFAULT; 746 return -EFAULT;
746 } 747 }
747 748
@@ -751,7 +752,7 @@ static int ccdc_config(struct isp_ccdc_device *ccdc,
751 752
752 ccdc_configure_fpc(ccdc); 753 ccdc_configure_fpc(ccdc);
753 if (table_old != 0) 754 if (table_old != 0)
754 iommu_vfree(isp->domain, isp->iommu, table_old); 755 omap_iommu_vfree(isp->domain, isp->iommu, table_old);
755 } 756 }
756 757
757 return ccdc_lsc_config(ccdc, ccdc_struct); 758 return ccdc_lsc_config(ccdc, ccdc_struct);
@@ -2286,5 +2287,5 @@ void omap3isp_ccdc_cleanup(struct isp_device *isp)
2286 ccdc_lsc_free_queue(ccdc, &ccdc->lsc.free_queue); 2287 ccdc_lsc_free_queue(ccdc, &ccdc->lsc.free_queue);
2287 2288
2288 if (ccdc->fpc.fpcaddr != 0) 2289 if (ccdc->fpc.fpcaddr != 0)
2289 iommu_vfree(isp->domain, isp->iommu, ccdc->fpc.fpcaddr); 2290 omap_iommu_vfree(isp->domain, isp->iommu, ccdc->fpc.fpcaddr);
2290} 2291}
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c
index 98af736b9a90..732905552261 100644
--- a/drivers/media/video/omap3isp/ispstat.c
+++ b/drivers/media/video/omap3isp/ispstat.c
@@ -366,7 +366,8 @@ static void isp_stat_bufs_free(struct ispstat *stat)
366 dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl, 366 dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl,
367 buf->iovm->sgt->nents, 367 buf->iovm->sgt->nents,
368 DMA_FROM_DEVICE); 368 DMA_FROM_DEVICE);
369 iommu_vfree(isp->domain, isp->iommu, buf->iommu_addr); 369 omap_iommu_vfree(isp->domain, isp->iommu,
370 buf->iommu_addr);
370 } else { 371 } else {
371 if (!buf->virt_addr) 372 if (!buf->virt_addr)
372 continue; 373 continue;
@@ -399,7 +400,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size)
399 struct iovm_struct *iovm; 400 struct iovm_struct *iovm;
400 401
401 WARN_ON(buf->dma_addr); 402 WARN_ON(buf->dma_addr);
402 buf->iommu_addr = iommu_vmalloc(isp->domain, isp->iommu, 0, 403 buf->iommu_addr = omap_iommu_vmalloc(isp->domain, isp->iommu, 0,
403 size, IOMMU_FLAG); 404 size, IOMMU_FLAG);
404 if (IS_ERR((void *)buf->iommu_addr)) { 405 if (IS_ERR((void *)buf->iommu_addr)) {
405 dev_err(stat->isp->dev, 406 dev_err(stat->isp->dev,
@@ -409,7 +410,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size)
409 return -ENOMEM; 410 return -ENOMEM;
410 } 411 }
411 412
412 iovm = find_iovm_area(isp->iommu, buf->iommu_addr); 413 iovm = omap_find_iovm_area(isp->iommu, buf->iommu_addr);
413 if (!iovm || 414 if (!iovm ||
414 !dma_map_sg(isp->dev, iovm->sgt->sgl, iovm->sgt->nents, 415 !dma_map_sg(isp->dev, iovm->sgt->sgl, iovm->sgt->nents,
415 DMA_FROM_DEVICE)) { 416 DMA_FROM_DEVICE)) {
@@ -418,7 +419,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size)
418 } 419 }
419 buf->iovm = iovm; 420 buf->iovm = iovm;
420 421
421 buf->virt_addr = da_to_va(stat->isp->iommu, 422 buf->virt_addr = omap_da_to_va(stat->isp->iommu,
422 (u32)buf->iommu_addr); 423 (u32)buf->iommu_addr);
423 buf->empty = 1; 424 buf->empty = 1;
424 dev_dbg(stat->isp->dev, "%s: buffer[%d] allocated." 425 dev_dbg(stat->isp->dev, "%s: buffer[%d] allocated."
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c
index 023b5028a27b..912ac071b104 100644
--- a/drivers/media/video/omap3isp/ispvideo.c
+++ b/drivers/media/video/omap3isp/ispvideo.c
@@ -446,7 +446,7 @@ ispmmu_vmap(struct isp_device *isp, const struct scatterlist *sglist, int sglen)
446 sgt->nents = sglen; 446 sgt->nents = sglen;
447 sgt->orig_nents = sglen; 447 sgt->orig_nents = sglen;
448 448
449 da = iommu_vmap(isp->domain, isp->iommu, 0, sgt, IOMMU_FLAG); 449 da = omap_iommu_vmap(isp->domain, isp->iommu, 0, sgt, IOMMU_FLAG);
450 if (IS_ERR_VALUE(da)) 450 if (IS_ERR_VALUE(da))
451 kfree(sgt); 451 kfree(sgt);
452 452
@@ -462,7 +462,7 @@ static void ispmmu_vunmap(struct isp_device *isp, dma_addr_t da)
462{ 462{
463 struct sg_table *sgt; 463 struct sg_table *sgt;
464 464
465 sgt = iommu_vunmap(isp->domain, isp->iommu, (u32)da); 465 sgt = omap_iommu_vunmap(isp->domain, isp->iommu, (u32)da);
466 kfree(sgt); 466 kfree(sgt);
467} 467}
468 468