xref: /openbmc/linux/arch/mips/loongson64/setup.c (revision c10d12e3)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
4  * Author: Fuxin Zhang, zhangfx@lemote.com
5  */
6 #include <linux/export.h>
7 #include <linux/init.h>
8 
9 #include <asm/wbflush.h>
10 #include <asm/bootinfo.h>
11 #include <linux/libfdt.h>
12 #include <linux/of_fdt.h>
13 
14 #include <asm/prom.h>
15 
16 #include <loongson.h>
17 
18 void *loongson_fdt_blob;
19 
20 static void wbflush_loongson(void)
21 {
22 	asm(".set\tpush\n\t"
23 	    ".set\tnoreorder\n\t"
24 	    ".set mips3\n\t"
25 	    "sync\n\t"
26 	    "nop\n\t"
27 	    ".set\tpop\n\t"
28 	    ".set mips0\n\t");
29 }
30 
31 void (*__wbflush)(void) = wbflush_loongson;
32 EXPORT_SYMBOL(__wbflush);
33 
34 void __init plat_mem_setup(void)
35 {
36 	if (loongson_fdt_blob)
37 		__dt_setup_arch(loongson_fdt_blob);
38 }
39 
40 void __init device_tree_init(void)
41 {
42 	if (!initial_boot_params)
43 		return;
44 
45 	unflatten_and_copy_device_tree();
46 }
47