summaryrefslogtreecommitdiff
path: root/arch/powerpc/cpu/mpc8xx/cache.c
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@c-s.fr>2017-07-13 13:10:00 (GMT)
committerTom Rini <trini@konsulko.com>2017-07-23 02:22:50 (GMT)
commit1e7cefef585c972ed40e016ba8739f5c5091254b (patch)
treee9323035b7cba5f696db3c99f2faae3a05749280 /arch/powerpc/cpu/mpc8xx/cache.c
parent36d3260756ec6277acf474e1c407fdd9a104f9cb (diff)
downloadu-boot-1e7cefef585c972ed40e016ba8739f5c5091254b.tar.xz
powerpc, 8xx: Move cache function into C files
Avoid unnecessary assembly functions when they can easily be written in C. Also remove dc_read() as it is nowhere referenced Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Diffstat (limited to 'arch/powerpc/cpu/mpc8xx/cache.c')
-rw-r--r--arch/powerpc/cpu/mpc8xx/cache.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/powerpc/cpu/mpc8xx/cache.c b/arch/powerpc/cpu/mpc8xx/cache.c
new file mode 100644
index 0000000..f8cd5f5
--- /dev/null
+++ b/arch/powerpc/cpu/mpc8xx/cache.c
@@ -0,0 +1,49 @@
+/*
+ * (C) Copyright 2017
+ * Christophe Leroy, CS Systemes d'Information, christophe.leroy@c-s.fr
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/processor.h>
+#include <asm/ppc.h>
+#include <asm/io.h>
+#include <asm/mmu.h>
+
+int icache_status(void)
+{
+ return !!(mfspr(IC_CST) & IDC_ENABLED);
+}
+
+void icache_enable(void)
+{
+ sync();
+ mtspr(IC_CST, IDC_INVALL);
+ mtspr(IC_CST, IDC_ENABLE);
+}
+
+void icache_disable(void)
+{
+ sync();
+ mtspr(IC_CST, IDC_DISABLE);
+}
+
+int dcache_status(void)
+{
+ return !!(mfspr(IC_CST) & IDC_ENABLED);
+}
+
+void dcache_enable(void)
+{
+ mtspr(MD_CTR, MD_RESETVAL); /* Set cache mode with MMU off */
+ mtspr(DC_CST, IDC_INVALL);
+ mtspr(DC_CST, IDC_ENABLE);
+}
+
+void dcache_disable(void)
+{
+ sync();
+ mtspr(DC_CST, IDC_DISABLE);
+ mtspr(DC_CST, IDC_INVALL);
+}