spi: spi-fsl-qspi: Fix return value check of devm_ioremap() in probe
[linux/fpc-iii.git] / arch / riscv / kernel / setup.c
blob145128a7e560e4791fadb7d7683f4cc8c89c9303
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
4 * Chen Liqin <liqin.chen@sunplusct.com>
5 * Lennox Wu <lennox.wu@sunplusct.com>
6 * Copyright (C) 2012 Regents of the University of California
7 */
9 #include <linux/init.h>
10 #include <linux/mm.h>
11 #include <linux/memblock.h>
12 #include <linux/sched.h>
13 #include <linux/console.h>
14 #include <linux/screen_info.h>
15 #include <linux/of_fdt.h>
16 #include <linux/of_platform.h>
17 #include <linux/sched/task.h>
18 #include <linux/swiotlb.h>
19 #include <linux/smp.h>
21 #include <asm/clint.h>
22 #include <asm/cpu_ops.h>
23 #include <asm/setup.h>
24 #include <asm/sections.h>
25 #include <asm/pgtable.h>
26 #include <asm/sbi.h>
27 #include <asm/tlbflush.h>
28 #include <asm/thread_info.h>
29 #include <asm/kasan.h>
31 #include "head.h"
33 #ifdef CONFIG_DUMMY_CONSOLE
34 struct screen_info screen_info = {
35 .orig_video_lines = 30,
36 .orig_video_cols = 80,
37 .orig_video_mode = 0,
38 .orig_video_ega_bx = 0,
39 .orig_video_isVGA = 1,
40 .orig_video_points = 8
42 #endif
45 * The lucky hart to first increment this variable will boot the other cores.
46 * This is used before the kernel initializes the BSS so it can't be in the
47 * BSS.
49 atomic_t hart_lottery __section(.sdata);
50 unsigned long boot_cpu_hartid;
51 static DEFINE_PER_CPU(struct cpu, cpu_devices);
53 void __init parse_dtb(void)
55 if (early_init_dt_scan(dtb_early_va))
56 return;
58 pr_err("No DTB passed to the kernel\n");
59 #ifdef CONFIG_CMDLINE_FORCE
60 strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
61 pr_info("Forcing kernel command line to: %s\n", boot_command_line);
62 #endif
65 void __init setup_arch(char **cmdline_p)
67 init_mm.start_code = (unsigned long) _stext;
68 init_mm.end_code = (unsigned long) _etext;
69 init_mm.end_data = (unsigned long) _edata;
70 init_mm.brk = (unsigned long) _end;
72 *cmdline_p = boot_command_line;
74 parse_early_param();
76 setup_bootmem();
77 paging_init();
78 unflatten_device_tree();
79 clint_init_boot_cpu();
81 #ifdef CONFIG_SWIOTLB
82 swiotlb_init(1);
83 #endif
85 #ifdef CONFIG_KASAN
86 kasan_init();
87 #endif
89 #if IS_ENABLED(CONFIG_RISCV_SBI)
90 sbi_init();
91 #endif
93 #ifdef CONFIG_SMP
94 setup_smp();
95 #endif
97 riscv_fill_hwcap();
100 static int __init topology_init(void)
102 int i;
104 for_each_possible_cpu(i) {
105 struct cpu *cpu = &per_cpu(cpu_devices, i);
107 cpu->hotpluggable = cpu_has_hotplug(i);
108 register_cpu(cpu, i);
111 return 0;
113 subsys_initcall(topology_init);