[U-Boot] [PATCH 1/4] ARC: read pae_exist bit from MMU BCR
Eugeniy Paltsev
Eugeniy.Paltsev at synopsys.com
Tue Jan 16 16:20:26 UTC 2018
ARC_AUX_SLC_RGN_START1 and ARC_AUX_SLC_RGN_END1 register exist
only if PAE exists in current HW. So we had to check pae_exist bit
before using them.
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev at synopsys.com>
---
arch/arc/include/asm/arcregs.h | 3 +++
arch/arc/lib/cache.c | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index ba1f7ba..53e83c7 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -65,6 +65,9 @@
#define ARC_AUX_SLC_FLDL 0x912
#define ARC_BCR_CLUSTER 0xcf
+/* MMU Management regs */
+#define ARC_AUX_MMU_BCR 0x06f
+
/* IO coherency related auxiliary registers */
#define ARC_AUX_IO_COH_ENABLE 0x500
#define ARC_AUX_IO_COH_PARTIAL 0x501
diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c
index 1073e15..0a41dc4 100644
--- a/arch/arc/lib/cache.c
+++ b/arch/arc/lib/cache.c
@@ -41,6 +41,32 @@ bool icache_exists __section(".data") = false;
int slc_line_sz __section(".data");
bool slc_exists __section(".data") = false;
bool ioc_exists __section(".data") = false;
+bool pae_exists __section(".data") = false;
+
+void read_decode_mmu_bcr(void)
+{
+ /* TODO: should we compare mmu version from BCR and from CONFIG? */
+#if (CONFIG_ARC_MMU_VER >= 4)
+ u32 tmp;
+
+ tmp = read_aux_reg(ARC_AUX_MMU_BCR);
+
+ struct bcr_mmu_4 {
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ unsigned int ver:8, sasid:1, sz1:4, sz0:4, res:2, pae:1,
+ n_ways:2, n_entry:2, n_super:2, u_itlb:3, u_dtlb:3;
+#else
+ /* DTLB ITLB JES JE JA */
+ unsigned int u_dtlb:3, u_itlb:3, n_super:2, n_entry:2, n_ways:2,
+ pae:1, res:2, sz0:4, sz1:4, sasid:1, ver:8;
+#endif /* CONFIG_CPU_BIG_ENDIAN */
+ } *mmu4;
+
+ mmu4 = (struct bcr_mmu_4 *)&tmp;
+
+ pae_exists = !!mmu4->pae;
+#endif /* (CONFIG_ARC_MMU_VER >= 4) */
+}
static unsigned int __before_slc_op(const int op)
{
@@ -244,6 +270,8 @@ void cache_init(void)
write_aux_reg(ARC_AUX_IO_COH_ENABLE, 1);
}
+
+ read_decode_mmu_bcr();
#endif
}
--
2.9.3
More information about the U-Boot
mailing list