#include <asm/pgtable.h>
#include <linux/of.h>
#include <linux/rockchip-iovmm.h>
+#include <linux/rockchip/grf.h>
+#include <linux/rockchip/cpu.h>
+#include <linux/rockchip/iomap.h>
#include "rockchip-iommu.h"
static struct kmem_cache *lv2table_kmem_cache;
+static void rockchip_vcodec_select(const char *string)
+{
+ if(strstr(string,"hevc"))
+ {
+ writel_relaxed(readl_relaxed(RK_GRF_VIRT + RK3036_GRF_SOC_CON1) |
+ (BIT_VCODEC_SEL) | (BIT_VCODEC_SEL << 16),
+ RK_GRF_VIRT + RK3036_GRF_SOC_CON1);
+ }
+ else if(strstr(string,"vpu"))
+ {
+ writel_relaxed((readl_relaxed(RK_GRF_VIRT + RK3036_GRF_SOC_CON1) &
+ (~BIT_VCODEC_SEL)) | (BIT_VCODEC_SEL << 16),
+ RK_GRF_VIRT + RK3036_GRF_SOC_CON1);
+ }
+}
static unsigned long *section_entry(unsigned long *pgtable, unsigned long iova)
{
return pgtable + lv1ent_offset(iova);
read_unlock(&data->lock);
return IRQ_HANDLED;
}
+
+ if(cpu_is_rk312x() || cpu_is_rk3036())
+ rockchip_vcodec_select(data->dbgname);
+
pdev = to_platform_device(data->iommu);
for (i = 0; i < data->num_res_irq; i++) {
struct iommu_drvdata *data = dev_get_drvdata(dev->archdata.iommu);
read_lock_irqsave(&data->lock, flags);
+
+ if(cpu_is_rk312x() || cpu_is_rk3036())
+ rockchip_vcodec_select(data->dbgname);
+
if (is_iommu_active(data)) {
int i;
}
if (!found)
goto finish;
+
+ if(cpu_is_rk312x() || cpu_is_rk3036())
+ rockchip_vcodec_select(data->dbgname);
+
if (__rockchip_iommu_disable(data)) {
pr_info("%s: Detached IOMMU with pgtable %#lx\n",
__func__, __pa(priv->pgtable));
int ret;
spin_lock_irqsave(&priv->lock, flags);
+
+ if(cpu_is_rk312x() || cpu_is_rk3036())
+ rockchip_vcodec_select(data->dbgname);
+
ret = __rockchip_iommu_enable(data, __pa(priv->pgtable), domain);
if (ret == 0) {
spin_lock_irqsave(&priv->lock, flags);
list_for_each_entry(data, &priv->clients, node) {
+ if(cpu_is_rk312x() || cpu_is_rk3036())
+ rockchip_vcodec_select(data->dbgname);
while (!rockchip_iommu_disable(data->dev))
; /* until System MMU is actually disabled */
}
ret = -ENOENT;
goto err_res;
}
+
+ if(cpu_is_rk312x() || cpu_is_rk3036())
+ rockchip_vcodec_select(data->dbgname);
+
if (!strstr(data->dbgname, "isp")) {
if (!iommu_reset(data->res_bases[i], data->dbgname)) {
ret = -ENOENT;