aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2011-03-14 14:22:22 -0400
committerTony Lindgren <tony@atomide.com>2011-03-14 14:22:22 -0400
commit05f689400ea5fa3d71af82f910c8b140f87ad1f3 (patch)
tree39fa8ddb5163661361dbc5b2ab11f4e331492ead /arch/arm/plat-omap
parent17fe12c5a7bd674c1e6dca9cf1e250f9cd7b96b1 (diff)
parent02b7b94ee98a0a463195d148e5c5885a218ee16f (diff)
Merge branches 'devel-mux' and 'devel-misc' into omap-for-linus
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/include/plat/iovmm.h2
-rw-r--r--arch/arm/plat-omap/iommu.c14
-rw-r--r--arch/arm/plat-omap/iovmm.c27
3 files changed, 20 insertions, 23 deletions
diff --git a/arch/arm/plat-omap/include/plat/iovmm.h b/arch/arm/plat-omap/include/plat/iovmm.h
index bdc7ce5d7a4a..32a2f6c4d39e 100644
--- a/arch/arm/plat-omap/include/plat/iovmm.h
+++ b/arch/arm/plat-omap/include/plat/iovmm.h
@@ -71,8 +71,6 @@ struct iovm_struct {
71#define IOVMF_LINEAR_MASK (3 << (2 + IOVMF_SW_SHIFT)) 71#define IOVMF_LINEAR_MASK (3 << (2 + IOVMF_SW_SHIFT))
72 72
73#define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT)) 73#define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT))
74#define IOVMF_DA_ANON (2 << (4 + IOVMF_SW_SHIFT))
75#define IOVMF_DA_MASK (3 << (4 + IOVMF_SW_SHIFT))
76 74
77 75
78extern struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da); 76extern struct iovm_struct *find_iovm_area(struct iommu *obj, u32 da);
diff --git a/arch/arm/plat-omap/iommu.c b/arch/arm/plat-omap/iommu.c
index e3eb0380090a..8a51fd58f656 100644
--- a/arch/arm/plat-omap/iommu.c
+++ b/arch/arm/plat-omap/iommu.c
@@ -982,11 +982,6 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev)
982 err = -ENODEV; 982 err = -ENODEV;
983 goto err_mem; 983 goto err_mem;
984 } 984 }
985 obj->regbase = ioremap(res->start, resource_size(res));
986 if (!obj->regbase) {
987 err = -ENOMEM;
988 goto err_mem;
989 }
990 985
991 res = request_mem_region(res->start, resource_size(res), 986 res = request_mem_region(res->start, resource_size(res),
992 dev_name(&pdev->dev)); 987 dev_name(&pdev->dev));
@@ -995,6 +990,12 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev)
995 goto err_mem; 990 goto err_mem;
996 } 991 }
997 992
993 obj->regbase = ioremap(res->start, resource_size(res));
994 if (!obj->regbase) {
995 err = -ENOMEM;
996 goto err_ioremap;
997 }
998
998 irq = platform_get_irq(pdev, 0); 999 irq = platform_get_irq(pdev, 0);
999 if (irq < 0) { 1000 if (irq < 0) {
1000 err = -ENODEV; 1001 err = -ENODEV;
@@ -1023,8 +1024,9 @@ static int __devinit omap_iommu_probe(struct platform_device *pdev)
1023err_pgd: 1024err_pgd:
1024 free_irq(irq, obj); 1025 free_irq(irq, obj);
1025err_irq: 1026err_irq:
1026 release_mem_region(res->start, resource_size(res));
1027 iounmap(obj->regbase); 1027 iounmap(obj->regbase);
1028err_ioremap:
1029 release_mem_region(res->start, resource_size(res));
1028err_mem: 1030err_mem:
1029 clk_put(obj->clk); 1031 clk_put(obj->clk);
1030err_clk: 1032err_clk:
diff --git a/arch/arm/plat-omap/iovmm.c b/arch/arm/plat-omap/iovmm.c
index 6dc1296c8c77..51ef43e8def6 100644
--- a/arch/arm/plat-omap/iovmm.c
+++ b/arch/arm/plat-omap/iovmm.c
@@ -271,20 +271,21 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da,
271 size_t bytes, u32 flags) 271 size_t bytes, u32 flags)
272{ 272{
273 struct iovm_struct *new, *tmp; 273 struct iovm_struct *new, *tmp;
274 u32 start, prev_end, alignement; 274 u32 start, prev_end, alignment;
275 275
276 if (!obj || !bytes) 276 if (!obj || !bytes)
277 return ERR_PTR(-EINVAL); 277 return ERR_PTR(-EINVAL);
278 278
279 start = da; 279 start = da;
280 alignement = PAGE_SIZE; 280 alignment = PAGE_SIZE;
281 281
282 if (flags & IOVMF_DA_ANON) { 282 if (~flags & IOVMF_DA_FIXED) {
283 start = obj->da_start; 283 /* Don't map address 0 */
284 start = obj->da_start ? obj->da_start : alignment;
284 285
285 if (flags & IOVMF_LINEAR) 286 if (flags & IOVMF_LINEAR)
286 alignement = iopgsz_max(bytes); 287 alignment = iopgsz_max(bytes);
287 start = roundup(start, alignement); 288 start = roundup(start, alignment);
288 } else if (start < obj->da_start || start > obj->da_end || 289 } else if (start < obj->da_start || start > obj->da_end ||
289 obj->da_end - start < bytes) { 290 obj->da_end - start < bytes) {
290 return ERR_PTR(-EINVAL); 291 return ERR_PTR(-EINVAL);
@@ -303,8 +304,8 @@ static struct iovm_struct *alloc_iovm_area(struct iommu *obj, u32 da,
303 if (tmp->da_start > start && (tmp->da_start - start) >= bytes) 304 if (tmp->da_start > start && (tmp->da_start - start) >= bytes)
304 goto found; 305 goto found;
305 306
306 if (tmp->da_end >= start && flags & IOVMF_DA_ANON) 307 if (tmp->da_end >= start && ~flags & IOVMF_DA_FIXED)
307 start = roundup(tmp->da_end + 1, alignement); 308 start = roundup(tmp->da_end + 1, alignment);
308 309
309 prev_end = tmp->da_end; 310 prev_end = tmp->da_end;
310 } 311 }
@@ -650,7 +651,6 @@ u32 iommu_vmap(struct iommu *obj, u32 da, const struct sg_table *sgt,
650 flags &= IOVMF_HW_MASK; 651 flags &= IOVMF_HW_MASK;
651 flags |= IOVMF_DISCONT; 652 flags |= IOVMF_DISCONT;
652 flags |= IOVMF_MMIO; 653 flags |= IOVMF_MMIO;
653 flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
654 654
655 da = __iommu_vmap(obj, da, sgt, va, bytes, flags); 655 da = __iommu_vmap(obj, da, sgt, va, bytes, flags);
656 if (IS_ERR_VALUE(da)) 656 if (IS_ERR_VALUE(da))
@@ -690,7 +690,7 @@ EXPORT_SYMBOL_GPL(iommu_vunmap);
690 * @flags: iovma and page property 690 * @flags: iovma and page property
691 * 691 *
692 * Allocate @bytes linearly and creates 1-n-1 mapping and returns 692 * Allocate @bytes linearly and creates 1-n-1 mapping and returns
693 * @da again, which might be adjusted if 'IOVMF_DA_ANON' is set. 693 * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set.
694 */ 694 */
695u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags) 695u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
696{ 696{
@@ -709,7 +709,6 @@ u32 iommu_vmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
709 flags &= IOVMF_HW_MASK; 709 flags &= IOVMF_HW_MASK;
710 flags |= IOVMF_DISCONT; 710 flags |= IOVMF_DISCONT;
711 flags |= IOVMF_ALLOC; 711 flags |= IOVMF_ALLOC;
712 flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
713 712
714 sgt = sgtable_alloc(bytes, flags, da, 0); 713 sgt = sgtable_alloc(bytes, flags, da, 0);
715 if (IS_ERR(sgt)) { 714 if (IS_ERR(sgt)) {
@@ -780,7 +779,7 @@ static u32 __iommu_kmap(struct iommu *obj, u32 da, u32 pa, void *va,
780 * @flags: iovma and page property 779 * @flags: iovma and page property
781 * 780 *
782 * Creates 1-1-1 mapping and returns @da again, which can be 781 * Creates 1-1-1 mapping and returns @da again, which can be
783 * adjusted if 'IOVMF_DA_ANON' is set. 782 * adjusted if 'IOVMF_DA_FIXED' is not set.
784 */ 783 */
785u32 iommu_kmap(struct iommu *obj, u32 da, u32 pa, size_t bytes, 784u32 iommu_kmap(struct iommu *obj, u32 da, u32 pa, size_t bytes,
786 u32 flags) 785 u32 flags)
@@ -799,7 +798,6 @@ u32 iommu_kmap(struct iommu *obj, u32 da, u32 pa, size_t bytes,
799 flags &= IOVMF_HW_MASK; 798 flags &= IOVMF_HW_MASK;
800 flags |= IOVMF_LINEAR; 799 flags |= IOVMF_LINEAR;
801 flags |= IOVMF_MMIO; 800 flags |= IOVMF_MMIO;
802 flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
803 801
804 da = __iommu_kmap(obj, da, pa, va, bytes, flags); 802 da = __iommu_kmap(obj, da, pa, va, bytes, flags);
805 if (IS_ERR_VALUE(da)) 803 if (IS_ERR_VALUE(da))
@@ -838,7 +836,7 @@ EXPORT_SYMBOL_GPL(iommu_kunmap);
838 * @flags: iovma and page property 836 * @flags: iovma and page property
839 * 837 *
840 * Allocate @bytes linearly and creates 1-1-1 mapping and returns 838 * Allocate @bytes linearly and creates 1-1-1 mapping and returns
841 * @da again, which might be adjusted if 'IOVMF_DA_ANON' is set. 839 * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set.
842 */ 840 */
843u32 iommu_kmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags) 841u32 iommu_kmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
844{ 842{
@@ -858,7 +856,6 @@ u32 iommu_kmalloc(struct iommu *obj, u32 da, size_t bytes, u32 flags)
858 flags &= IOVMF_HW_MASK; 856 flags &= IOVMF_HW_MASK;
859 flags |= IOVMF_LINEAR; 857 flags |= IOVMF_LINEAR;
860 flags |= IOVMF_ALLOC; 858 flags |= IOVMF_ALLOC;
861 flags |= (da ? IOVMF_DA_FIXED : IOVMF_DA_ANON);
862 859
863 da = __iommu_kmap(obj, da, pa, va, bytes, flags); 860 da = __iommu_kmap(obj, da, pa, va, bytes, flags);
864 if (IS_ERR_VALUE(da)) 861 if (IS_ERR_VALUE(da))