Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 2 | /* |
Ralf Baechle | 0bb383a | 2015-07-07 20:56:04 +0200 | [diff] [blame] | 3 | * Copyright (C) 2007 Lemote Inc. & Institute of Computing Technology |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 4 | * Author: Fuxin Zhang, zhangfx@lemote.com |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 5 | */ |
Paul Gortmaker | 26dd3e4 | 2017-01-28 21:05:57 -0500 | [diff] [blame] | 6 | #include <linux/export.h> |
| 7 | #include <linux/init.h> |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 8 | |
| 9 | #include <asm/wbflush.h> |
Aaro Koskinen | 15dd8eb | 2014-11-19 23:52:47 +0200 | [diff] [blame] | 10 | #include <asm/bootinfo.h> |
Jiaxun Yang | fcecdcd | 2020-03-25 11:55:03 +0800 | [diff] [blame] | 11 | #include <linux/libfdt.h> |
| 12 | #include <linux/of_fdt.h> |
| 13 | |
| 14 | #include <asm/prom.h> |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 15 | |
| 16 | #include <loongson.h> |
| 17 | |
Jiaxun Yang | fcecdcd | 2020-03-25 11:55:03 +0800 | [diff] [blame] | 18 | void *loongson_fdt_blob; |
| 19 | |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 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 | |
Huacai Chen | 300459d | 2014-03-21 18:44:08 +0800 | [diff] [blame] | 31 | void (*__wbflush)(void) = wbflush_loongson; |
| 32 | EXPORT_SYMBOL(__wbflush); |
| 33 | |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 34 | void __init plat_mem_setup(void) |
| 35 | { |
Jiaxun Yang | fcecdcd | 2020-03-25 11:55:03 +0800 | [diff] [blame] | 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(); |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 46 | } |