blob: 6fe3ffffcaa6aec783fb2dd8801790038d1f3d1e [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Wu Zhangjin85749d22009-07-02 23:26:45 +08002/*
Ralf Baechle0bb383a2015-07-07 20:56:04 +02003 * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology
Wu Zhangjin85749d22009-07-02 23:26:45 +08004 * Author: Fuxin Zhang, zhangfx@lemote.com
Wu Zhangjin85749d22009-07-02 23:26:45 +08005 */
Paul Gortmaker26dd3e42017-01-28 21:05:57 -05006#include <linux/export.h>
7#include <linux/init.h>
Wu Zhangjin85749d22009-07-02 23:26:45 +08008
9#include <asm/wbflush.h>
Aaro Koskinen15dd8eb2014-11-19 23:52:47 +020010#include <asm/bootinfo.h>
Jiaxun Yangfcecdcd2020-03-25 11:55:03 +080011#include <linux/libfdt.h>
12#include <linux/of_fdt.h>
13
14#include <asm/prom.h>
Wu Zhangjin85749d22009-07-02 23:26:45 +080015
16#include <loongson.h>
17
Jiaxun Yangfcecdcd2020-03-25 11:55:03 +080018void *loongson_fdt_blob;
19
Wu Zhangjin85749d22009-07-02 23:26:45 +080020static 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
Huacai Chen300459d2014-03-21 18:44:08 +080031void (*__wbflush)(void) = wbflush_loongson;
32EXPORT_SYMBOL(__wbflush);
33
Wu Zhangjin85749d22009-07-02 23:26:45 +080034void __init plat_mem_setup(void)
35{
Jiaxun Yangfcecdcd2020-03-25 11:55:03 +080036 if (loongson_fdt_blob)
37 __dt_setup_arch(loongson_fdt_blob);
38}
39
40void __init device_tree_init(void)
41{
42 if (!initial_boot_params)
43 return;
44
45 unflatten_and_copy_device_tree();
Wu Zhangjin85749d22009-07-02 23:26:45 +080046}