ARM: tegra: flush caches via SMC call
authorStephen Warren <swarren@nvidia.com>
Fri, 23 Sep 2016 23:43:49 +0000 (17:43 -0600)
committerTom Warren <twarren@nvidia.com>
Tue, 27 Sep 2016 16:11:03 +0000 (09:11 -0700)
On Tegra186, it is necessary to perform an SMC to fully flush all caches;
flushing/cleaning by set/way is not enough. Implement the required hook
to make this happen.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
arch/arm/mach-tegra/tegra186/Makefile
arch/arm/mach-tegra/tegra186/cache.c [new file with mode: 0644]

index 033d6005fb44f25252133e20c7ad32b9dc26bcf7..7f46a057bca1bd4cfc3978b2c558753d6771392e 100644 (file)
@@ -3,5 +3,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-y += ../board186.o
+obj-y += cache.o
 obj-y += nvtboot_ll.o
 obj-y += nvtboot_mem.o
diff --git a/arch/arm/mach-tegra/tegra186/cache.c b/arch/arm/mach-tegra/tegra186/cache.c
new file mode 100644 (file)
index 0000000..adaed89
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2016, NVIDIA CORPORATION.
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include <common.h>
+#include <asm/system.h>
+
+#define SMC_SIP_INVOKE_MCE     0x82FFFF00
+#define MCE_SMC_ROC_FLUSH_CACHE        11
+
+int __asm_flush_l3_cache(void)
+{
+       struct pt_regs regs = {0};
+
+       isb();
+
+       regs.regs[0] = SMC_SIP_INVOKE_MCE | MCE_SMC_ROC_FLUSH_CACHE;
+       smc_call(&regs);
+
+       return 0;
+}