iommu/mediatek: Move vld_pa_rng into plat_data
authorYong Wu <yong.wu@mediatek.com>
Sat, 24 Aug 2019 03:02:00 +0000 (11:02 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 30 Aug 2019 13:57:27 +0000 (15:57 +0200)
Both mt8173 and mt8183 don't have this vld_pa_rng(valid physical address
range) register while mt2712 have. Move it into the plat_data.

Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Reviewed-by: Evan Green <evgreen@chromium.org>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/mtk_iommu.c
drivers/iommu/mtk_iommu.h

index b43f36a..eaf6a23 100644 (file)
@@ -567,7 +567,7 @@ static int mtk_iommu_hw_init(const struct mtk_iommu_data *data)
                         upper_32_bits(data->protect_base);
        writel_relaxed(regval, data->base + REG_MMU_IVRP_PADDR);
 
-       if (data->enable_4GB && data->plat_data->m4u_plat != M4U_MT8173) {
+       if (data->enable_4GB && data->plat_data->has_vld_pa_rng) {
                /*
                 * If 4GB mode is enabled, the validate PA range is from
                 * 0x1_0000_0000 to 0x1_ffff_ffff. here record bit[32:30].
@@ -766,6 +766,7 @@ static const struct mtk_iommu_plat_data mt2712_data = {
        .m4u_plat     = M4U_MT2712,
        .has_4gb_mode = true,
        .has_bclk     = true,
+       .has_vld_pa_rng   = true,
        .larbid_remap = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9},
 };
 
index 8d3b525..973d6e0 100644 (file)
@@ -38,6 +38,7 @@ struct mtk_iommu_plat_data {
 
        /* HW will use the EMI clock if there isn't the "bclk". */
        bool                has_bclk;
+       bool                has_vld_pa_rng;
        bool                reset_axi;
        unsigned char       larbid_remap[MTK_LARB_NR_MAX];
 };