#ifdef CONFIG_OF
#include <linux/of.h>
+#include <linux/of_platform.h>
#include <linux/of_gpio.h>
#include <video/of_display_timing.h>
#include <video/display_timing.h>
return true;
}
+
+/****
+1,success : pointer to the device inside of platform device
+2,fail : NULL
+****/
+struct device *rk_fb_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
+void rk_fb_platform_set_sysmmu(struct device *sysmmu, struct device *dev)
+{
+ dev->archdata.iommu = sysmmu;
+}
+#else
+void rk_fb_platform_set_sysmmu(struct device *sysmmu, struct device *dev)
+{
+
+}
+#endif
+
static int rk_fb_open(struct fb_info *info, int user)
{
struct rk_lcdc_driver *dev_drv = (struct rk_lcdc_driver *)info->par;
#if defined(CONFIG_ROCKCHIP_IOMMU)
if (dev_drv->iommu_enabled) {
mmu_dev =
- rockchip_get_sysmmu_device_by_compatible(dev_drv->mmu_dts_name);
+ rk_fb_get_sysmmu_device_by_compatible(dev_drv->mmu_dts_name);
if (mmu_dev) {
- platform_set_sysmmu(mmu_dev, dev_drv->dev);
+ rk_fb_platform_set_sysmmu(mmu_dev, dev_drv->dev);
rockchip_sysmmu_set_fault_handler(dev_drv->dev,
rk_fb_sysmmu_fault_handler);
- iovmm_activate(dev_drv->dev);
+ rockchip_iovmm_activate(dev_drv->dev);
} else
dev_err(dev_drv->dev,
"failed to get rockchip iommu device\n");