aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOhad Ben-Cohen <ohad@wizery.com>2011-10-10 18:18:33 -0400
committerOhad Ben-Cohen <ohad@wizery.com>2011-12-05 08:47:39 -0500
commitfabdbca8c991dfa0ea1ff26214ae7d18e5740cc3 (patch)
treeeb749033a25fd557e21756936ba83180fefdb8c8
parentc8eaab3b74f1326c989e1db8d7c0c14981556e4e (diff)
iommu/omap: eliminate the public omap_find_iommu_device() method
Eliminate the public omap_find_iommu_device() method, and don't expect clients to provide the omap_iommu handle anymore. Instead, OMAP's iommu driver now utilizes dev_archdata's private iommu extension to be able to access the required iommu information. This way OMAP IOMMU users are now able to use the generic IOMMU API without having to call any omap-specific binding method. Update omap3isp appropriately. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Tony Lindgren <tony@atomide.com> Cc: Hiroshi Doyu <hdoyu@nvidia.com>
-rw-r--r--arch/arm/plat-omap/include/plat/iommu.h5
-rw-r--r--arch/arm/plat-omap/include/plat/iovmm.h12
-rw-r--r--drivers/iommu/omap-iommu.c58
-rw-r--r--drivers/iommu/omap-iovmm.c31
-rw-r--r--drivers/media/video/omap3isp/isp.c30
-rw-r--r--drivers/media/video/omap3isp/isp.h2
-rw-r--r--drivers/media/video/omap3isp/ispccdc.c18
-rw-r--r--drivers/media/video/omap3isp/ispstat.c8
-rw-r--r--drivers/media/video/omap3isp/ispvideo.c4
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
192extern void omap_iommu_save_ctx(struct omap_iommu *obj); 192extern void omap_iommu_save_ctx(struct device *dev);
193extern void omap_iommu_restore_ctx(struct omap_iommu *obj); 193extern void omap_iommu_restore_ctx(struct device *dev);
194 194
195extern int omap_install_iommu_arch(const struct iommu_functions *ops); 195extern int omap_install_iommu_arch(const struct iommu_functions *ops);
196extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops); 196extern void omap_uninstall_iommu_arch(const struct iommu_functions *ops);
@@ -202,6 +202,5 @@ extern ssize_t
202omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len); 202omap_iommu_dump_ctx(struct omap_iommu *obj, char *buf, ssize_t len);
203extern size_t 203extern size_t
204omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len); 204omap_dump_tlb_entries(struct omap_iommu *obj, char *buf, ssize_t len);
205struct 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
75extern struct iovm_struct *omap_find_iovm_area(struct omap_iommu *obj, u32 da); 75extern struct iovm_struct *omap_find_iovm_area(struct device *dev, u32 da);
76extern u32 76extern u32
77omap_iommu_vmap(struct iommu_domain *domain, struct omap_iommu *obj, u32 da, 77omap_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);
79extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain, 79extern struct sg_table *omap_iommu_vunmap(struct iommu_domain *domain,
80 struct omap_iommu *obj, u32 da); 80 struct device *dev, u32 da);
81extern u32 81extern u32
82omap_iommu_vmalloc(struct iommu_domain *domain, struct omap_iommu *obj, 82omap_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);
84extern void 84extern void
85omap_iommu_vfree(struct iommu_domain *domain, struct omap_iommu *obj, 85omap_iommu_vfree(struct iommu_domain *domain, struct device *dev,
86 const u32 da); 86 const u32 da);
87extern void *omap_da_to_va(struct omap_iommu *obj, u32 da); 87extern 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 **/
91void omap_iommu_save_ctx(struct omap_iommu *obj) 91void 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}
95EXPORT_SYMBOL_GPL(omap_iommu_save_ctx); 97EXPORT_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 **/
101void omap_iommu_restore_ctx(struct omap_iommu *obj) 103void 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}
105EXPORT_SYMBOL_GPL(omap_iommu_restore_ctx); 109EXPORT_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 */
835struct 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}
841EXPORT_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 **/
848static struct omap_iommu *omap_iommu_attach(struct device *dev, u32 *iopgd) 831static 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 }