2019-05-19 20:51:43 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2014-11-06 14:20:03 +07:00
|
|
|
/*
|
|
|
|
* Device tree support
|
|
|
|
*
|
2015-02-10 22:21:08 +07:00
|
|
|
* Copyright (C) 2013, 2015 Altera Corporation
|
2014-11-06 14:20:03 +07:00
|
|
|
* Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw>
|
|
|
|
*
|
|
|
|
* Based on MIPS support for CONFIG_OF device tree support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Cisco Systems Inc. <dediao@cisco.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/types.h>
|
2018-10-31 05:09:49 +07:00
|
|
|
#include <linux/memblock.h>
|
2014-11-06 14:20:03 +07:00
|
|
|
#include <linux/of.h>
|
|
|
|
#include <linux/of_fdt.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
|
|
|
|
#include <asm/sections.h>
|
|
|
|
|
|
|
|
void __init early_init_devtree(void *params)
|
|
|
|
{
|
|
|
|
__be32 *dtb = (u32 *)__dtb_start;
|
|
|
|
#if defined(CONFIG_NIOS2_DTB_AT_PHYS_ADDR)
|
|
|
|
if (be32_to_cpup((__be32 *)CONFIG_NIOS2_DTB_PHYS_ADDR) ==
|
|
|
|
OF_DT_HEADER) {
|
|
|
|
params = (void *)CONFIG_NIOS2_DTB_PHYS_ADDR;
|
|
|
|
early_init_dt_scan(params);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (be32_to_cpu((__be32) *dtb) == OF_DT_HEADER)
|
|
|
|
params = (void *)__dtb_start;
|
|
|
|
|
|
|
|
early_init_dt_scan(params);
|
|
|
|
}
|