MIPS: Add platform callback before initializing the L2 cache
authorMarkos Chandras <markos.chandras@imgtec.com>
Thu, 9 Jul 2015 09:40:43 +0000 (10:40 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 26 Aug 2015 13:23:11 +0000 (15:23 +0200)
Allow platforms to perform platform-specific steps before configuring
the L2 cache. This is necessary for platforms with CM3 since the L2
parameters no longer live in the Config2 register.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/10642/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/mips-cm.c
arch/mips/mm/sc-mips.c
arch/mips/mti-malta/malta-init.c

index 85bbe9b9675972fd7f919b4b3774781410f8fbe4..42602f30949fe6428c643e18c8fd688c8132808d 100644 (file)
@@ -81,6 +81,13 @@ int mips_cm_probe(void)
        phys_addr_t addr;
        u32 base_reg;
 
+       /*
+        * No need to probe again if we have already been
+        * here before.
+        */
+       if (mips_cm_base)
+               return 0;
+
        addr = mips_cm_phys_base();
        BUG_ON((addr & CM_GCR_BASE_GCRBASE_MSK) != addr);
        if (!addr)
index 5fa452e8cff923bfa54807769e9f5a05800549d8..53ea8391f9bbf9c2ddf81a114e59f52d05ad7abf 100644 (file)
@@ -123,6 +123,10 @@ static int __init mips_sc_probe_cm3(void)
        return 1;
 }
 
+void __weak platform_early_l2_init(void)
+{
+}
+
 static inline int __init mips_sc_probe(void)
 {
        struct cpuinfo_mips *c = &current_cpu_data;
@@ -132,6 +136,12 @@ static inline int __init mips_sc_probe(void)
        /* Mark as not present until probe completed */
        c->scache.flags |= MIPS_CACHE_NOT_PRESENT;
 
+       /*
+        * Do we need some platform specific probing before
+        * we configure L2?
+        */
+       platform_early_l2_init();
+
        if (mips_cm_revision() >= CM_REV_CM3)
                return mips_sc_probe_cm3();
 
index cec3e187c48f4dcf6e176e14c7e85be1d1234b35..53c24784a2f7bd2e8c0ae719f1f07c9ad60dd52b 100644 (file)
@@ -303,3 +303,10 @@ mips_pci_controller:
        if (!register_vsmp_smp_ops())
                return;
 }
+
+void platform_early_l2_init(void)
+{
+       /* L2 configuration lives in the CM3 */
+       if (mips_cm_revision() >= CM_REV_CM3)
+               mips_cm_probe();
+}