+static struct device *rockchip_get_sysmmu_device_by_compatible(const char *compt)
+{
+ struct device_node *dn = NULL;
+ struct platform_device *pd = NULL;
+ struct device *ret = NULL ;
+
+ dn = of_find_compatible_node(NULL,NULL,compt);
+ if(!dn)
+ {
+ printk("can't find device node %s \r\n",compt);
+ return NULL;
+ }
+
+ pd = of_find_device_by_node(dn);
+ if(!pd)
+ {
+ printk("can't find platform device in device node %s \r\n",compt);
+ return NULL;
+ }
+ ret = &pd->dev;
+
+ return ret;
+
+}
+#ifdef CONFIG_IOMMU_API
+static inline void platform_set_sysmmu(struct device *iommu, struct device *dev)
+{
+ dev->archdata.iommu = iommu;
+}
+#else
+static inline void platform_set_sysmmu(struct device *iommu, struct device *dev)
+{
+}
+#endif
+
+
+static int camsys_mrv_iommu_cb(void *ptr,camsys_sysctrl_t *devctl)
+{
+ struct device *iommu_dev = NULL,*dev = NULL;
+ struct file *file = NULL;
+ struct ion_client *client = NULL;
+ struct ion_handle *handle = NULL;
+ camsys_iommu_t *iommu = NULL;
+ int ret = 0,iommu_enabled = 0;
+ camsys_dev_t * camsys_dev = (camsys_dev_t *)ptr;
+
+ of_property_read_u32(camsys_dev->pdev->dev.of_node, "rockchip,isp,iommu_enable", &iommu_enabled);
+ if(iommu_enabled != 1){
+ camsys_err("isp iommu have not been enabled!\n");
+ ret = -1;
+ goto iommu_end;
+ }
+ iommu_dev = rockchip_get_sysmmu_device_by_compatible(ISP_IOMMU_COMPATIBLE_NAME);
+ if(!iommu_dev){
+ camsys_err("get iommu device erro!\n");
+ ret = -1;
+ goto iommu_end;
+ }
+ dev = &(camsys_dev->pdev->dev);
+ iommu = (camsys_iommu_t *)(devctl->rev);
+ file = fget(iommu->client_fd);
+ if(!file){
+ camsys_err("get client_fd file erro!\n");
+ ret = -1;
+ goto iommu_end;
+ }
+
+ client = file->private_data;
+
+ if(!client){
+ camsys_err("get ion_client erro!\n");
+ ret = -1;
+ goto iommu_end;
+ }
+
+ fput(file);