2 * linux/arch/unicore32/mm/proc-ucv2.S
4 * Code specific to PKUnity SoC and UniCore ISA
6 * Copyright (C) 2001-2010 GUAN Xue-tao
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #include <linux/init.h>
13 #include <linux/linkage.h>
14 #include <asm/assembler.h>
15 #include <asm/hwcap.h>
16 #include <asm/pgtable-hwdef.h>
17 #include <asm/pgtable.h>
19 #include "proc-macros.S"
23 mov ip, #PSR_R_BIT | PSR_I_BIT | PRIV_MODE
25 b.l __cpuc_flush_kern_all
31 * Perform a soft reset of the system. Put the CPU into the
32 * same state as it would be if it had been reset, and branch
33 * to what would be the reset vector.
35 * - loc - location to jump to for soft reset
40 movc p0.c5, ip, #28 @ Cache invalidate all
43 movc p0.c6, ip, #6 @ TLB invalidate all
46 movc ip, p0.c1, #0 @ ctrl register
47 or ip, ip, #0x2000 @ vector base address
48 andn ip, ip, #0x000f @ ............idam
49 movc p0.c1, ip, #0 @ disable caches and mmu
51 mov pc, r0 @ jump to loc
57 * Idle the processor (eg, wait for interrupt).
59 * IRQs are already disabled.
62 mov r0, #0 @ PCI address
68 ENTRY(cpu_dcache_clean_area)
69 #ifndef CONFIG_CPU_DCACHE_LINE_DISABLE
70 csub.a r1, #MAX_AREA_SIZE
73 sub r9, r9, #1 @ PAGE_MASK
74 1: va2pa r0, r10, r11, r12, r13 @ r10 is PA
78 3: movc p0.c5, r10, #11 @ clean D entry
80 add r0, r0, #CACHE_LINESIZE
81 add r10, r10, #CACHE_LINESIZE
82 sub.a r1, r1, #CACHE_LINESIZE
87 movc p0.c5, ip, #10 @ Dcache clean all
93 * cpu_do_switch_mm(pgd_phys)
95 * Set the translation table base pointer to be pgd_phys
97 * - pgd_phys - physical address of new pgd
100 * - we are not using split page tables
103 ENTRY(cpu_do_switch_mm)
104 movc p0.c2, r0, #0 @ update page table ptr
107 movc p0.c6, ip, #6 @ TLB invalidate all
113 * cpu_set_pte(ptep, pte)
115 * Set a level 2 translation table entry.
117 * - ptep - pointer to level 2 translation table entry
118 * - pte - PTE value to store
123 #ifndef CONFIG_CPU_DCACHE_LINE_DISABLE
124 sub r2, r0, #PAGE_OFFSET
125 movc p0.c5, r2, #11 @ Dcache clean line
129 movc p0.c5, ip, #10 @ Dcache clean all
131 @dcacheline_flush r0, r2, ip