]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: cache: add dt support for tauros2 cache
authorChao Xie <xiechao.mail@gmail.com>
Tue, 31 Jul 2012 06:13:14 +0000 (14:13 +0800)
committerHaojian Zhuang <haojian.zhuang@gmail.com>
Thu, 16 Aug 2012 08:16:50 +0000 (16:16 +0800)
Signed-off-by: Chao Xie <xiechao.mail@gmail.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Documentation/devicetree/bindings/arm/mrvl/tauros2.txt [new file with mode: 0644]
arch/arm/mm/cache-tauros2.c

diff --git a/Documentation/devicetree/bindings/arm/mrvl/tauros2.txt b/Documentation/devicetree/bindings/arm/mrvl/tauros2.txt
new file mode 100644 (file)
index 0000000..31af1cb
--- /dev/null
@@ -0,0 +1,17 @@
+* Marvell Tauros2 Cache
+
+Required properties:
+- compatible : Should be "marvell,tauros2-cache".
+- marvell,tauros2-cache-features : Specify the features supported for the
+  tauros2 cache.
+  The features including
+    CACHE_TAUROS2_PREFETCH_ON       (1 << 0)
+    CACHE_TAUROS2_LINEFILL_BURST8   (1 << 1)
+  The definition can be found at
+  arch/arm/include/asm/hardware/cache-tauros2.h
+
+Example:
+       L2: l2-cache {
+               compatible = "marvell,tauros2-cache";
+               marvell,tauros2-cache-features = <0x3>;
+       };
index e9f054fc7e870cf060623d79c077cbfb5ee423be..1be0f4e5e6eb7067b871d32d5eeb7af47954c42e 100644 (file)
@@ -15,6 +15,8 @@
  */
 
 #include <linux/init.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
 #include <asm/cacheflush.h>
 #include <asm/cp15.h>
 #include <asm/cputype.h>
@@ -198,7 +200,7 @@ static void enable_extra_feature(unsigned int features)
        write_extra_features(u);
 }
 
-void __init tauros2_init(unsigned int features)
+static void __init tauros2_internal_init(unsigned int features)
 {
        char *mode = NULL;
 
@@ -294,3 +296,34 @@ void __init tauros2_init(unsigned int features)
        printk(KERN_INFO "Tauros2: L2 cache support initialised "
                         "in %s mode.\n", mode);
 }
+
+#ifdef CONFIG_OF
+static const struct of_device_id tauros2_ids[] __initconst = {
+       { .compatible = "marvell,tauros2-cache"},
+       {}
+};
+#endif
+
+void __init tauros2_init(unsigned int features)
+{
+#ifdef CONFIG_OF
+       struct device_node *node;
+       int ret;
+       unsigned int f;
+
+       node = of_find_matching_node(NULL, tauros2_ids);
+       if (!node) {
+               pr_info("Not found marvell,tauros2-cache, disable it\n");
+               return;
+       }
+
+       ret = of_property_read_u32(node, "marvell,tauros2-cache-features", &f);
+       if (ret) {
+               pr_info("Not found marvell,tauros-cache-features property, "
+                       "disable extra features\n");
+               features = 0;
+       } else
+               features = f;
+#endif
+       tauros2_internal_init(features);
+}