Skip to content

Commit b02efeb

Browse files
XBurstpaulburton
authored andcommitted
MIPS: Ingenic: Disable abandoned HPTLB function.
JZ4760/JZ4770/JZ4775/X1000/X1500 has an abandoned huge page tlb, this mode is not compatible with the MIPS standard, it will cause tlbmiss and into an infinite loop (line 21 in the tlb-funcs.S) when starting the init process. write 0xa9000000 to cp0 register 5 sel 4 to disable this function to prevent getting stuck. Confirmed by Ingenic, this operation will not adversely affect processors without HPTLB function. Signed-off-by: Zhou Yanjie <[email protected]> Acked-by: Paul Cercueil <[email protected]> Signed-off-by: Paul Burton <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected]
1 parent 37640ad commit b02efeb

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

arch/mips/include/asm/mipsregs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,9 @@
689689
#define MIPS_CONF7_IAR (_ULCAST_(1) << 10)
690690
#define MIPS_CONF7_AR (_ULCAST_(1) << 16)
691691

692+
/* Ingenic HPTLB off bits */
693+
#define XBURST_PAGECTRL_HPTLB_DIS 0xa9000000
694+
692695
/* Ingenic Config7 bits */
693696
#define MIPS_CONF7_BTB_LOOP_EN (_ULCAST_(1) << 4)
694697

@@ -1971,6 +1974,9 @@ do { \
19711974
#define read_c0_brcm_sleepcount() __read_32bit_c0_register($22, 7)
19721975
#define write_c0_brcm_sleepcount(val) __write_32bit_c0_register($22, 7, val)
19731976

1977+
/* Ingenic page ctrl register */
1978+
#define write_c0_page_ctrl(val) __write_32bit_c0_register($5, 4, val)
1979+
19741980
/*
19751981
* Macros to access the guest system control coprocessor
19761982
*/

arch/mips/kernel/cpu-probe.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,13 +1977,30 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
19771977
break;
19781978
}
19791979

1980+
switch (c->processor_id & PRID_COMP_MASK) {
1981+
/*
1982+
* The config0 register in the XBurst CPUs with a processor ID of
1983+
* PRID_COMP_INGENIC_D1 has an abandoned huge page tlb mode, this
1984+
* mode is not compatible with the MIPS standard, it will cause
1985+
* tlbmiss and into an infinite loop (line 21 in the tlb-funcs.S)
1986+
* when starting the init process. After chip reset, the default
1987+
* is HPTLB mode, Write 0xa9000000 to cp0 register 5 sel 4 to
1988+
* switch back to VTLB mode to prevent getting stuck.
1989+
*/
1990+
case PRID_COMP_INGENIC_D1:
1991+
write_c0_page_ctrl(XBURST_PAGECTRL_HPTLB_DIS);
1992+
break;
19801993
/*
1981-
* The config0 register in the Xburst CPUs with a processor ID of
1994+
* The config0 register in the XBurst CPUs with a processor ID of
19821995
* PRID_COMP_INGENIC_D0 report themselves as MIPS32r2 compatible,
19831996
* but they don't actually support this ISA.
19841997
*/
1985-
if ((c->processor_id & PRID_COMP_MASK) == PRID_COMP_INGENIC_D0)
1998+
case PRID_COMP_INGENIC_D0:
19861999
c->isa_level &= ~MIPS_CPU_ISA_M32R2;
2000+
break;
2001+
default:
2002+
break;
2003+
}
19872004
}
19882005

19892006
static inline void cpu_probe_netlogic(struct cpuinfo_mips *c, int cpu)

0 commit comments

Comments
 (0)