ARM: uniphier: factor out outer cache sync as a helper function
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Sun, 17 Jan 2016 01:13:17 +0000 (10:13 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Tue, 19 Jan 2016 23:39:52 +0000 (08:39 +0900)
Avoid repeating the same code.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
arch/arm/mach-uniphier/cache_uniphier.c

index 4a79966659ce6d855cddd4f6038a442e29d9daff..6c773161ba41be29a52aec44a8d52f05051e11cb 100644 (file)
 #include "ssc-regs.h"
 
 #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)
 {
        /* try until the command is successfully set */
@@ -25,8 +31,7 @@ static void uniphier_cache_maint_all(u32 operation)
        /* clear the complete notification flag */
        writel(SSCOLPQS_EF, SSCOLPQS);
 
-       writel(SSCOPE_CM_SYNC, SSCOPE); /* drain internal buffers */
-       readl(SSCOPE); /* need a read back to confirm */
+       uniphier_cache_sync();
 }
 
 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;
        }
 
-       writel(SSCOPE_CM_SYNC, SSCOPE); /* drain internal buffers */
-       readl(SSCOPE); /* need a read back to confirm */
+       uniphier_cache_sync();
 }
 
 void v7_outer_cache_flush_range(u32 start, u32 end)