summaryrefslogtreecommitdiffstats
path: root/arch/metag/mm/l2cache.c
diff options
context:
space:
mode:
authorJames Hogan <jhogan@kernel.org>2017-10-24 13:07:54 +0100
committerJames Hogan <jhogan@kernel.org>2018-02-22 11:07:21 +0000
commitbb6fb6dfcc17cddac11ac295861f7608194447a7 (patch)
tree47ee071a415546dd01adbf628f61acb80473d476 /arch/metag/mm/l2cache.c
parent91ab883eb21325ad80f3473633f794c78ac87f51 (diff)
downloadlinux-bb6fb6dfcc17cddac11ac295861f7608194447a7.tar.bz2
metag: Remove arch/metag/
The earliest Meta architecture port of Linux I have a record of was an import of a Meta port of Linux v2.4.1 in February 2004, which was worked on significantly over the next few years by Graham Whaley, Will Newton, Matt Fleming, myself and others. Eventually the port was merged into mainline in v3.9 in March 2013, not long after Imagination Technologies bought MIPS Technologies and shifted its CPU focus over to the MIPS architecture. As a result, though the port was maintained for a while, kept on life support for a while longer, and useful for testing a few specific drivers for which I don't have ready access to the equivalent MIPS hardware, it is now essentially dead with no users. It is also stuck using an out-of-tree toolchain based on GCC 4.2.4 which is no longer maintained, now struggles to build modern kernels due to toolchain bugs, and doesn't itself build with a modern GCC. The latest buildroot port is still using an old uClibc snapshot which is no longer served, and the latest uClibc doesn't build with GCC 4.2.4. So lets call it a day and drop the Meta architecture port from the kernel. RIP Meta. Signed-off-by: James Hogan <jhogan@kernel.org> Link: https://lkml.kernel.org/r/95906b76-6ce1-3f84-eaba-c29b4ae952eb@roeck-us.net Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Graham Whaley <graham.whaley@gmail.com> Cc: linux-metag@vger.kernel.org
Diffstat (limited to 'arch/metag/mm/l2cache.c')
-rw-r--r--arch/metag/mm/l2cache.c193
1 files changed, 0 insertions, 193 deletions
diff --git a/arch/metag/mm/l2cache.c b/arch/metag/mm/l2cache.c
deleted file mode 100644
index addffc58989c..000000000000
--- a/arch/metag/mm/l2cache.c
+++ /dev/null
@@ -1,193 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/delay.h>
-
-#include <asm/l2cache.h>
-#include <asm/metag_isa.h>
-
-/* If non-0, then initialise the L2 cache */
-static int l2cache_init = 1;
-/* If non-0, then initialise the L2 cache prefetch */
-static int l2cache_init_pf = 1;
-
-int l2c_pfenable;
-
-static volatile u32 l2c_testdata[16] __initdata __aligned(64);
-
-static int __init parse_l2cache(char *p)
-{
- char *cp = p;
-
- if (get_option(&cp, &l2cache_init) != 1) {
- pr_err("Bad l2cache parameter (%s)\n", p);
- return 1;
- }
- return 0;
-}
-early_param("l2cache", parse_l2cache);
-
-static int __init parse_l2cache_pf(char *p)
-{
- char *cp = p;
-
- if (get_option(&cp, &l2cache_init_pf) != 1) {
- pr_err("Bad l2cache_pf parameter (%s)\n", p);
- return 1;
- }
- return 0;
-}
-early_param("l2cache_pf", parse_l2cache_pf);
-
-static int __init meta_l2c_setup(void)
-{
- /*
- * If the L2 cache isn't even present, don't do anything, but say so in
- * the log.
- */
- if (!meta_l2c_is_present()) {
- pr_info("L2 Cache: Not present\n");
- return 0;
- }
-
- /*
- * Check whether the line size is recognised.
- */
- if (!meta_l2c_linesize()) {
- pr_warn_once("L2 Cache: unknown line size id (config=0x%08x)\n",
- meta_l2c_config());
- }
-
- /*
- * Initialise state.
- */
- l2c_pfenable = _meta_l2c_pf_is_enabled();
-
- /*
- * Enable the L2 cache and print to log whether it was already enabled
- * by the bootloader.
- */
- if (l2cache_init) {
- pr_info("L2 Cache: Enabling... ");
- if (meta_l2c_enable())
- pr_cont("already enabled\n");
- else
- pr_cont("done\n");
- } else {
- pr_info("L2 Cache: Not enabling\n");
- }
-
- /*
- * Enable L2 cache prefetch.
- */
- if (l2cache_init_pf) {
- pr_info("L2 Cache: Enabling prefetch... ");
- if (meta_l2c_pf_enable(1))
- pr_cont("already enabled\n");
- else
- pr_cont("done\n");
- } else {
- pr_info("L2 Cache: Not enabling prefetch\n");
- }
-
- return 0;
-}
-core_initcall(meta_l2c_setup);
-
-int meta_l2c_disable(void)
-{
- unsigned long flags;
- int en;
-
- if (!meta_l2c_is_present())
- return 1;
-
- /*
- * Prevent other threads writing during the writeback, otherwise the
- * writes will get "lost" when the L2 is disabled.
- */
- __global_lock2(flags);
- en = meta_l2c_is_enabled();
- if (likely(en)) {
- _meta_l2c_pf_enable(0);
- wr_fence();
- _meta_l2c_purge();
- _meta_l2c_enable(0);
- }
- __global_unlock2(flags);
-
- return !en;
-}
-
-int meta_l2c_enable(void)
-{
- unsigned long flags;
- int en;
-
- if (!meta_l2c_is_present())
- return 0;
-
- /*
- * Init (clearing the L2) can happen while the L2 is disabled, so other
- * threads are safe to continue executing, however we must not init the
- * cache if it's already enabled (dirty lines would be discarded), so
- * this operation should still be atomic with other threads.
- */
- __global_lock1(flags);
- en = meta_l2c_is_enabled();
- if (likely(!en)) {
- _meta_l2c_init();
- _meta_l2c_enable(1);
- _meta_l2c_pf_enable(l2c_pfenable);
- }
- __global_unlock1(flags);
-
- return en;
-}
-
-int meta_l2c_pf_enable(int pfenable)
-{
- unsigned long flags;
- int en = l2c_pfenable;
-
- if (!meta_l2c_is_present())
- return 0;
-
- /*
- * We read modify write the enable register, so this operation must be
- * atomic with other threads.
- */
- __global_lock1(flags);
- en = l2c_pfenable;
- l2c_pfenable = pfenable;
- if (meta_l2c_is_enabled())
- _meta_l2c_pf_enable(pfenable);
- __global_unlock1(flags);
-
- return en;
-}
-
-int meta_l2c_flush(void)
-{
- unsigned long flags;
- int en;
-
- /*
- * Prevent other threads writing during the writeback. This also
- * involves read modify writes.
- */
- __global_lock2(flags);
- en = meta_l2c_is_enabled();
- if (likely(en)) {
- _meta_l2c_pf_enable(0);
- wr_fence();
- _meta_l2c_purge();
- _meta_l2c_enable(0);
- _meta_l2c_init();
- _meta_l2c_enable(1);
- _meta_l2c_pf_enable(l2c_pfenable);
- }
- __global_unlock2(flags);
-
- return !en;
-}