summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2016-02-18 15:12:54 +0100
committerJoerg Roedel <jroedel@suse.de>2016-02-25 15:32:10 +0100
commit83addecdb7c9a4a533205cf57cb4d5b5631a704b (patch)
tree9edad940181f201724860a747375746b4014bb43 /drivers/iommu
parentd093fc7e8390c3e46294290c0d76de93422a601f (diff)
downloadlinux-83addecdb7c9a4a533205cf57cb4d5b5631a704b.tar.bz2
iommu/exynos: Refactor init config code
This patch rewrites sysmmu_init_config function to make it easier to read and understand. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/exynos-iommu.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 3a577a473f3c..15787a177a16 100644
--- a/drivers/iommu/exynos-iommu.c
+++ b/drivers/iommu/exynos-iommu.c
@@ -383,24 +383,17 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data)
static void __sysmmu_init_config(struct sysmmu_drvdata *data)
{
- unsigned int cfg = CFG_LRU | CFG_QOS(15);
- unsigned int ver;
-
- ver = MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION));
- if (MMU_MAJ_VER(ver) == 3) {
- if (MMU_MIN_VER(ver) >= 2) {
- cfg |= CFG_FLPDCACHE;
- if (MMU_MIN_VER(ver) == 3) {
- cfg |= CFG_ACGEN;
- cfg &= ~CFG_LRU;
- } else {
- cfg |= CFG_SYSSEL;
- }
- }
- }
+ unsigned int cfg;
+
+ data->version = MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION));
+ if (data->version <= MAKE_MMU_VER(3, 1))
+ cfg = CFG_LRU | CFG_QOS(15);
+ else if (data->version <= MAKE_MMU_VER(3, 2))
+ cfg = CFG_LRU | CFG_QOS(15) | CFG_FLPDCACHE | CFG_SYSSEL;
+ else
+ cfg = CFG_QOS(15) | CFG_FLPDCACHE | CFG_ACGEN;
__raw_writel(cfg, data->sfrbase + REG_MMU_CFG);
- data->version = ver;
}
static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data)