GNU Linux-libre 5.4.274-gnu1
[releases.git] / arch / mips / loongson64 / common / setup.c
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
12 #include <loongson.h>
13
14 #ifdef CONFIG_VT
15 #include <linux/console.h>
16 #include <linux/screen_info.h>
17 #endif
18
19 static void wbflush_loongson(void)
20 {
21         asm(".set\tpush\n\t"
22             ".set\tnoreorder\n\t"
23             ".set mips3\n\t"
24             "sync\n\t"
25             "nop\n\t"
26             ".set\tpop\n\t"
27             ".set mips0\n\t");
28 }
29
30 void (*__wbflush)(void) = wbflush_loongson;
31 EXPORT_SYMBOL(__wbflush);
32
33 void __init plat_mem_setup(void)
34 {
35 #ifdef CONFIG_VT
36 #if defined(CONFIG_VGA_CONSOLE)
37         conswitchp = &vga_con;
38
39         screen_info = (struct screen_info) {
40                 .orig_x                 = 0,
41                 .orig_y                 = 25,
42                 .orig_video_cols        = 80,
43                 .orig_video_lines       = 25,
44                 .orig_video_isVGA       = VIDEO_TYPE_VGAC,
45                 .orig_video_points      = 16,
46         };
47 #elif defined(CONFIG_DUMMY_CONSOLE)
48         conswitchp = &dummy_con;
49 #endif
50 #endif
51 }