@@ -111,6 +111,32 @@ struct iommu_platform_data {
111111 u32 da_end ;
112112};
113113
114+ /**
115+ * struct iommu_arch_data - omap iommu private data
116+ * @name: name of the iommu device
117+ * @iommu_dev: handle of the iommu device
118+ *
119+ * This is an omap iommu private data object, which binds an iommu user
120+ * to its iommu device. This object should be placed at the iommu user's
121+ * dev_archdata so generic IOMMU API can be used without having to
122+ * utilize omap-specific plumbing anymore.
123+ */
124+ struct omap_iommu_arch_data {
125+ const char * name ;
126+ struct omap_iommu * iommu_dev ;
127+ };
128+
129+ /**
130+ * dev_to_omap_iommu() - retrieves an omap iommu object from a user device
131+ * @dev: iommu client device
132+ */
133+ static inline struct omap_iommu * dev_to_omap_iommu (struct device * dev )
134+ {
135+ struct omap_iommu_arch_data * arch_data = dev -> archdata .iommu ;
136+
137+ return arch_data -> iommu_dev ;
138+ }
139+
114140/* IOMMU errors */
115141#define OMAP_IOMMU_ERR_TLB_MISS (1 << 0)
116142#define OMAP_IOMMU_ERR_TRANS_FAULT (1 << 1)
@@ -163,8 +189,8 @@ extern int omap_iommu_set_isr(const char *name,
163189 void * priv ),
164190 void * isr_priv );
165191
166- extern void omap_iommu_save_ctx (struct omap_iommu * obj );
167- extern void omap_iommu_restore_ctx (struct omap_iommu * obj );
192+ extern void omap_iommu_save_ctx (struct device * dev );
193+ extern void omap_iommu_restore_ctx (struct device * dev );
168194
169195extern int omap_install_iommu_arch (const struct iommu_functions * ops );
170196extern void omap_uninstall_iommu_arch (const struct iommu_functions * ops );
@@ -176,6 +202,5 @@ extern ssize_t
176202omap_iommu_dump_ctx (struct omap_iommu * obj , char * buf , ssize_t len );
177203extern size_t
178204omap_dump_tlb_entries (struct omap_iommu * obj , char * buf , ssize_t len );
179- struct device * omap_find_iommu_device (const char * name );
180205
181206#endif /* __MACH_IOMMU_H */
0 commit comments