Skip to content

Commit

Permalink
iommu/exynos: Refactor init config code
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marek Szyprowski authored and Joerg Roedel committed Feb 25, 2016
1 parent d093fc7 commit 83addec
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions drivers/iommu/exynos-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 83addec

Please sign in to comment.