diff options
-rw-r--r-- | arch/arm/plat-omap/include/plat/iommu.h | 5 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/iovmm.h | 12 | ||||
-rw-r--r-- | drivers/iommu/omap-iommu.c | 58 | ||||
-rw-r--r-- | drivers/iommu/omap-iovmm.c | 31 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/isp.c | 30 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/isp.h | 2 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispccdc.c | 18 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispstat.c | 8 | ||||
-rw-r--r-- | drivers/media/video/omap3isp/ispvideo.c | 4 |
9 files changed, 74 insertions, 94 deletions
diff --git a/arch/arm/plat-omap/include/plat/iommu.h b/arch/arm/plat-omap/include/plat/iommu.h index fa11ee26aca9..88be3e628b33 100644 --- a/arch/arm/plat-omap/include/plat/iommu.h +++ b/arch/arm/plat-omap/include/plat/iommu.h | |||
@@ -189,8 +189,8 @@ extern int omap_iommu_set_isr(const char *name, | |||
189 | void *priv), | 189 | void *priv), |
190 | void *isr_priv); | 190 | void *isr_priv); |
191 | 191 | ||
192 | extern void omap_iommu_save_ctx(struct omap_iommu *obj); | 192 | extern void omap_iommu_save_ctx(struct device *dev); |
193 | extern void omap_iommu_restore_ctx(struct omap_iommu *obj); | 193 | extern void omap_iommu_restore_ctx(struct device *dev); |
194 | 194 | ||
195 | extern int omap_install_iommu_arch(const struct iommu_functions *ops); | 195 | extern int omap_install_iommu_arch(const struct iommu_functions *ops); |
196 | extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops); | 196 | extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops); |
@@ -202,6 +202,5 @@ extern ssize_t | |||
202 | omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); | 202 | omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); |
203 | extern size_t | 203 | extern size_t |
204 | omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len); | 204 | omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len); |
205 | struct device *omap_find_iommu_device(const char *name); | ||
206 | 205 | ||
207 | #endif /* __MACH_IOMMU_H */ | 206 | #endif /* __MACH_IOMMU_H */ |
diff --git a/arch/arm/plat-omap/include/plat/iovmm.h b/arch/arm/plat-omap/include/plat/iovmm.h index 6af1a91c0f36..498e57cda6cd 100644 --- a/arch/arm/plat-omap/include/plat/iovmm.h +++ b/arch/arm/plat-omap/include/plat/iovmm.h | |||
@@ -72,18 +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 *omap_find_iovm_area(struct omap_iommu *obj, u32 da); | 75 | extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da); |
76 | extern u32 | 76 | extern u32 |
77 | omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | 77 | omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da, |
78 | const struct sg_table *sgt, u32 flags); | 78 | const struct sg_table *sgt, u32 flags); |
79 | extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain, | 79 | extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain, |
80 | struct omap_iommu *obj, u32 da); | 80 | struct device *dev, u32 da); |
81 | extern u32 | 81 | extern u32 |
82 | omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, | 82 | omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, |
83 | u32 da, size_t bytes, u32 flags); | 83 | u32 da, size_t bytes, u32 flags); |
84 | extern void | 84 | extern void |
85 | omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj, | 85 | omap_iommu_vfree(struct iommu_domain *domain, struct device *dev, |
86 | const u32 da); | 86 | const u32 da); |
87 | extern void *omap_da_to_va(struct omap_iommu *obj, u32 da); | 87 | extern void *omap_da_to_va(struct device *dev, u32 da); |
88 | 88 | ||
89 | #endif /* __IOMMU_MMAP_H */ | 89 | #endif /* __IOMMU_MMAP_H */ |
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 8f32b2bf7587..b7f863d72c08 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c | |||
@@ -86,20 +86,24 @@ EXPORT_SYMBOL_GPL(omap_uninstall_iommu_arch); | |||
86 | 86 | ||
87 | /** | 87 | /** |
88 | * omap_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 | * @dev: client device |
90 | **/ | 90 | **/ |
91 | void omap_iommu_save_ctx(struct omap_iommu *obj) | 91 | void omap_iommu_save_ctx(struct device *dev) |
92 | { | 92 | { |
93 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
94 | |||
93 | arch_iommu->save_ctx(obj); | 95 | arch_iommu->save_ctx(obj); |
94 | } | 96 | } |
95 | EXPORT_SYMBOL_GPL(omap_iommu_save_ctx); | 97 | EXPORT_SYMBOL_GPL(omap_iommu_save_ctx); |
96 | 98 | ||
97 | /** | 99 | /** |
98 | * omap_iommu_restore_ctx - Restore registers for pm off-mode support | 100 | * omap_iommu_restore_ctx - Restore registers for pm off-mode support |
99 | * @obj: target iommu | 101 | * @dev: client device |
100 | **/ | 102 | **/ |
101 | void omap_iommu_restore_ctx(struct omap_iommu *obj) | 103 | void omap_iommu_restore_ctx(struct device *dev) |
102 | { | 104 | { |
105 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
106 | |||
103 | arch_iommu->restore_ctx(obj); | 107 | arch_iommu->restore_ctx(obj); |
104 | } | 108 | } |
105 | EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx); | 109 | EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx); |
@@ -820,35 +824,23 @@ static int device_match_by_alias(struct device *dev, void *data) | |||
820 | } | 824 | } |
821 | 825 | ||
822 | /** | 826 | /** |
823 | * omap_find_iommu_device() - find an omap iommu device by name | ||
824 | * @name: name of the iommu device | ||
825 | * | ||
826 | * The generic iommu API requires the caller to provide the device | ||
827 | * he wishes to attach to a certain iommu domain. | ||
828 | * | ||
829 | * Drivers generally should not bother with this as it should just | ||
830 | * be taken care of by the DMA-API using dev_archdata. | ||
831 | * | ||
832 | * This function is provided as an interim solution until the latter | ||
833 | * materializes, and omap3isp is fully migrated to the DMA-API. | ||
834 | */ | ||
835 | struct device *omap_find_iommu_device(const char *name) | ||
836 | { | ||
837 | return driver_find_device(&omap_iommu_driver.driver, NULL, | ||
838 | (void *)name, | ||
839 | device_match_by_alias); | ||
840 | } | ||
841 | EXPORT_SYMBOL_GPL(omap_find_iommu_device); | ||
842 | |||
843 | /** | ||
844 | * omap_iommu_attach() - attach iommu device to an iommu domain | 827 | * omap_iommu_attach() - attach iommu device to an iommu domain |
845 | * @dev: target omap iommu device | 828 | * @name: name of target omap iommu device |
846 | * @iopgd: page table | 829 | * @iopgd: page table |
847 | **/ | 830 | **/ |
848 | static struct omap_iommu *omap_iommu_attach(struct device *dev, u32 *iopgd) | 831 | static struct omap_iommu *omap_iommu_attach(const char *name, u32 *iopgd) |
849 | { | 832 | { |
850 | int err = -ENOMEM; | 833 | int err = -ENOMEM; |
851 | struct omap_iommu *obj = to_iommu(dev); | 834 | struct device *dev; |
835 | struct omap_iommu *obj; | ||
836 | |||
837 | dev = driver_find_device(&omap_iommu_driver.driver, NULL, | ||
838 | (void *)name, | ||
839 | device_match_by_alias); | ||
840 | if (!dev) | ||
841 | return NULL; | ||
842 | |||
843 | obj = to_iommu(dev); | ||
852 | 844 | ||
853 | spin_lock(&obj->iommu_lock); | 845 | spin_lock(&obj->iommu_lock); |
854 | 846 | ||
@@ -1069,6 +1061,7 @@ omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1069 | { | 1061 | { |
1070 | struct omap_iommu_domain *omap_domain = domain->priv; | 1062 | struct omap_iommu_domain *omap_domain = domain->priv; |
1071 | struct omap_iommu *oiommu; | 1063 | struct omap_iommu *oiommu; |
1064 | struct omap_iommu_arch_data *arch_data = dev->archdata.iommu; | ||
1072 | int ret = 0; | 1065 | int ret = 0; |
1073 | 1066 | ||
1074 | spin_lock(&omap_domain->lock); | 1067 | spin_lock(&omap_domain->lock); |
@@ -1081,14 +1074,14 @@ omap_iommu_attach_dev(struct iommu_domain *domain, struct device *dev) | |||
1081 | } | 1074 | } |
1082 | 1075 | ||
1083 | /* get a handle to and enable the omap iommu */ | 1076 | /* get a handle to and enable the omap iommu */ |
1084 | oiommu = omap_iommu_attach(dev, omap_domain->pgtable); | 1077 | oiommu = omap_iommu_attach(arch_data->name, omap_domain->pgtable); |
1085 | if (IS_ERR(oiommu)) { | 1078 | if (IS_ERR(oiommu)) { |
1086 | ret = PTR_ERR(oiommu); | 1079 | ret = PTR_ERR(oiommu); |
1087 | dev_err(dev, "can't get omap iommu: %d\n", ret); | 1080 | dev_err(dev, "can't get omap iommu: %d\n", ret); |
1088 | goto out; | 1081 | goto out; |
1089 | } | 1082 | } |
1090 | 1083 | ||
1091 | omap_domain->iommu_dev = oiommu; | 1084 | omap_domain->iommu_dev = arch_data->iommu_dev = oiommu; |
1092 | oiommu->domain = domain; | 1085 | oiommu->domain = domain; |
1093 | 1086 | ||
1094 | out: | 1087 | out: |
@@ -1100,7 +1093,8 @@ static void omap_iommu_detach_dev(struct iommu_domain *domain, | |||
1100 | struct device *dev) | 1093 | struct device *dev) |
1101 | { | 1094 | { |
1102 | struct omap_iommu_domain *omap_domain = domain->priv; | 1095 | struct omap_iommu_domain *omap_domain = domain->priv; |
1103 | struct omap_iommu *oiommu = to_iommu(dev); | 1096 | struct omap_iommu_arch_data *arch_data = dev->archdata.iommu; |
1097 | struct omap_iommu *oiommu = dev_to_omap_iommu(dev); | ||
1104 | 1098 | ||
1105 | spin_lock(&omap_domain->lock); | 1099 | spin_lock(&omap_domain->lock); |
1106 | 1100 | ||
@@ -1114,7 +1108,7 @@ static void omap_iommu_detach_dev(struct iommu_domain *domain, | |||
1114 | 1108 | ||
1115 | omap_iommu_detach(oiommu); | 1109 | omap_iommu_detach(oiommu); |
1116 | 1110 | ||
1117 | omap_domain->iommu_dev = NULL; | 1111 | omap_domain->iommu_dev = arch_data->iommu_dev = NULL; |
1118 | 1112 | ||
1119 | out: | 1113 | out: |
1120 | spin_unlock(&omap_domain->lock); | 1114 | spin_unlock(&omap_domain->lock); |
diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index 46be456fcc00..23655945e30c 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c | |||
@@ -231,12 +231,14 @@ static struct iovm_struct *__find_iovm_area(struct omap_iommu *obj, | |||
231 | 231 | ||
232 | /** | 232 | /** |
233 | * omap_find_iovm_area - find iovma which includes @da | 233 | * omap_find_iovm_area - find iovma which includes @da |
234 | * @dev: client device | ||
234 | * @da: iommu device virtual address | 235 | * @da: iommu device virtual address |
235 | * | 236 | * |
236 | * Find the existing iovma starting at @da | 237 | * Find the existing iovma starting at @da |
237 | */ | 238 | */ |
238 | struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da) | 239 | struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da) |
239 | { | 240 | { |
241 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
240 | struct iovm_struct *area; | 242 | struct iovm_struct *area; |
241 | 243 | ||
242 | mutex_lock(&obj->mmap_lock); | 244 | mutex_lock(&obj->mmap_lock); |
@@ -343,14 +345,15 @@ static void free_iovm_area(struct omap_iommu *obj, struct iovm_struct *area) | |||
343 | 345 | ||
344 | /** | 346 | /** |
345 | * omap_da_to_va - convert (d) to (v) | 347 | * omap_da_to_va - convert (d) to (v) |
346 | * @obj: objective iommu | 348 | * @dev: client device |
347 | * @da: iommu device virtual address | 349 | * @da: iommu device virtual address |
348 | * @va: mpu virtual address | 350 | * @va: mpu virtual address |
349 | * | 351 | * |
350 | * Returns mpu virtual addr which corresponds to a given device virtual addr | 352 | * Returns mpu virtual addr which corresponds to a given device virtual addr |
351 | */ | 353 | */ |
352 | void *omap_da_to_va(struct omap_iommu *obj, u32 da) | 354 | void *omap_da_to_va(struct device *dev, u32 da) |
353 | { | 355 | { |
356 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
354 | void *va = NULL; | 357 | void *va = NULL; |
355 | struct iovm_struct *area; | 358 | struct iovm_struct *area; |
356 | 359 | ||
@@ -582,16 +585,18 @@ __iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, | |||
582 | 585 | ||
583 | /** | 586 | /** |
584 | * omap_iommu_vmap - (d)-(p)-(v) address mapper | 587 | * omap_iommu_vmap - (d)-(p)-(v) address mapper |
585 | * @obj: objective iommu | 588 | * @domain: iommu domain |
589 | * @dev: client device | ||
586 | * @sgt: address of scatter gather table | 590 | * @sgt: address of scatter gather table |
587 | * @flags: iovma and page property | 591 | * @flags: iovma and page property |
588 | * | 592 | * |
589 | * Creates 1-n-1 mapping with given @sgt and returns @da. | 593 | * Creates 1-n-1 mapping with given @sgt and returns @da. |
590 | * All @sgt element must be io page size aligned. | 594 | * All @sgt element must be io page size aligned. |
591 | */ | 595 | */ |
592 | u32 omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | 596 | u32 omap_iommu_vmap(struct iommu_domain *domain, struct device *dev, u32 da, |
593 | const struct sg_table *sgt, u32 flags) | 597 | const struct sg_table *sgt, u32 flags) |
594 | { | 598 | { |
599 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
595 | size_t bytes; | 600 | size_t bytes; |
596 | void *va = NULL; | 601 | void *va = NULL; |
597 | 602 | ||
@@ -622,15 +627,17 @@ EXPORT_SYMBOL_GPL(omap_iommu_vmap); | |||
622 | 627 | ||
623 | /** | 628 | /** |
624 | * omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()' | 629 | * omap_iommu_vunmap - release virtual mapping obtained by 'omap_iommu_vmap()' |
625 | * @obj: objective iommu | 630 | * @domain: iommu domain |
631 | * @dev: client device | ||
626 | * @da: iommu device virtual address | 632 | * @da: iommu device virtual address |
627 | * | 633 | * |
628 | * Free the iommu virtually contiguous memory area starting at | 634 | * Free the iommu virtually contiguous memory area starting at |
629 | * @da, which was returned by 'omap_iommu_vmap()'. | 635 | * @da, which was returned by 'omap_iommu_vmap()'. |
630 | */ | 636 | */ |
631 | struct sg_table * | 637 | struct sg_table * |
632 | omap_iommu_vunmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da) | 638 | omap_iommu_vunmap(struct iommu_domain *domain, struct device *dev, u32 da) |
633 | { | 639 | { |
640 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
634 | struct sg_table *sgt; | 641 | struct sg_table *sgt; |
635 | /* | 642 | /* |
636 | * 'sgt' is allocated before 'omap_iommu_vmalloc()' is called. | 643 | * 'sgt' is allocated before 'omap_iommu_vmalloc()' is called. |
@@ -647,7 +654,7 @@ EXPORT_SYMBOL_GPL(omap_iommu_vunmap); | |||
647 | 654 | ||
648 | /** | 655 | /** |
649 | * omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper | 656 | * omap_iommu_vmalloc - (d)-(p)-(v) address allocator and mapper |
650 | * @obj: objective iommu | 657 | * @dev: client device |
651 | * @da: contiguous iommu virtual memory | 658 | * @da: contiguous iommu virtual memory |
652 | * @bytes: allocation size | 659 | * @bytes: allocation size |
653 | * @flags: iovma and page property | 660 | * @flags: iovma and page property |
@@ -656,9 +663,10 @@ EXPORT_SYMBOL_GPL(omap_iommu_vunmap); | |||
656 | * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. | 663 | * @da again, which might be adjusted if 'IOVMF_DA_FIXED' is not set. |
657 | */ | 664 | */ |
658 | u32 | 665 | u32 |
659 | omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, | 666 | omap_iommu_vmalloc(struct iommu_domain *domain, struct device *dev, u32 da, |
660 | size_t bytes, u32 flags) | 667 | size_t bytes, u32 flags) |
661 | { | 668 | { |
669 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
662 | void *va; | 670 | void *va; |
663 | struct sg_table *sgt; | 671 | struct sg_table *sgt; |
664 | 672 | ||
@@ -698,15 +706,16 @@ EXPORT_SYMBOL_GPL(omap_iommu_vmalloc); | |||
698 | 706 | ||
699 | /** | 707 | /** |
700 | * omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()' | 708 | * omap_iommu_vfree - release memory allocated by 'omap_iommu_vmalloc()' |
701 | * @obj: objective iommu | 709 | * @dev: client device |
702 | * @da: iommu device virtual address | 710 | * @da: iommu device virtual address |
703 | * | 711 | * |
704 | * Frees the iommu virtually continuous memory area starting at | 712 | * Frees the iommu virtually continuous memory area starting at |
705 | * @da, as obtained from 'omap_iommu_vmalloc()'. | 713 | * @da, as obtained from 'omap_iommu_vmalloc()'. |
706 | */ | 714 | */ |
707 | void omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj, | 715 | void omap_iommu_vfree(struct iommu_domain *domain, struct device *dev, |
708 | const u32 da) | 716 | const u32 da) |
709 | { | 717 | { |
718 | struct omap_iommu *obj = dev_to_omap_iommu(dev); | ||
710 | struct sg_table *sgt; | 719 | struct sg_table *sgt; |
711 | 720 | ||
712 | sgt = unmap_vm_area(domain, obj, da, vfree, | 721 | sgt = unmap_vm_area(domain, obj, da, vfree, |
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c index b818cacf420f..d4c48ef227fb 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c | |||
@@ -80,13 +80,6 @@ | |||
80 | #include "isph3a.h" | 80 | #include "isph3a.h" |
81 | #include "isphist.h" | 81 | #include "isphist.h" |
82 | 82 | ||
83 | /* | ||
84 | * this is provided as an interim solution until omap3isp doesn't need | ||
85 | * any omap-specific iommu API | ||
86 | */ | ||
87 | #define to_iommu(dev) \ | ||
88 | (struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)) | ||
89 | |||
90 | static unsigned int autoidle; | 83 | static unsigned int autoidle; |
91 | module_param(autoidle, int, 0444); | 84 | module_param(autoidle, int, 0444); |
92 | MODULE_PARM_DESC(autoidle, "Enable OMAP3ISP AUTOIDLE support"); | 85 | MODULE_PARM_DESC(autoidle, "Enable OMAP3ISP AUTOIDLE support"); |
@@ -1114,8 +1107,7 @@ isp_restore_context(struct isp_device *isp, struct isp_reg *reg_list) | |||
1114 | static void isp_save_ctx(struct isp_device *isp) | 1107 | static void isp_save_ctx(struct isp_device *isp) |
1115 | { | 1108 | { |
1116 | isp_save_context(isp, isp_reg_list); | 1109 | isp_save_context(isp, isp_reg_list); |
1117 | if (isp->iommu) | 1110 | omap_iommu_save_ctx(isp->dev); |
1118 | omap_iommu_save_ctx(isp->iommu); | ||
1119 | } | 1111 | } |
1120 | 1112 | ||
1121 | /* | 1113 | /* |
@@ -1128,8 +1120,7 @@ static void isp_save_ctx(struct isp_device *isp) | |||
1128 | static void isp_restore_ctx(struct isp_device *isp) | 1120 | static void isp_restore_ctx(struct isp_device *isp) |
1129 | { | 1121 | { |
1130 | isp_restore_context(isp, isp_reg_list); | 1122 | isp_restore_context(isp, isp_reg_list); |
1131 | if (isp->iommu) | 1123 | omap_iommu_restore_ctx(isp->dev); |
1132 | omap_iommu_restore_ctx(isp->iommu); | ||
1133 | omap3isp_ccdc_restore_context(isp); | 1124 | omap3isp_ccdc_restore_context(isp); |
1134 | omap3isp_preview_restore_context(isp); | 1125 | omap3isp_preview_restore_context(isp); |
1135 | } | 1126 | } |
@@ -1983,7 +1974,7 @@ static int isp_remove(struct platform_device *pdev) | |||
1983 | isp_cleanup_modules(isp); | 1974 | isp_cleanup_modules(isp); |
1984 | 1975 | ||
1985 | omap3isp_get(isp); | 1976 | omap3isp_get(isp); |
1986 | iommu_detach_device(isp->domain, isp->iommu_dev); | 1977 | iommu_detach_device(isp->domain, &pdev->dev); |
1987 | iommu_domain_free(isp->domain); | 1978 | iommu_domain_free(isp->domain); |
1988 | omap3isp_put(isp); | 1979 | omap3isp_put(isp); |
1989 | 1980 | ||
@@ -2131,17 +2122,6 @@ static int isp_probe(struct platform_device *pdev) | |||
2131 | } | 2122 | } |
2132 | } | 2123 | } |
2133 | 2124 | ||
2134 | /* IOMMU */ | ||
2135 | isp->iommu_dev = omap_find_iommu_device("isp"); | ||
2136 | if (!isp->iommu_dev) { | ||
2137 | dev_err(isp->dev, "omap_find_iommu_device failed\n"); | ||
2138 | ret = -ENODEV; | ||
2139 | goto error_isp; | ||
2140 | } | ||
2141 | |||
2142 | /* to be removed once iommu migration is complete */ | ||
2143 | isp->iommu = to_iommu(isp->iommu_dev); | ||
2144 | |||
2145 | isp->domain = iommu_domain_alloc(pdev->dev.bus); | 2125 | isp->domain = iommu_domain_alloc(pdev->dev.bus); |
2146 | if (!isp->domain) { | 2126 | if (!isp->domain) { |
2147 | dev_err(isp->dev, "can't alloc iommu domain\n"); | 2127 | dev_err(isp->dev, "can't alloc iommu domain\n"); |
@@ -2149,7 +2129,7 @@ static int isp_probe(struct platform_device *pdev) | |||
2149 | goto error_isp; | 2129 | goto error_isp; |
2150 | } | 2130 | } |
2151 | 2131 | ||
2152 | ret = iommu_attach_device(isp->domain, isp->iommu_dev); | 2132 | ret = iommu_attach_device(isp->domain, &pdev->dev); |
2153 | if (ret) { | 2133 | if (ret) { |
2154 | dev_err(&pdev->dev, "can't attach iommu device: %d\n", ret); | 2134 | dev_err(&pdev->dev, "can't attach iommu device: %d\n", ret); |
2155 | goto free_domain; | 2135 | goto free_domain; |
@@ -2188,7 +2168,7 @@ error_modules: | |||
2188 | error_irq: | 2168 | error_irq: |
2189 | free_irq(isp->irq_num, isp); | 2169 | free_irq(isp->irq_num, isp); |
2190 | detach_dev: | 2170 | detach_dev: |
2191 | iommu_detach_device(isp->domain, isp->iommu_dev); | 2171 | iommu_detach_device(isp->domain, &pdev->dev); |
2192 | free_domain: | 2172 | free_domain: |
2193 | iommu_domain_free(isp->domain); | 2173 | iommu_domain_free(isp->domain); |
2194 | error_isp: | 2174 | error_isp: |
diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h index 705946ef4d60..d96603eb0d17 100644 --- a/drivers/media/video/omap3isp/isp.h +++ b/drivers/media/video/omap3isp/isp.h | |||
@@ -212,9 +212,7 @@ struct isp_device { | |||
212 | unsigned int sbl_resources; | 212 | unsigned int sbl_resources; |
213 | unsigned int subclk_resources; | 213 | unsigned int subclk_resources; |
214 | 214 | ||
215 | struct omap_iommu *iommu; | ||
216 | struct iommu_domain *domain; | 215 | struct iommu_domain *domain; |
217 | struct device *iommu_dev; | ||
218 | 216 | ||
219 | struct isp_platform_callback platform_cb; | 217 | struct isp_platform_callback platform_cb; |
220 | }; | 218 | }; |
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index b0b0fa5a3572..8748e0855c61 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c | |||
@@ -366,7 +366,7 @@ static void ccdc_lsc_free_request(struct isp_ccdc_device *ccdc, | |||
366 | dma_unmap_sg(isp->dev, req->iovm->sgt->sgl, | 366 | dma_unmap_sg(isp->dev, req->iovm->sgt->sgl, |
367 | req->iovm->sgt->nents, DMA_TO_DEVICE); | 367 | req->iovm->sgt->nents, DMA_TO_DEVICE); |
368 | if (req->table) | 368 | if (req->table) |
369 | omap_iommu_vfree(isp->domain, isp->iommu, req->table); | 369 | omap_iommu_vfree(isp->domain, isp->dev, req->table); |
370 | kfree(req); | 370 | kfree(req); |
371 | } | 371 | } |
372 | 372 | ||
@@ -438,7 +438,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc, | |||
438 | 438 | ||
439 | req->enable = 1; | 439 | req->enable = 1; |
440 | 440 | ||
441 | req->table = omap_iommu_vmalloc(isp->domain, isp->iommu, 0, | 441 | req->table = omap_iommu_vmalloc(isp->domain, isp->dev, 0, |
442 | req->config.size, IOMMU_FLAG); | 442 | req->config.size, IOMMU_FLAG); |
443 | if (IS_ERR_VALUE(req->table)) { | 443 | if (IS_ERR_VALUE(req->table)) { |
444 | req->table = 0; | 444 | req->table = 0; |
@@ -446,7 +446,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc, | |||
446 | goto done; | 446 | goto done; |
447 | } | 447 | } |
448 | 448 | ||
449 | req->iovm = omap_find_iovm_area(isp->iommu, req->table); | 449 | req->iovm = omap_find_iovm_area(isp->dev, req->table); |
450 | if (req->iovm == NULL) { | 450 | if (req->iovm == NULL) { |
451 | ret = -ENOMEM; | 451 | ret = -ENOMEM; |
452 | goto done; | 452 | goto done; |
@@ -462,7 +462,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc, | |||
462 | dma_sync_sg_for_cpu(isp->dev, req->iovm->sgt->sgl, | 462 | dma_sync_sg_for_cpu(isp->dev, req->iovm->sgt->sgl, |
463 | req->iovm->sgt->nents, DMA_TO_DEVICE); | 463 | req->iovm->sgt->nents, DMA_TO_DEVICE); |
464 | 464 | ||
465 | table = omap_da_to_va(isp->iommu, req->table); | 465 | table = omap_da_to_va(isp->dev, req->table); |
466 | if (copy_from_user(table, config->lsc, req->config.size)) { | 466 | if (copy_from_user(table, config->lsc, req->config.size)) { |
467 | ret = -EFAULT; | 467 | ret = -EFAULT; |
468 | goto done; | 468 | goto done; |
@@ -734,15 +734,15 @@ static int ccdc_config(struct isp_ccdc_device *ccdc, | |||
734 | * already done by omap_iommu_vmalloc(). | 734 | * already done by omap_iommu_vmalloc(). |
735 | */ | 735 | */ |
736 | size = ccdc->fpc.fpnum * 4; | 736 | size = ccdc->fpc.fpnum * 4; |
737 | table_new = omap_iommu_vmalloc(isp->domain, isp->iommu, | 737 | table_new = omap_iommu_vmalloc(isp->domain, isp->dev, |
738 | 0, size, IOMMU_FLAG); | 738 | 0, size, IOMMU_FLAG); |
739 | if (IS_ERR_VALUE(table_new)) | 739 | if (IS_ERR_VALUE(table_new)) |
740 | return -ENOMEM; | 740 | return -ENOMEM; |
741 | 741 | ||
742 | if (copy_from_user(omap_da_to_va(isp->iommu, table_new), | 742 | if (copy_from_user(omap_da_to_va(isp->dev, table_new), |
743 | (__force void __user *) | 743 | (__force void __user *) |
744 | ccdc->fpc.fpcaddr, size)) { | 744 | ccdc->fpc.fpcaddr, size)) { |
745 | omap_iommu_vfree(isp->domain, isp->iommu, | 745 | omap_iommu_vfree(isp->domain, isp->dev, |
746 | table_new); | 746 | table_new); |
747 | return -EFAULT; | 747 | return -EFAULT; |
748 | } | 748 | } |
@@ -753,7 +753,7 @@ static int ccdc_config(struct isp_ccdc_device *ccdc, | |||
753 | 753 | ||
754 | ccdc_configure_fpc(ccdc); | 754 | ccdc_configure_fpc(ccdc); |
755 | if (table_old != 0) | 755 | if (table_old != 0) |
756 | omap_iommu_vfree(isp->domain, isp->iommu, table_old); | 756 | omap_iommu_vfree(isp->domain, isp->dev, table_old); |
757 | } | 757 | } |
758 | 758 | ||
759 | return ccdc_lsc_config(ccdc, ccdc_struct); | 759 | return ccdc_lsc_config(ccdc, ccdc_struct); |
@@ -2309,7 +2309,7 @@ void omap3isp_ccdc_cleanup(struct isp_device *isp) | |||
2309 | ccdc_lsc_free_queue(ccdc, &ccdc->lsc.free_queue); | 2309 | ccdc_lsc_free_queue(ccdc, &ccdc->lsc.free_queue); |
2310 | 2310 | ||
2311 | if (ccdc->fpc.fpcaddr != 0) | 2311 | if (ccdc->fpc.fpcaddr != 0) |
2312 | omap_iommu_vfree(isp->domain, isp->iommu, ccdc->fpc.fpcaddr); | 2312 | omap_iommu_vfree(isp->domain, isp->dev, ccdc->fpc.fpcaddr); |
2313 | 2313 | ||
2314 | mutex_destroy(&ccdc->ioctl_lock); | 2314 | mutex_destroy(&ccdc->ioctl_lock); |
2315 | } | 2315 | } |
diff --git a/drivers/media/video/omap3isp/ispstat.c b/drivers/media/video/omap3isp/ispstat.c index 68d539456c55..9f41aa3d00a5 100644 --- a/drivers/media/video/omap3isp/ispstat.c +++ b/drivers/media/video/omap3isp/ispstat.c | |||
@@ -366,7 +366,7 @@ 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 | omap_iommu_vfree(isp->domain, isp->iommu, | 369 | omap_iommu_vfree(isp->domain, isp->dev, |
370 | buf->iommu_addr); | 370 | buf->iommu_addr); |
371 | } else { | 371 | } else { |
372 | if (!buf->virt_addr) | 372 | if (!buf->virt_addr) |
@@ -400,7 +400,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size) | |||
400 | struct iovm_struct *iovm; | 400 | struct iovm_struct *iovm; |
401 | 401 | ||
402 | WARN_ON(buf->dma_addr); | 402 | WARN_ON(buf->dma_addr); |
403 | buf->iommu_addr = omap_iommu_vmalloc(isp->domain, isp->iommu, 0, | 403 | buf->iommu_addr = omap_iommu_vmalloc(isp->domain, isp->dev, 0, |
404 | size, IOMMU_FLAG); | 404 | size, IOMMU_FLAG); |
405 | if (IS_ERR((void *)buf->iommu_addr)) { | 405 | if (IS_ERR((void *)buf->iommu_addr)) { |
406 | dev_err(stat->isp->dev, | 406 | dev_err(stat->isp->dev, |
@@ -410,7 +410,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size) | |||
410 | return -ENOMEM; | 410 | return -ENOMEM; |
411 | } | 411 | } |
412 | 412 | ||
413 | iovm = omap_find_iovm_area(isp->iommu, buf->iommu_addr); | 413 | iovm = omap_find_iovm_area(isp->dev, buf->iommu_addr); |
414 | if (!iovm || | 414 | if (!iovm || |
415 | !dma_map_sg(isp->dev, iovm->sgt->sgl, iovm->sgt->nents, | 415 | !dma_map_sg(isp->dev, iovm->sgt->sgl, iovm->sgt->nents, |
416 | DMA_FROM_DEVICE)) { | 416 | DMA_FROM_DEVICE)) { |
@@ -419,7 +419,7 @@ static int isp_stat_bufs_alloc_iommu(struct ispstat *stat, unsigned int size) | |||
419 | } | 419 | } |
420 | buf->iovm = iovm; | 420 | buf->iovm = iovm; |
421 | 421 | ||
422 | buf->virt_addr = omap_da_to_va(stat->isp->iommu, | 422 | buf->virt_addr = omap_da_to_va(stat->isp->dev, |
423 | (u32)buf->iommu_addr); | 423 | (u32)buf->iommu_addr); |
424 | buf->empty = 1; | 424 | buf->empty = 1; |
425 | 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 d1000723c5ae..9974cfc09090 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
@@ -452,7 +452,7 @@ ispmmu_vmap(struct isp_device *isp, const struct scatterlist *sglist, int sglen) | |||
452 | sgt->nents = sglen; | 452 | sgt->nents = sglen; |
453 | sgt->orig_nents = sglen; | 453 | sgt->orig_nents = sglen; |
454 | 454 | ||
455 | da = omap_iommu_vmap(isp->domain, isp->iommu, 0, sgt, IOMMU_FLAG); | 455 | da = omap_iommu_vmap(isp->domain, isp->dev, 0, sgt, IOMMU_FLAG); |
456 | if (IS_ERR_VALUE(da)) | 456 | if (IS_ERR_VALUE(da)) |
457 | kfree(sgt); | 457 | kfree(sgt); |
458 | 458 | ||
@@ -468,7 +468,7 @@ static void ispmmu_vunmap(struct isp_device *isp, dma_addr_t da) | |||
468 | { | 468 | { |
469 | struct sg_table *sgt; | 469 | struct sg_table *sgt; |
470 | 470 | ||
471 | sgt = omap_iommu_vunmap(isp->domain, isp->iommu, (u32)da); | 471 | sgt = omap_iommu_vunmap(isp->domain, isp->dev, (u32)da); |
472 | kfree(sgt); | 472 | kfree(sgt); |
473 | } | 473 | } |
474 | 474 | ||