rk3288: modified for new iommu interface
authorljf <ljf@rock-chips.com>
Fri, 8 Aug 2014 05:55:51 +0000 (13:55 +0800)
committerljf <ljf@rock-chips.com>
Fri, 8 Aug 2014 05:55:51 +0000 (13:55 +0800)
arch/arm/mach-rockchip/vcodec_service.c
drivers/video/rockchip/iep/iep_drv.c
drivers/video/rockchip/iep/iep_drv.h

index 5b4bd9dcb295afcb726ba01367948535714eec09..03f427ec4e11e0a6bca0e5429540bbae7fdecb49 100755 (executable)
@@ -33,6 +33,7 @@
 #include <linux/wakelock.h>\r
 #include <linux/cdev.h>\r
 #include <linux/of.h>\r
+#include <linux/of_platform.h>\r
 #include <linux/rockchip/cpu.h>\r
 #include <linux/rockchip/cru.h>\r
 \r
@@ -48,8 +49,7 @@
 #endif\r
 \r
 #ifdef CONFIG_VCODEC_MMU\r
-#include <linux/rockchip/iovmm.h>\r
-#include <linux/rockchip/sysmmu.h>\r
+#include <linux/rockchip-iovmm.h>\r
 #include <linux/dma-buf.h>\r
 #endif\r
 \r
@@ -554,7 +554,7 @@ static void vpu_service_power_off(struct vpu_service_info *pservice)
     \r
 #if defined(CONFIG_VCODEC_MMU)\r
     if (pservice->mmu_dev) {\r
-        iovmm_deactivate(pservice->dev);\r
+        rockchip_iovmm_deactivate(pservice->dev);\r
     }\r
 #endif \r
 \r
@@ -630,7 +630,7 @@ static void vpu_service_power_on(struct vpu_service_info *pservice)
     \r
 #if defined(CONFIG_VCODEC_MMU)    \r
     if (pservice->mmu_dev) {\r
-        iovmm_activate(pservice->dev);\r
+        rockchip_iovmm_activate(pservice->dev);\r
     }\r
 #endif    \r
 }\r
@@ -1442,6 +1442,43 @@ static void simulate_start(struct vpu_service_info *pservice)
 }\r
 #endif\r
 \r
+#ifdef CONFIG_VCODEC_MMU\r
+static struct device *rockchip_get_sysmmu_device_by_compatible(const char *compt)\r
+{\r
+       struct device_node *dn = NULL;\r
+       struct platform_device *pd = NULL;\r
+       struct device *ret = NULL ;\r
+\r
+       dn = of_find_compatible_node(NULL,NULL,compt);\r
+       if(!dn)\r
+       {\r
+               printk("can't find device node %s \r\n",compt);\r
+               return NULL;\r
+       }\r
+       \r
+       pd = of_find_device_by_node(dn);\r
+       if(!pd)\r
+       {       \r
+               printk("can't find platform device in device node %s \r\n",compt);\r
+               return  NULL;\r
+       }\r
+       ret = &pd->dev;\r
+       \r
+       return ret;\r
+\r
+}\r
+#ifdef CONFIG_IOMMU_API\r
+static inline void platform_set_sysmmu(struct device *iommu, struct device *dev)\r
+{\r
+       dev->archdata.iommu = iommu;\r
+}\r
+#else\r
+static inline void platform_set_sysmmu(struct device *iommu, struct device *dev)\r
+{\r
+}\r
+#endif\r
+#endif\r
+\r
 #if HEVC_TEST_ENABLE\r
 static int hevc_test_case0(vpu_service_info *pservice);\r
 #endif\r
@@ -1630,7 +1667,7 @@ static int vcodec_probe(struct platform_device *pdev)
 \r
                if (pservice->mmu_dev) {\r
                        platform_set_sysmmu(pservice->mmu_dev, pservice->dev);\r
-                       iovmm_activate(pservice->dev);\r
+                       rockchip_iovmm_activate(pservice->dev);\r
                }\r
        }\r
 #endif\r
index f1d0114a201d13a8066a1b8cd1f4d50e498045e2..4ad9217f60e028e0ff59659d0f131db3b15f9e8f 100755 (executable)
@@ -27,6 +27,7 @@
 #include <linux/rk_fb.h>\r
 #include <linux/wakelock.h>\r
 #include <linux/of.h>\r
+#include <linux/of_platform.h>\r
 #include <linux/io.h>\r
 #include <linux/module.h>\r
 #include <asm/cacheflush.h>\r
@@ -223,7 +224,7 @@ static void iep_power_on(void)
     \r
 #if defined(CONFIG_IEP_IOMMU)\r
     if (iep_service.iommu_dev) {\r
-        iovmm_activate(iep_service.iommu_dev);\r
+        rockchip_iovmm_activate(iep_service.iommu_dev);\r
     }\r
 #endif    \r
     \r
@@ -250,7 +251,7 @@ static void iep_power_off(void)
     \r
 #if defined(CONFIG_IEP_IOMMU)\r
     if (iep_service.iommu_dev) {\r
-        iovmm_deactivate(iep_service.iommu_dev);\r
+        rockchip_iovmm_deactivate(iep_service.iommu_dev);\r
     }\r
 #endif    \r
 \r
@@ -790,6 +791,43 @@ static struct miscdevice iep_dev = {
     .fops  = &iep_fops,\r
 };\r
 \r
+#ifdef CONFIG_IEP_IOMMU\r
+static struct device *rockchip_get_sysmmu_device_by_compatible(const char *compt)\r
+{\r
+       struct device_node *dn = NULL;\r
+       struct platform_device *pd = NULL;\r
+       struct device *ret = NULL ;\r
+\r
+       dn = of_find_compatible_node(NULL,NULL,compt);\r
+       if(!dn)\r
+       {\r
+               printk("can't find device node %s \r\n",compt);\r
+               return NULL;\r
+       }\r
+       \r
+       pd = of_find_device_by_node(dn);\r
+       if(!pd)\r
+       {       \r
+               printk("can't find platform device in device node %s \r\n",compt);\r
+               return  NULL;\r
+       }\r
+       ret = &pd->dev;\r
+       \r
+       return ret;\r
+\r
+}\r
+#ifdef CONFIG_IOMMU_API\r
+static inline void platform_set_sysmmu(struct device *iommu, struct device *dev)\r
+{\r
+       dev->archdata.iommu = iommu;\r
+}\r
+#else\r
+static inline void platform_set_sysmmu(struct device *iommu, struct device *dev)\r
+{\r
+}\r
+#endif\r
+#endif\r
+\r
 #if defined(CONFIG_IEP_IOMMU)\r
 extern struct ion_client *rockchip_ion_client_create(const char * name);\r
 #endif\r
@@ -903,7 +941,7 @@ static int iep_drv_probe(struct platform_device *pdev)
         \r
         if (mmu_dev) {\r
             platform_set_sysmmu(mmu_dev, &pdev->dev);\r
-            iovmm_activate(&pdev->dev);\r
+            rockchip_iovmm_activate(&pdev->dev);\r
         }\r
 \r
         iep_service.iommu_dev = &pdev->dev;\r
index e0e40baccf91d91778f96f8d61b2a3cc5b781601..84c02f215d3eaa3e8c204aaabd95ff7bf77f3c16 100755 (executable)
@@ -11,8 +11,7 @@
 \r
 #ifdef CONFIG_IEP_IOMMU\r
 #include <linux/rockchip_ion.h>\r
-#include <linux/rockchip/iovmm.h>\r
-#include <linux/rockchip/sysmmu.h>\r
+#include <linux/rockchip-iovmm.h>\r
 #include <linux/dma-buf.h>\r
 #endif\r
 #include "iep.h"\r