iommu/rockchip: add iommu force reset interface for device
Signed-off-by: Chandler Chen <chandler.chen@rock-chips.com> Change-Id: I153b91b2e1ad8e099d80f4af8c9e51d12f3af607
This commit is contained in:
@ -1434,6 +1434,28 @@ bool rockchip_iommu_is_enabled(struct device *dev)
|
||||
}
|
||||
EXPORT_SYMBOL(rockchip_iommu_is_enabled);
|
||||
|
||||
int rockchip_iommu_force_reset(struct device *dev)
|
||||
{
|
||||
struct rk_iommu *iommu;
|
||||
int ret;
|
||||
|
||||
iommu = rk_iommu_from_dev(dev);
|
||||
if (!iommu)
|
||||
return -ENODEV;
|
||||
|
||||
ret = rk_iommu_enable_stall(iommu);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = rk_iommu_force_reset(iommu);
|
||||
|
||||
rk_iommu_disable_stall(iommu);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL(rockchip_iommu_force_reset);
|
||||
|
||||
static void rk_iommu_detach_device(struct iommu_domain *domain,
|
||||
struct device *dev)
|
||||
{
|
||||
|
||||
@ -13,6 +13,7 @@ int rockchip_iommu_disable(struct device *dev);
|
||||
bool rockchip_iommu_is_enabled(struct device *dev);
|
||||
int rockchip_pagefault_done(struct device *master_dev);
|
||||
void __iomem *rockchip_get_iommu_base(struct device *master_dev, int idx);
|
||||
int rockchip_iommu_force_reset(struct device *dev);
|
||||
#else
|
||||
static inline int rockchip_iommu_enable(struct device *dev)
|
||||
{
|
||||
@ -33,6 +34,10 @@ static inline void __iomem *rockchip_get_iommu_base(struct device *master_dev, i
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
static inline int rockchip_iommu_force_reset(struct device *dev)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user