Commit e1aa1dfe authored by Jiaxun Yang's avatar Jiaxun Yang Committed by Thomas Bogendoerfer

MIPS: mips-cm: Check availability of config registers

Prevent reading unsupported config register during probing process.
Signed-off-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent aa45787c
...@@ -181,11 +181,16 @@ static DEFINE_PER_CPU_ALIGNED(unsigned long, cm_core_lock_flags); ...@@ -181,11 +181,16 @@ static DEFINE_PER_CPU_ALIGNED(unsigned long, cm_core_lock_flags);
phys_addr_t __mips_cm_phys_base(void) phys_addr_t __mips_cm_phys_base(void)
{ {
u32 config3 = read_c0_config3();
unsigned long cmgcr; unsigned long cmgcr;
/* Check the CMGCRBase register is implemented */ /* Check the CMGCRBase register is implemented */
if (!(config3 & MIPS_CONF3_CMGCR)) if (!(read_c0_config() & MIPS_CONF_M))
return 0;
if (!(read_c0_config2() & MIPS_CONF_M))
return 0;
if (!(read_c0_config3() & MIPS_CONF3_CMGCR))
return 0; return 0;
/* Read the address from CMGCRBase */ /* Read the address from CMGCRBase */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment