static unsigned int __sysmmu_version(struct sysmmu_drvdata *drvdata, int idx, unsigned int *minor) { unsigned int major; major = readl(drvdata->sfrbases[idx] + REG_MMU_VERSION); if ((MMU_MAJ_VER(major) == 0) || (MMU_MAJ_VER(major) > 3)) { /* register MMU_VERSION is used for special purpose */ if (drvdata->ver.major == 0) { /* min ver. is not important for System MMU 1 and 2 */ major = 1; } else { if (minor) *minor = drvdata->ver.minor; major = drvdata->ver.major; } return major; } if (minor) *minor = MMU_MIN_VER(major); major = MMU_MAJ_VER(major); return major; }
static void __sysmmu_init_config(struct sysmmu_drvdata *data) { unsigned int cfg = CFG_LRU | CFG_QOS(15); unsigned int ver; ver = __raw_sysmmu_version(data); 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; } } } __raw_writel(cfg, data->sfrbase + REG_MMU_CFG); }