diff options
-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 | ||||
-rw-r--r-- | drivers/iommu/omap-iommu-debug.c | 34 | ||||
-rw-r--r-- | drivers/iommu/omap-iommu.c | 146 | ||||
-rw-r--r-- | drivers/iommu/omap-iovmm.c | 62 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/isp.c | 6 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/isp.h | 2 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispccdc.c | 23 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispstat.c | 9 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispvideo.c | 4 |
13 files changed, 208 insertions, 189 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 */ |
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; | |||
32 | static ssize_t debug_read_ver(struct file *file, char __user *userbuf, | 32 | static 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, | |||
43 | static ssize_t debug_read_regs(struct file *file, char __user *userbuf, | 43 | static 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, | |||
66 | static ssize_t debug_read_tlb(struct file *file, char __user *userbuf, | 66 | static 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 | ||
139 | static ssize_t dump_ioptable(struct iommu *obj, char *buf, ssize_t len) | 139 | static 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: | |||
183 | static ssize_t debug_read_pagetable(struct file *file, char __user *userbuf, | 183 | static 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, | |||
211 | static ssize_t debug_read_mmap(struct file *file, char __user *userbuf, | 211 | static 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, | |||
253 | static ssize_t debug_read_mem(struct file *file, char __user *userbuf, | 253 | static 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: | |||
286 | static ssize_t debug_write_mem(struct file *file, const char __user *userbuf, | 286 | static 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); | |||
360 | static int iommu_debug_register(struct device *dev, void *data) | 360 | static 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 | */ |
43 | struct omap_iommu_domain { | 43 | struct 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; | |||
53 | static struct kmem_cache *iopte_cachep; | 53 | static 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 | **/ |
62 | int install_iommu_arch(const struct iommu_functions *ops) | 62 | int 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 | } |
70 | EXPORT_SYMBOL_GPL(install_iommu_arch); | 70 | EXPORT_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 | **/ |
78 | void uninstall_iommu_arch(const struct iommu_functions *ops) | 78 | void 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 | } |
85 | EXPORT_SYMBOL_GPL(uninstall_iommu_arch); | 85 | EXPORT_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 | **/ |
91 | void iommu_save_ctx(struct iommu *obj) | 91 | void omap_iommu_save_ctx(struct omap_iommu *obj) |
92 | { | 92 | { |
93 | arch_iommu->save_ctx(obj); | 93 | arch_iommu->save_ctx(obj); |
94 | } | 94 | } |
95 | EXPORT_SYMBOL_GPL(iommu_save_ctx); | 95 | EXPORT_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 | **/ |
101 | void iommu_restore_ctx(struct iommu *obj) | 101 | void omap_iommu_restore_ctx(struct omap_iommu *obj) |
102 | { | 102 | { |
103 | arch_iommu->restore_ctx(obj); | 103 | arch_iommu->restore_ctx(obj); |
104 | } | 104 | } |
105 | EXPORT_SYMBOL_GPL(iommu_restore_ctx); | 105 | EXPORT_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 | **/ |
110 | u32 iommu_arch_version(void) | 110 | u32 omap_iommu_arch_version(void) |
111 | { | 111 | { |
112 | return arch_iommu->version; | 112 | return arch_iommu->version; |
113 | } | 113 | } |
114 | EXPORT_SYMBOL_GPL(iommu_arch_version); | 114 | EXPORT_SYMBOL_GPL(omap_iommu_arch_version); |
115 | 115 | ||
116 | static int iommu_enable(struct iommu *obj) | 116 | static 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 | ||
134 | static void iommu_disable(struct iommu *obj) | 134 | static 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 | */ |
149 | void iotlb_cr_to_e(struct cr_regs *cr, struct iotlb_entry *e) | 149 | void 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 | } |
155 | EXPORT_SYMBOL_GPL(iotlb_cr_to_e); | 155 | EXPORT_SYMBOL_GPL(omap_iotlb_cr_to_e); |
156 | 156 | ||
157 | static inline int iotlb_cr_valid(struct cr_regs *cr) | 157 | static 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 | ||
165 | static inline struct cr_regs *iotlb_alloc_cr(struct iommu *obj, | 165 | static 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 | ||
184 | static u32 iommu_report_fault(struct iommu *obj, u32 *da) | 184 | static 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 | ||
189 | static void iotlb_lock_get(struct iommu *obj, struct iotlb_lock *l) | 189 | static 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 | ||
200 | static void iotlb_lock_set(struct iommu *obj, struct iotlb_lock *l) | 200 | static 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 | ||
210 | static void iotlb_read_cr(struct iommu *obj, struct cr_regs *cr) | 210 | static 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 | ||
215 | static void iotlb_load_cr(struct iommu *obj, struct cr_regs *cr) | 215 | static 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 | **/ |
229 | static inline ssize_t iotlb_dump_cr(struct iommu *obj, struct cr_regs *cr, | 229 | static 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 */ |
238 | static struct cr_regs __iotlb_read_cr(struct iommu *obj, int n) | 238 | static 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 |
257 | static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) | 257 | static 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 | ||
316 | static int load_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) | 316 | static 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 | ||
323 | static int prefetch_iotlb_entry(struct iommu *obj, struct iotlb_entry *e) | 323 | static 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 | **/ |
335 | static void flush_iotlb_page(struct iommu *obj, u32 da) | 335 | static 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 | **/ |
369 | static void flush_iotlb_all(struct iommu *obj) | 369 | static 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 | ||
386 | ssize_t iommu_dump_ctx(struct iommu *obj, char *buf, ssize_t bytes) | 386 | ssize_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 | } |
399 | EXPORT_SYMBOL_GPL(iommu_dump_ctx); | 399 | EXPORT_SYMBOL_GPL(omap_iommu_dump_ctx); |
400 | 400 | ||
401 | static int __dump_tlb_entries(struct iommu *obj, struct cr_regs *crs, int num) | 401 | static 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 | **/ |
428 | size_t dump_tlb_entries(struct iommu *obj, char *buf, ssize_t bytes) | 429 | size_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 | } |
448 | EXPORT_SYMBOL_GPL(dump_tlb_entries); | 449 | EXPORT_SYMBOL_GPL(omap_dump_tlb_entries); |
449 | 450 | ||
450 | int foreach_iommu_device(void *data, int (*fn)(struct device *, void *)) | 451 | int 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 | } |
455 | EXPORT_SYMBOL_GPL(foreach_iommu_device); | 456 | EXPORT_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 | ||
488 | static u32 *iopte_alloc(struct iommu *obj, u32 *iopgd, u32 da) | 489 | static 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 | ||
526 | static int iopgd_alloc_section(struct iommu *obj, u32 da, u32 pa, u32 prot) | 527 | static 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 | ||
541 | static int iopgd_alloc_super(struct iommu *obj, u32 da, u32 pa, u32 prot) | 542 | static 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 | ||
558 | static int iopte_alloc_page(struct iommu *obj, u32 da, u32 pa, u32 prot) | 559 | static 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 | ||
575 | static int iopte_alloc_large(struct iommu *obj, u32 da, u32 pa, u32 prot) | 576 | static 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 | ||
596 | static int iopgtable_store_entry_core(struct iommu *obj, struct iotlb_entry *e) | 597 | static int |
598 | iopgtable_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 | **/ |
638 | int iopgtable_store_entry(struct iommu *obj, struct iotlb_entry *e) | 640 | int 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 | } |
648 | EXPORT_SYMBOL_GPL(iopgtable_store_entry); | 650 | EXPORT_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 | ||
673 | static size_t iopgtable_clear_entry_core(struct iommu *obj, u32 da) | 675 | static 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 | **/ |
726 | static size_t iopgtable_clear_entry(struct iommu *obj, u32 da) | 728 | static 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 | ||
740 | static void iopgtable_clear_entry_all(struct iommu *obj) | 742 | static 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 | ||
809 | static int device_match_by_alias(struct device *dev, void *data) | 811 | static 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 | **/ |
845 | static struct iommu *omap_iommu_attach(struct device *dev, u32 *iopgd) | 847 | static 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 | **/ |
886 | static void omap_iommu_detach(struct iommu *obj) | 888 | static 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 | ||
905 | int iommu_set_isr(const char *name, | 907 | int 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 | } |
930 | EXPORT_SYMBOL_GPL(iommu_set_isr); | 932 | EXPORT_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 | |||
1099 | omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) | 1101 | omap_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 | ||
194 | static struct iovm_struct *__find_iovm_area(struct iommu *obj, const u32 da) | 194 | static 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 | */ |
221 | struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da) | 222 | struct 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 | } |
231 | EXPORT_SYMBOL_GPL(find_iovm_area); | 232 | EXPORT_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 | */ |
237 | static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da, | 238 | static 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 | ||
312 | static void free_iovm_area(struct iommu *obj, struct iovm_struct *area) | 313 | static 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 | */ |
335 | void *da_to_va(struct iommu *obj, u32 da) | 336 | void *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 | } |
353 | EXPORT_SYMBOL_GPL(da_to_va); | 354 | EXPORT_SYMBOL_GPL(omap_da_to_va); |
354 | 355 | ||
355 | static void sgtable_fill_vmalloc(struct sg_table *sgt, void *_va) | 356 | static 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 */ |
446 | static void unmap_iovm_area(struct iommu_domain *domain, struct iommu *obj, | 447 | static 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 */ |
482 | static struct sg_table *unmap_vm_area(struct iommu_domain *domain, | 483 | static 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 | ||
524 | static u32 map_iommu_region(struct iommu_domain *domain, struct iommu *obj, | 525 | static 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 | ||
558 | static inline u32 __iommu_vmap(struct iommu_domain *domain, struct iommu *obj, | 559 | static 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 | */ |
574 | u32 iommu_vmap(struct iommu_domain *domain, struct iommu *obj, u32 da, | 576 | u32 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 | } |
603 | EXPORT_SYMBOL_GPL(iommu_vmap); | 605 | EXPORT_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 | */ |
613 | struct sg_table * | 615 | struct sg_table * |
614 | iommu_vunmap(struct iommu_domain *domain, struct iommu *obj, u32 da) | 616 | omap_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 | } |
627 | EXPORT_SYMBOL_GPL(iommu_vunmap); | 629 | EXPORT_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 | */ |
639 | u32 iommu_vmalloc(struct iommu_domain *domain, struct iommu *obj, u32 da, | 641 | u32 |
642 | omap_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 | } |
677 | EXPORT_SYMBOL_GPL(iommu_vmalloc); | 680 | EXPORT_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 | */ |
687 | void iommu_vfree(struct iommu_domain *domain, struct iommu *obj, const u32 da) | 690 | void 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 | } |
697 | EXPORT_SYMBOL_GPL(iommu_vfree); | 701 | EXPORT_SYMBOL_GPL(omap_iommu_vfree); |
698 | 702 | ||
699 | static int __init iovmm_init(void) | 703 | static 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 | ||
90 | static unsigned int autoidle; | 90 | static unsigned int autoidle; |
91 | module_param(autoidle, int, 0444); | 91 | module_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 | ||