2 * linux/arch/arm/mm/proc-fa526.S: MMU functions for FA526
4 * Written by : Luke Lee
5 * Copyright (C) 2005 Faraday Corp.
6 * Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
14 * These are the low level assembler for performing cache and TLB
15 * functions on the fa526.
17 #include <linux/linkage.h>
18 #include <linux/init.h>
19 #include <asm/assembler.h>
20 #include <asm/hwcap.h>
21 #include <asm/pgtable-hwdef.h>
22 #include <asm/pgtable.h>
24 #include <asm/ptrace.h>
26 #include "proc-macros.S"
28 #define CACHE_DLINESIZE 16
32 * cpu_fa526_proc_init()
34 ENTRY(cpu_fa526_proc_init)
38 * cpu_fa526_proc_fin()
40 ENTRY(cpu_fa526_proc_fin)
41 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
42 bic r0, r0, #0x1000 @ ...i............
43 bic r0, r0, #0x000e @ ............wca.
44 mcr p15, 0, r0, c1, c0, 0 @ disable caches
50 * cpu_fa526_reset(loc)
52 * Perform a soft reset of the system. Put the CPU into the
53 * same state as it would be if it had been reset, and branch
54 * to what would be the reset vector.
56 * loc: location to jump to for soft reset
59 .pushsection .idmap.text, "ax"
60 ENTRY(cpu_fa526_reset)
61 /* TODO: Use CP8 if possible... */
63 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches
64 mcr p15, 0, ip, c7, c10, 4 @ drain WB
66 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
68 mrc p15, 0, ip, c1, c0, 0 @ ctrl register
69 bic ip, ip, #0x000f @ ............wcam
70 bic ip, ip, #0x1100 @ ...i...s........
71 bic ip, ip, #0x0800 @ BTB off
72 mcr p15, 0, ip, c1, c0, 0 @ ctrl register
76 ENDPROC(cpu_fa526_reset)
83 ENTRY(cpu_fa526_do_idle)
87 ENTRY(cpu_fa526_dcache_clean_area)
88 1: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
89 add r0, r0, #CACHE_DLINESIZE
90 subs r1, r1, #CACHE_DLINESIZE
92 mcr p15, 0, r0, c7, c10, 4 @ drain WB
95 /* =============================== PageTable ============================== */
98 * cpu_fa526_switch_mm(pgd)
100 * Set the translation base pointer to be as described by pgd.
102 * pgd: new page tables
105 ENTRY(cpu_fa526_switch_mm)
108 #ifdef CONFIG_CPU_DCACHE_WRITETHROUGH
109 mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache
111 mcr p15, 0, ip, c7, c14, 0 @ clean and invalidate whole D cache
113 mcr p15, 0, ip, c7, c5, 0 @ invalidate I cache
114 mcr p15, 0, ip, c7, c5, 6 @ invalidate BTB since mm changed
115 mcr p15, 0, ip, c7, c10, 4 @ data write barrier
116 mcr p15, 0, ip, c7, c5, 4 @ prefetch flush
117 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
118 mcr p15, 0, ip, c8, c7, 0 @ invalidate UTLB
123 * cpu_fa526_set_pte_ext(ptep, pte, ext)
125 * Set a PTE and flush it out
128 ENTRY(cpu_fa526_set_pte_ext)
132 mcr p15, 0, r0, c7, c10, 1 @ clean D entry
134 mcr p15, 0, r0, c7, c10, 4 @ drain WB
138 .type __fa526_setup, #function
140 /* On return of this routine, r0 must carry correct flags for CFG register */
142 mcr p15, 0, r0, c7, c7 @ invalidate I,D caches on v4
143 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer on v4
145 mcr p15, 0, r0, c8, c7 @ invalidate I,D TLBs on v4
147 mcr p15, 0, r0, c7, c5, 5 @ invalidate IScratchpad RAM
150 mcr p15, 0, r0, c1, c1, 0 @ turn-on ECR
153 mcr p15, 0, r0, c7, c5, 6 @ invalidate BTB All
154 mcr p15, 0, r0, c7, c10, 4 @ data write barrier
155 mcr p15, 0, r0, c7, c5, 4 @ prefetch flush
157 mov r0, #0x1f @ Domains 0, 1 = manager, 2 = client
158 mcr p15, 0, r0, c3, c0 @ load domain access register
160 mrc p15, 0, r0, c1, c0 @ get control register v4
161 ldr r5, fa526_cr1_clear
163 ldr r5, fa526_cr1_set
166 .size __fa526_setup, . - __fa526_setup
169 * .RVI ZFRS BLDP WCAM
170 * ..11 1001 .111 1101
173 .type fa526_cr1_clear, #object
174 .type fa526_cr1_set, #object
182 @ define struct processor (see <asm/proc-fns.h> and proc-macros.S)
183 define_processor_functions fa526, dabort=v4_early_abort, pabort=legacy_pabort
187 string cpu_arch_name, "armv4"
188 string cpu_elf_name, "v4"
189 string cpu_fa526_name, "FA526"
193 .section ".proc.info.init", #alloc, #execinstr
195 .type __fa526_proc_info,#object
199 .long PMD_TYPE_SECT | \
200 PMD_SECT_BUFFERABLE | \
201 PMD_SECT_CACHEABLE | \
203 PMD_SECT_AP_WRITE | \
205 .long PMD_TYPE_SECT | \
207 PMD_SECT_AP_WRITE | \
212 .long HWCAP_SWP | HWCAP_HALF
214 .long fa526_processor_functions
218 .size __fa526_proc_info, . - __fa526_proc_info