1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Author: Huacai Chen <chenhuacai@loongson.cn>
4 * Copyright (C) 2020 Loongson Technology Co., Ltd.
5 *
6 *  This program is free software; you can redistribute	 it and/or modify it
7 *  under  the terms of	 the GNU General  Public License as published by the
8 *  Free Software Foundation;  either version 2 of the	License, or (at your
9 *  option) any later version.
10 */
11#include <linux/export.h>
12#include <linux/init.h>
13#include <linux/libfdt.h>
14#include <linux/of_fdt.h>
15#include <asm/bootinfo.h>
16
17#ifdef CONFIG_VT
18#include <linux/console.h>
19#include <linux/screen_info.h>
20#include <linux/platform_device.h>
21#endif
22
23#include <loongson.h>
24
25const char *get_system_type(void)
26{
27	return "generic-loongson-machine";
28}
29
30void __init plat_mem_setup(void)
31{
32}
33
34static int __init register_gop_device(void)
35{
36	void *pd;
37	if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
38		return 0;
39	pd = platform_device_register_data(NULL, "efi-framebuffer", 0,
40			&screen_info, sizeof(screen_info));
41	return PTR_ERR_OR_ZERO(pd);
42}
43subsys_initcall(register_gop_device);
44
45#define NR_CELLS 6
46
47void __init device_tree_init(void)
48{
49	if (!initial_boot_params)
50		return;
51
52	if (early_init_dt_verify(initial_boot_params))
53		unflatten_and_copy_device_tree();
54}
55