1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
4 #ifndef __ASM_CSKY_CKMMUV1_H
5 #define __ASM_CSKY_CKMMUV1_H
6 #include <abi/reg_ops.h>
8 static inline int read_mmu_index(void)
10 return cprcr("cpcr0");
13 static inline void write_mmu_index(int value
)
15 cpwcr("cpcr0", value
);
18 static inline int read_mmu_entrylo0(void)
20 return cprcr("cpcr2") << 6;
23 static inline int read_mmu_entrylo1(void)
25 return cprcr("cpcr3") << 6;
28 static inline void write_mmu_pagemask(int value
)
30 cpwcr("cpcr6", value
);
33 static inline int read_mmu_entryhi(void)
35 return cprcr("cpcr4");
38 static inline void write_mmu_entryhi(int value
)
40 cpwcr("cpcr4", value
);
43 static inline unsigned long read_mmu_msa0(void)
45 return cprcr("cpcr30");
48 static inline void write_mmu_msa0(unsigned long value
)
50 cpwcr("cpcr30", value
);
53 static inline unsigned long read_mmu_msa1(void)
55 return cprcr("cpcr31");
58 static inline void write_mmu_msa1(unsigned long value
)
60 cpwcr("cpcr31", value
);
66 static inline void tlb_probe(void)
68 cpwcr("cpcr8", 0x80000000);
71 static inline void tlb_read(void)
73 cpwcr("cpcr8", 0x40000000);
76 static inline void tlb_invalid_all(void)
78 cpwcr("cpcr8", 0x04000000);
82 static inline void local_tlb_invalid_all(void)
87 static inline void tlb_invalid_indexed(void)
89 cpwcr("cpcr8", 0x02000000);
92 static inline void setup_pgd(unsigned long pgd
, bool kernel
)
94 cpwcr("cpcr29", pgd
| BIT(0));
97 static inline unsigned long get_pgd(void)
99 return cprcr("cpcr29") & ~BIT(0);
101 #endif /* __ASM_CSKY_CKMMUV1_H */