Skip to content

Commit 4bb2bf4

Browse files
Chao Haojoergroedel
authored andcommitted
iommu/mediatek: Setting MISC_CTRL register
Add F_MMU_IN_ORDER_WR_EN_MASK and F_MMU_STANDARD_AXI_MODE_EN_MASK definitions in MISC_CTRL register. F_MMU_STANDARD_AXI_MODE_EN_MASK: If we set F_MMU_STANDARD_AXI_MODE_EN_MASK (bit[3][19] = 0, not follow standard AXI protocol), the iommu will priorize sending of urgent read command over a normal read command. This improves the performance. F_MMU_IN_ORDER_WR_EN_MASK: If we set F_MMU_IN_ORDER_WR_EN_MASK (bit[1][17] = 0, out-of-order write), the iommu will re-order write commands and send the write commands with higher priority. Otherwise the sending of write commands will be done in order. The feature is controlled by OUT_ORDER_WR_EN platform data flag. Suggested-by: Yong Wu <[email protected]> Signed-off-by: Chao Hao <[email protected]> Reviewed-by: Matthias Brugger <[email protected]> Cc: Matthias Brugger <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 6b71779 commit 4bb2bf4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/iommu/mtk_iommu.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@
4242
#define F_INVLD_EN1 BIT(1)
4343

4444
#define REG_MMU_MISC_CTRL 0x048
45+
#define F_MMU_IN_ORDER_WR_EN_MASK (BIT(1) | BIT(17))
46+
#define F_MMU_STANDARD_AXI_MODE_MASK (BIT(3) | BIT(19))
47+
4548
#define REG_MMU_DCM_DIS 0x050
4649

4750
#define REG_MMU_CTRL_REG 0x110
@@ -105,6 +108,7 @@
105108
#define HAS_BCLK BIT(1)
106109
#define HAS_VLD_PA_RNG BIT(2)
107110
#define RESET_AXI BIT(3)
111+
#define OUT_ORDER_WR_EN BIT(4)
108112

109113
#define MTK_IOMMU_HAS_FLAG(pdata, _x) \
110114
((((pdata)->flags) & (_x)) == (_x))
@@ -585,8 +589,14 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data)
585589

586590
if (MTK_IOMMU_HAS_FLAG(data->plat_data, RESET_AXI)) {
587591
/* The register is called STANDARD_AXI_MODE in this case */
588-
writel_relaxed(0, data->base + REG_MMU_MISC_CTRL);
592+
regval = 0;
593+
} else {
594+
regval = readl_relaxed(data->base + REG_MMU_MISC_CTRL);
595+
regval &= ~F_MMU_STANDARD_AXI_MODE_MASK;
596+
if (MTK_IOMMU_HAS_FLAG(data->plat_data, OUT_ORDER_WR_EN))
597+
regval &= ~F_MMU_IN_ORDER_WR_EN_MASK;
589598
}
599+
writel_relaxed(regval, data->base + REG_MMU_MISC_CTRL);
590600

591601
if (devm_request_irq(data->dev, data->irq, mtk_iommu_isr, 0,
592602
dev_name(data->dev), (void *)data)) {

0 commit comments

Comments
 (0)