Commit | Line | Data |
---|---|---|
1ccea77e | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
95acd4c7 LFT |
2 | /* |
3 | * Device tree support | |
4 | * | |
e8bf5bc7 | 5 | * Copyright (C) 2013, 2015 Altera Corporation |
95acd4c7 LFT |
6 | * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw> |
7 | * | |
8 | * Based on MIPS support for CONFIG_OF device tree support | |
9 | * | |
10 | * Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com> | |
95acd4c7 LFT |
11 | */ |
12 | ||
13 | #include <linux/init.h> | |
14 | #include <linux/types.h> | |
57c8a661 | 15 | #include <linux/memblock.h> |
95acd4c7 LFT |
16 | #include <linux/of.h> |
17 | #include <linux/of_fdt.h> | |
18 | #include <linux/io.h> | |
19 | ||
20 | #include <asm/sections.h> | |
21 | ||
95acd4c7 LFT |
22 | void __init early_init_devtree(void *params) |
23 | { | |
de164a7f GR |
24 | __be32 __maybe_unused *dtb = (u32 *)__dtb_start; |
25 | ||
95acd4c7 LFT |
26 | #if defined(CONFIG_NIOS2_DTB_AT_PHYS_ADDR) |
27 | if (be32_to_cpup((__be32 *)CONFIG_NIOS2_DTB_PHYS_ADDR) == | |
28 | OF_DT_HEADER) { | |
29 | params = (void *)CONFIG_NIOS2_DTB_PHYS_ADDR; | |
30 | early_init_dt_scan(params); | |
31 | return; | |
32 | } | |
33 | #endif | |
de164a7f GR |
34 | |
35 | #ifdef CONFIG_NIOS2_DTB_SOURCE_BOOL | |
95acd4c7 LFT |
36 | if (be32_to_cpu((__be32) *dtb) == OF_DT_HEADER) |
37 | params = (void *)__dtb_start; | |
de164a7f | 38 | #endif |
95acd4c7 LFT |
39 | |
40 | early_init_dt_scan(params); | |
41 | } |