Skip to content

Commit c014d16

Browse files
Markos Chandrasralfbaechle
authored andcommitted
MIPS: Add platform callback before initializing the L2 cache
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>
1 parent 7d53e9c commit c014d16

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

arch/mips/kernel/mips-cm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ int mips_cm_probe(void)
8181
phys_addr_t addr;
8282
u32 base_reg;
8383

84+
/*
85+
* No need to probe again if we have already been
86+
* here before.
87+
*/
88+
if (mips_cm_base)
89+
return 0;
90+
8491
addr = mips_cm_phys_base();
8592
BUG_ON((addr & CM_GCR_BASE_GCRBASE_MSK) != addr);
8693
if (!addr)

arch/mips/mm/sc-mips.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ static int __init mips_sc_probe_cm3(void)
123123
return 1;
124124
}
125125

126+
void __weak platform_early_l2_init(void)
127+
{
128+
}
129+
126130
static inline int __init mips_sc_probe(void)
127131
{
128132
struct cpuinfo_mips *c = &current_cpu_data;
@@ -132,6 +136,12 @@ static inline int __init mips_sc_probe(void)
132136
/* Mark as not present until probe completed */
133137
c->scache.flags |= MIPS_CACHE_NOT_PRESENT;
134138

139+
/*
140+
* Do we need some platform specific probing before
141+
* we configure L2?
142+
*/
143+
platform_early_l2_init();
144+
135145
if (mips_cm_revision() >= CM_REV_CM3)
136146
return mips_sc_probe_cm3();
137147

arch/mips/mti-malta/malta-init.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,10 @@ void __init prom_init(void)
303303
if (!register_vsmp_smp_ops())
304304
return;
305305
}
306+
307+
void platform_early_l2_init(void)
308+
{
309+
/* L2 configuration lives in the CM3 */
310+
if (mips_cm_revision() >= CM_REV_CM3)
311+
mips_cm_probe();
312+
}

0 commit comments

Comments
 (0)