Skip to content

Commit 8d4346e

Browse files
Simon Xuejoergroedel
authored andcommitted
iommu/rockchip: disable fetch dte time limit
Disable the Bit 31 of the AUTO_GATING iommu register, as it causes hangups with the RGA3 (Raster Graphics Acceleration 3) peripheral. The RGA3 register description of the TRM already states that the bit must be set to 1. The vendor kernel sets the bit unconditionally to 1 to fix VOP (Video Output Processor) screen black issues. This patch squashes the 2 vendor kernel commits with the following commit messages: Master fetch data and cpu update page table may work in parallel, may have the following procedure: master cpu fetch dte update page tabl | | (make dte invalid) <- zap iotlb entry | | fetch dte again (make dte invalid) <- zap iotlb entry | | fetch dte again (make dte invalid) <- zap iotlb entry | | fetch dte again (make iommu block) <- zap iotlb entry New iommu version has the above bug, if fetch dte consecutively four times, then it will be blocked. Fortunately, we can set bit 31 of register MMU_AUTO_GATING to 1 to make it work as old version which does not have this issue. This issue only appears on RV1126 so far, so make a workaround dedicated to "rockchip,rv1126" machine type. iommu/rockchip: fix vop blocked and screen black on RK356X and RK3588 RK3568 and RK3588 has the same issue as RV1126/RV1109 that caused by dte fetch time limit, So we can set BIT(31) of register 0x24 default to 1 as a workaround. Signed-off-by: Simon Xue <xxm@rock-chips.com> Signed-off-by: Sven Püschel <s.pueschel@pengutronix.de> Acked-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
1 parent 5d69190 commit 8d4346e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/iommu/rockchip-iommu.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
#define SPAGE_ORDER 12
7777
#define SPAGE_SIZE (1 << SPAGE_ORDER)
7878

79+
#define DISABLE_FETCH_DTE_TIME_LIMIT BIT(31)
80+
7981
/*
8082
* Support mapping any size that fits in one page table:
8183
* 4 KiB to 4 MiB
@@ -930,6 +932,7 @@ static int rk_iommu_enable(struct rk_iommu *iommu)
930932
struct iommu_domain *domain = iommu->domain;
931933
struct rk_iommu_domain *rk_domain = to_rk_domain(domain);
932934
int ret, i;
935+
u32 auto_gate;
933936

934937
ret = clk_bulk_enable(iommu->num_clocks, iommu->clocks);
935938
if (ret)
@@ -948,6 +951,11 @@ static int rk_iommu_enable(struct rk_iommu *iommu)
948951
rk_ops->mk_dtentries(rk_domain->dt_dma));
949952
rk_iommu_base_command(iommu->bases[i], RK_MMU_CMD_ZAP_CACHE);
950953
rk_iommu_write(iommu->bases[i], RK_MMU_INT_MASK, RK_MMU_IRQ_MASK);
954+
955+
/* Workaround for iommu blocked, BIT(31) default to 1 */
956+
auto_gate = rk_iommu_read(iommu->bases[i], RK_MMU_AUTO_GATING);
957+
auto_gate |= DISABLE_FETCH_DTE_TIME_LIMIT;
958+
rk_iommu_write(iommu->bases[i], RK_MMU_AUTO_GATING, auto_gate);
951959
}
952960

953961
ret = rk_iommu_enable_paging(iommu);

0 commit comments

Comments
 (0)