| .. | .. |
|---|
| 2 | 2 | // Copyright (C) 2005-2017 Andes Technology Corporation |
|---|
| 3 | 3 | |
|---|
| 4 | 4 | #include <linux/cpu.h> |
|---|
| 5 | | -#include <linux/bootmem.h> |
|---|
| 6 | | -#include <linux/seq_file.h> |
|---|
| 7 | 5 | #include <linux/memblock.h> |
|---|
| 6 | +#include <linux/seq_file.h> |
|---|
| 8 | 7 | #include <linux/console.h> |
|---|
| 9 | 8 | #include <linux/screen_info.h> |
|---|
| 10 | 9 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 16 | 15 | #include <asm/proc-fns.h> |
|---|
| 17 | 16 | #include <asm/cache_info.h> |
|---|
| 18 | 17 | #include <asm/elf.h> |
|---|
| 18 | +#include <asm/fpu.h> |
|---|
| 19 | 19 | #include <nds32_intrinsic.h> |
|---|
| 20 | 20 | |
|---|
| 21 | 21 | #define HWCAP_MFUSR_PC 0x000001 |
|---|
| .. | .. |
|---|
| 39 | 39 | #define HWCAP_FPU_DP 0x040000 |
|---|
| 40 | 40 | #define HWCAP_V2 0x080000 |
|---|
| 41 | 41 | #define HWCAP_DX_REGS 0x100000 |
|---|
| 42 | +#define HWCAP_HWPRE 0x200000 |
|---|
| 42 | 43 | |
|---|
| 43 | 44 | unsigned long cpu_id, cpu_rev, cpu_cfgid; |
|---|
| 45 | +bool has_fpu = false; |
|---|
| 44 | 46 | char cpu_series; |
|---|
| 45 | 47 | char *endianness = NULL; |
|---|
| 46 | 48 | |
|---|
| .. | .. |
|---|
| 74 | 76 | "fpu_dp", |
|---|
| 75 | 77 | "v2", |
|---|
| 76 | 78 | "dx_regs", |
|---|
| 79 | + "hw_pre", |
|---|
| 77 | 80 | NULL, |
|---|
| 78 | 81 | }; |
|---|
| 79 | 82 | |
|---|
| .. | .. |
|---|
| 138 | 141 | (aliasing_num - 1) << PAGE_SHIFT; |
|---|
| 139 | 142 | } |
|---|
| 140 | 143 | #endif |
|---|
| 144 | +#ifdef CONFIG_FPU |
|---|
| 145 | + /* Disable fpu and enable when it is used. */ |
|---|
| 146 | + if (has_fpu) |
|---|
| 147 | + disable_fpu(); |
|---|
| 148 | +#endif |
|---|
| 141 | 149 | } |
|---|
| 142 | 150 | |
|---|
| 143 | 151 | static void __init setup_cpuinfo(void) |
|---|
| .. | .. |
|---|
| 182 | 190 | if (cpu_cfgid & 0x0004) |
|---|
| 183 | 191 | elf_hwcap |= HWCAP_EXT2; |
|---|
| 184 | 192 | |
|---|
| 185 | | - if (cpu_cfgid & 0x0008) |
|---|
| 193 | + if (cpu_cfgid & 0x0008) { |
|---|
| 186 | 194 | elf_hwcap |= HWCAP_FPU; |
|---|
| 187 | | - |
|---|
| 195 | + has_fpu = true; |
|---|
| 196 | + } |
|---|
| 188 | 197 | if (cpu_cfgid & 0x0010) |
|---|
| 189 | 198 | elf_hwcap |= HWCAP_STRING; |
|---|
| 190 | 199 | |
|---|
| .. | .. |
|---|
| 214 | 223 | if (__nds32__mfsr(NDS32_SR_MSC_CFG) & MSC_CFG_mskL2C) |
|---|
| 215 | 224 | elf_hwcap |= HWCAP_L2C; |
|---|
| 216 | 225 | |
|---|
| 226 | +#ifdef CONFIG_HW_PRE |
|---|
| 227 | + if (__nds32__mfsr(NDS32_SR_MISC_CTL) & MISC_CTL_makHWPRE_EN) |
|---|
| 228 | + elf_hwcap |= HWCAP_HWPRE; |
|---|
| 229 | +#endif |
|---|
| 230 | + |
|---|
| 217 | 231 | tmp = __nds32__mfsr(NDS32_SR_CACHE_CTL); |
|---|
| 218 | 232 | if (!IS_ENABLED(CONFIG_CPU_DCACHE_DISABLE)) |
|---|
| 219 | 233 | tmp |= CACHE_CTL_mskDC_EN; |
|---|
| .. | .. |
|---|
| 235 | 249 | memory_end = memory_start = 0; |
|---|
| 236 | 250 | |
|---|
| 237 | 251 | /* Find main memory where is the kernel */ |
|---|
| 238 | | - for_each_memblock(memory, region) { |
|---|
| 239 | | - memory_start = region->base; |
|---|
| 240 | | - memory_end = region->base + region->size; |
|---|
| 241 | | - pr_info("%s: Memory: 0x%x-0x%x\n", __func__, |
|---|
| 242 | | - memory_start, memory_end); |
|---|
| 243 | | - } |
|---|
| 252 | + memory_start = memblock_start_of_DRAM(); |
|---|
| 253 | + memory_end = memblock_end_of_DRAM(); |
|---|
| 244 | 254 | |
|---|
| 245 | 255 | if (!memory_end) { |
|---|
| 246 | 256 | panic("No memory!"); |
|---|
| .. | .. |
|---|
| 302 | 312 | parse_early_param(); |
|---|
| 303 | 313 | |
|---|
| 304 | 314 | unflatten_and_copy_device_tree(); |
|---|
| 305 | | - |
|---|
| 306 | | - if(IS_ENABLED(CONFIG_VT)) { |
|---|
| 307 | | - if(IS_ENABLED(CONFIG_DUMMY_CONSOLE)) |
|---|
| 308 | | - conswitchp = &dummy_con; |
|---|
| 309 | | - } |
|---|
| 310 | 315 | |
|---|
| 311 | 316 | *cmdline_p = boot_command_line; |
|---|
| 312 | 317 | early_trap_init(); |
|---|