diff options
Diffstat (limited to 'arch/mips/netlogic/common/reset.S')
-rw-r--r-- | arch/mips/netlogic/common/reset.S | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/arch/mips/netlogic/common/reset.S b/arch/mips/netlogic/common/reset.S index adb18288a6c0..b231fe1e7a09 100644 --- a/arch/mips/netlogic/common/reset.S +++ b/arch/mips/netlogic/common/reset.S | |||
@@ -32,10 +32,10 @@ | |||
32 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <linux/init.h> | ||
36 | 35 | ||
37 | #include <asm/asm.h> | 36 | #include <asm/asm.h> |
38 | #include <asm/asm-offsets.h> | 37 | #include <asm/asm-offsets.h> |
38 | #include <asm/cacheops.h> | ||
39 | #include <asm/regdef.h> | 39 | #include <asm/regdef.h> |
40 | #include <asm/mipsregs.h> | 40 | #include <asm/mipsregs.h> |
41 | #include <asm/stackframe.h> | 41 | #include <asm/stackframe.h> |
@@ -50,8 +50,8 @@ | |||
50 | #include <asm/netlogic/xlp-hal/cpucontrol.h> | 50 | #include <asm/netlogic/xlp-hal/cpucontrol.h> |
51 | 51 | ||
52 | #define CP0_EBASE $15 | 52 | #define CP0_EBASE $15 |
53 | #define SYS_CPU_COHERENT_BASE(node) CKSEG1ADDR(XLP_DEFAULT_IO_BASE) + \ | 53 | #define SYS_CPU_COHERENT_BASE CKSEG1ADDR(XLP_DEFAULT_IO_BASE) + \ |
54 | XLP_IO_SYS_OFFSET(node) + XLP_IO_PCI_HDRSZ + \ | 54 | XLP_IO_SYS_OFFSET(0) + XLP_IO_PCI_HDRSZ + \ |
55 | SYS_CPU_NONCOHERENT_MODE * 4 | 55 | SYS_CPU_NONCOHERENT_MODE * 4 |
56 | 56 | ||
57 | /* Enable XLP features and workarounds in the LSU */ | 57 | /* Enable XLP features and workarounds in the LSU */ |
@@ -74,35 +74,55 @@ | |||
74 | .endm | 74 | .endm |
75 | 75 | ||
76 | /* | 76 | /* |
77 | * Low level flush for L1D cache on XLP, the normal cache ops does | 77 | * L1D cache has to be flushed before enabling threads in XLP. |
78 | * not do the complete and correct cache flush. | 78 | * On XLP8xx/XLP3xx, we do a low level flush using processor control |
79 | * registers. On XLPII CPUs, usual cache instructions work. | ||
79 | */ | 80 | */ |
80 | .macro xlp_flush_l1_dcache | 81 | .macro xlp_flush_l1_dcache |
82 | mfc0 t0, CP0_EBASE, 0 | ||
83 | andi t0, t0, 0xff00 | ||
84 | slt t1, t0, 0x1200 | ||
85 | beqz t1, 15f | ||
86 | nop | ||
87 | |||
88 | /* XLP8xx low level cache flush */ | ||
81 | li t0, LSU_DEBUG_DATA0 | 89 | li t0, LSU_DEBUG_DATA0 |
82 | li t1, LSU_DEBUG_ADDR | 90 | li t1, LSU_DEBUG_ADDR |
83 | li t2, 0 /* index */ | 91 | li t2, 0 /* index */ |
84 | li t3, 0x1000 /* loop count */ | 92 | li t3, 0x1000 /* loop count */ |
85 | 1: | 93 | 11: |
86 | sll v0, t2, 5 | 94 | sll v0, t2, 5 |
87 | mtcr zero, t0 | 95 | mtcr zero, t0 |
88 | ori v1, v0, 0x3 /* way0 | write_enable | write_active */ | 96 | ori v1, v0, 0x3 /* way0 | write_enable | write_active */ |
89 | mtcr v1, t1 | 97 | mtcr v1, t1 |
90 | 2: | 98 | 12: |
91 | mfcr v1, t1 | 99 | mfcr v1, t1 |
92 | andi v1, 0x1 /* wait for write_active == 0 */ | 100 | andi v1, 0x1 /* wait for write_active == 0 */ |
93 | bnez v1, 2b | 101 | bnez v1, 12b |
94 | nop | 102 | nop |
95 | mtcr zero, t0 | 103 | mtcr zero, t0 |
96 | ori v1, v0, 0x7 /* way1 | write_enable | write_active */ | 104 | ori v1, v0, 0x7 /* way1 | write_enable | write_active */ |
97 | mtcr v1, t1 | 105 | mtcr v1, t1 |
98 | 3: | 106 | 13: |
99 | mfcr v1, t1 | 107 | mfcr v1, t1 |
100 | andi v1, 0x1 /* wait for write_active == 0 */ | 108 | andi v1, 0x1 /* wait for write_active == 0 */ |
101 | bnez v1, 3b | 109 | bnez v1, 13b |
102 | nop | 110 | nop |
103 | addi t2, 1 | 111 | addi t2, 1 |
104 | bne t3, t2, 1b | 112 | bne t3, t2, 11b |
113 | nop | ||
114 | b 17f | ||
115 | nop | ||
116 | |||
117 | /* XLPII CPUs, Invalidate all 64k of L1 D-cache */ | ||
118 | 15: | ||
119 | li t0, 0x80000000 | ||
120 | li t1, 0x80010000 | ||
121 | 16: cache Index_Writeback_Inv_D, 0(t0) | ||
122 | addiu t0, t0, 32 | ||
123 | bne t0, t1, 16b | ||
105 | nop | 124 | nop |
125 | 17: | ||
106 | .endm | 126 | .endm |
107 | 127 | ||
108 | /* | 128 | /* |
@@ -138,6 +158,13 @@ FEXPORT(nlm_reset_entry) | |||
138 | nop | 158 | nop |
139 | 159 | ||
140 | 1: /* Entry point on core wakeup */ | 160 | 1: /* Entry point on core wakeup */ |
161 | mfc0 t0, CP0_EBASE, 0 /* processor ID */ | ||
162 | andi t0, 0xff00 | ||
163 | li t1, 0x1500 /* XLP 9xx */ | ||
164 | beq t0, t1, 2f /* does not need to set coherent */ | ||
165 | nop | ||
166 | |||
167 | /* set bit in SYS coherent register for the core */ | ||
141 | mfc0 t0, CP0_EBASE, 1 | 168 | mfc0 t0, CP0_EBASE, 1 |
142 | mfc0 t1, CP0_EBASE, 1 | 169 | mfc0 t1, CP0_EBASE, 1 |
143 | srl t1, 5 | 170 | srl t1, 5 |
@@ -149,7 +176,7 @@ FEXPORT(nlm_reset_entry) | |||
149 | li t1, 0x1 | 176 | li t1, 0x1 |
150 | sll t0, t1, t0 | 177 | sll t0, t1, t0 |
151 | nor t0, t0, zero /* t0 <- ~(1 << core) */ | 178 | nor t0, t0, zero /* t0 <- ~(1 << core) */ |
152 | li t2, SYS_CPU_COHERENT_BASE(0) | 179 | li t2, SYS_CPU_COHERENT_BASE |
153 | add t2, t2, t3 /* t2 <- SYS offset for node */ | 180 | add t2, t2, t3 /* t2 <- SYS offset for node */ |
154 | lw t1, 0(t2) | 181 | lw t1, 0(t2) |
155 | and t1, t1, t0 | 182 | and t1, t1, t0 |
@@ -159,13 +186,13 @@ FEXPORT(nlm_reset_entry) | |||
159 | lw t1, 0(t2) | 186 | lw t1, 0(t2) |
160 | sync | 187 | sync |
161 | 188 | ||
189 | 2: | ||
162 | /* Configure LSU on Non-0 Cores. */ | 190 | /* Configure LSU on Non-0 Cores. */ |
163 | xlp_config_lsu | 191 | xlp_config_lsu |
164 | /* FALL THROUGH */ | 192 | /* FALL THROUGH */ |
165 | 193 | ||
166 | /* | 194 | /* |
167 | * Wake up sibling threads from the initial thread in | 195 | * Wake up sibling threads from the initial thread in a core. |
168 | * a core. | ||
169 | */ | 196 | */ |
170 | EXPORT(nlm_boot_siblings) | 197 | EXPORT(nlm_boot_siblings) |
171 | /* core L1D flush before enable threads */ | 198 | /* core L1D flush before enable threads */ |
@@ -181,8 +208,10 @@ EXPORT(nlm_boot_siblings) | |||
181 | /* | 208 | /* |
182 | * The new hardware thread starts at the next instruction | 209 | * The new hardware thread starts at the next instruction |
183 | * For all the cases other than core 0 thread 0, we will | 210 | * For all the cases other than core 0 thread 0, we will |
184 | * jump to the secondary wait function. | 211 | * jump to the secondary wait function. |
185 | */ | 212 | |
213 | * NOTE: All GPR contents are lost after the mtcr above! | ||
214 | */ | ||
186 | mfc0 v0, CP0_EBASE, 1 | 215 | mfc0 v0, CP0_EBASE, 1 |
187 | andi v0, 0x3ff /* v0 <- node/core */ | 216 | andi v0, 0x3ff /* v0 <- node/core */ |
188 | 217 | ||
@@ -196,7 +225,7 @@ EXPORT(nlm_boot_siblings) | |||
196 | #endif | 225 | #endif |
197 | mtc0 t1, CP0_STATUS | 226 | mtc0 t1, CP0_STATUS |
198 | 227 | ||
199 | /* mark CPU ready, careful here, previous mtcr trashed registers */ | 228 | /* mark CPU ready */ |
200 | li t3, CKSEG1ADDR(RESET_DATA_PHYS) | 229 | li t3, CKSEG1ADDR(RESET_DATA_PHYS) |
201 | ADDIU t1, t3, BOOT_CPU_READY | 230 | ADDIU t1, t3, BOOT_CPU_READY |
202 | sll v1, v0, 2 | 231 | sll v1, v0, 2 |