media: rockchip: cif fixes iommu issue

Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
Change-Id: Id61e87ba20cc13d682fd01417fa1ba271f7e66f8
This commit is contained in:
Zefa Chen
2021-11-14 18:26:35 +08:00
committed by Tao Huang
parent 0b2335921b
commit ec87cfdebb
2 changed files with 8 additions and 14 deletions

View File

@@ -19,6 +19,7 @@
#include <media/videobuf2-dma-sg.h>
#include <soc/rockchip/rockchip-system-status.h>
#include <dt-bindings/soc/rockchip-system-status.h>
#include <soc/rockchip/rockchip_iommu.h>
#include "dev.h"
#include "mipi-csi2.h"
@@ -2869,13 +2870,8 @@ static void rkcif_do_cru_reset(struct rkcif_device *dev)
reset_control_deassert(cif_hw->cif_rst[i]);
if (cif_hw->iommu_en) {
struct iommu_domain *domain;
domain = iommu_get_domain_for_dev(cif_hw->dev);
if (domain) {
iommu_detach_device(domain, cif_hw->dev);
iommu_attach_device(domain, cif_hw->dev);
}
rockchip_iommu_disable(cif_hw->dev);
rockchip_iommu_enable(cif_hw->dev);
}
}

View File

@@ -25,6 +25,7 @@
#include <soc/rockchip/rockchip-system-status.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <soc/rockchip/rockchip_iommu.h>
#include "dev.h"
#include "common.h"
@@ -906,17 +907,14 @@ err:
static void rkcif_iommu_cleanup(struct rkcif_hw *cif_hw)
{
if (cif_hw->domain)
iommu_detach_device(cif_hw->domain, cif_hw->dev);
if (cif_hw->iommu_en)
rockchip_iommu_disable(cif_hw->dev);
}
static void rkcif_iommu_enable(struct rkcif_hw *cif_hw)
{
if (!cif_hw->domain)
cif_hw->domain = iommu_get_domain_for_dev(cif_hw->dev);
if (cif_hw->domain)
iommu_attach_device(cif_hw->domain, cif_hw->dev);
if (cif_hw->iommu_en)
rockchip_iommu_enable(cif_hw->dev);
}
static inline bool is_iommu_enable(struct device *dev)