ARM: uniphier: factor out outer cache sync as a helper function

Avoid repeating the same code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2016-01-17 10:13:17 +09:00
parent cefca48ca7
commit 5407735935
1 changed files with 8 additions and 4 deletions

View File

@ -11,6 +11,12 @@
#include "ssc-regs.h" #include "ssc-regs.h"
#ifdef CONFIG_UNIPHIER_L2CACHE_ON #ifdef CONFIG_UNIPHIER_L2CACHE_ON
static void uniphier_cache_sync(void)
{
writel(SSCOPE_CM_SYNC, SSCOPE); /* drain internal buffers */
readl(SSCOPE); /* need a read back to confirm */
}
static void uniphier_cache_maint_all(u32 operation) static void uniphier_cache_maint_all(u32 operation)
{ {
/* try until the command is successfully set */ /* try until the command is successfully set */
@ -25,8 +31,7 @@ static void uniphier_cache_maint_all(u32 operation)
/* clear the complete notification flag */ /* clear the complete notification flag */
writel(SSCOLPQS_EF, SSCOLPQS); writel(SSCOLPQS_EF, SSCOLPQS);
writel(SSCOPE_CM_SYNC, SSCOPE); /* drain internal buffers */ uniphier_cache_sync();
readl(SSCOPE); /* need a read back to confirm */
} }
void v7_outer_cache_flush_all(void) void v7_outer_cache_flush_all(void)
@ -90,8 +95,7 @@ static void uniphier_cache_maint_range(u32 start, u32 end, u32 operation)
size -= chunk_size; size -= chunk_size;
} }
writel(SSCOPE_CM_SYNC, SSCOPE); /* drain internal buffers */ uniphier_cache_sync();
readl(SSCOPE); /* need a read back to confirm */
} }
void v7_outer_cache_flush_range(u32 start, u32 end) void v7_outer_cache_flush_range(u32 start, u32 end)