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>
This commit is contained in:
Marek Szyprowski 2016-02-18 15:12:54 +01:00 committed by Joerg Roedel
parent d093fc7e83
commit 83addecdb7
1 changed files with 8 additions and 15 deletions

View File

@ -383,24 +383,17 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data)
static void __sysmmu_init_config(struct sysmmu_drvdata *data) static void __sysmmu_init_config(struct sysmmu_drvdata *data)
{ {
unsigned int cfg = CFG_LRU | CFG_QOS(15); unsigned int cfg;
unsigned int ver;
ver = MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION)); data->version = MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION));
if (MMU_MAJ_VER(ver) == 3) { if (data->version <= MAKE_MMU_VER(3, 1))
if (MMU_MIN_VER(ver) >= 2) { cfg = CFG_LRU | CFG_QOS(15);
cfg |= CFG_FLPDCACHE; else if (data->version <= MAKE_MMU_VER(3, 2))
if (MMU_MIN_VER(ver) == 3) { cfg = CFG_LRU | CFG_QOS(15) | CFG_FLPDCACHE | CFG_SYSSEL;
cfg |= CFG_ACGEN; else
cfg &= ~CFG_LRU; cfg = CFG_QOS(15) | CFG_FLPDCACHE | CFG_ACGEN;
} else {
cfg |= CFG_SYSSEL;
}
}
}
__raw_writel(cfg, data->sfrbase + REG_MMU_CFG); __raw_writel(cfg, data->sfrbase + REG_MMU_CFG);
data->version = ver;
} }
static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data) static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data)