summaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier/arm32
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-08-10 16:08:42 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2016-08-11 17:49:25 +0900
commit6f579db75411973200224307d6a84d82fc01bb96 (patch)
tree806be2070614ebb9218a4fadeaaf4ee891cf91ba /arch/arm/mach-uniphier/arm32
parentbcc51c1512a3deb6a9fdd37362c6dde32ad3da23 (diff)
ARM: uniphier: export uniphier_cache_enable/disable functions
The System Cache (outer cache) is used not only as L2 cache, but also as locked SRAM. The functions for turning on/off it is necessary whether the L2 cache is enabled or not. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier/arm32')
-rw-r--r--arch/arm/mach-uniphier/arm32/cache-uniphier.c34
-rw-r--r--arch/arm/mach-uniphier/arm32/cache-uniphier.h2
2 files changed, 26 insertions, 10 deletions
diff --git a/arch/arm/mach-uniphier/arm32/cache-uniphier.c b/arch/arm/mach-uniphier/arm32/cache-uniphier.c
index 66e9f6b9b7a..4bb7d951c0f 100644
--- a/arch/arm/mach-uniphier/arm32/cache-uniphier.c
+++ b/arch/arm/mach-uniphier/arm32/cache-uniphier.c
@@ -130,6 +130,28 @@ void uniphier_cache_touch_zero_range(u32 start, u32 end, u32 ways)
UNIPHIER_SSCOQM_CM_TOUCH_ZERO);
}
+static void uniphier_cache_endisable(int enable)
+{
+ u32 tmp;
+
+ tmp = readl(UNIPHIER_SSCC);
+ if (enable)
+ tmp |= UNIPHIER_SSCC_ON;
+ else
+ tmp &= ~UNIPHIER_SSCC_ON;
+ writel(tmp, UNIPHIER_SSCC);
+}
+
+void uniphier_cache_enable(void)
+{
+ uniphier_cache_endisable(1);
+}
+
+void uniphier_cache_disable(void)
+{
+ uniphier_cache_endisable(0);
+}
+
#ifdef CONFIG_UNIPHIER_L2CACHE_ON
void v7_outer_cache_flush_all(void)
{
@@ -176,21 +198,13 @@ void v7_outer_cache_inval_range(u32 start, u32 end)
void v7_outer_cache_enable(void)
{
- u32 tmp;
-
writel(U32_MAX, UNIPHIER_SSCLPDAWCR); /* activate all ways */
- tmp = readl(UNIPHIER_SSCC);
- tmp |= UNIPHIER_SSCC_ON;
- writel(tmp, UNIPHIER_SSCC);
+ uniphier_cache_enable();
}
void v7_outer_cache_disable(void)
{
- u32 tmp;
-
- tmp = readl(UNIPHIER_SSCC);
- tmp &= ~UNIPHIER_SSCC_ON;
- writel(tmp, UNIPHIER_SSCC);
+ uniphier_cache_disable();
}
#endif
diff --git a/arch/arm/mach-uniphier/arm32/cache-uniphier.h b/arch/arm/mach-uniphier/arm32/cache-uniphier.h
index f67f6ae7eb3..733cd80dc55 100644
--- a/arch/arm/mach-uniphier/arm32/cache-uniphier.h
+++ b/arch/arm/mach-uniphier/arm32/cache-uniphier.h
@@ -13,5 +13,7 @@
void uniphier_cache_prefetch_range(u32 start, u32 end, u32 ways);
void uniphier_cache_touch_range(u32 start, u32 end, u32 ways);
void uniphier_cache_touch_zero_range(u32 start, u32 end, u32 ways);
+void uniphier_cache_enable(void);
+void uniphier_cache_disable(void);
#endif /* __CACHE_UNIPHIER_H */