1/*
2 * Xilfpga platform setup
3 *
4 * Copyright (C) 2015 Imagination Technologies
5 * Author: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 */
11
12#include <linux/of_fdt.h>
13#include <linux/of_platform.h>
14
15#include <asm/prom.h>
16
17#define XILFPGA_UART_BASE	0xb0401000
18
19const char *get_system_type(void)
20{
21	return "MIPSfpga";
22}
23
24void __init plat_mem_setup(void)
25{
26	__dt_setup_arch(__dtb_start);
27	strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
28}
29
30void __init prom_init(void)
31{
32	setup_8250_early_printk_port(XILFPGA_UART_BASE, 2, 50000);
33}
34
35void __init prom_free_prom_memory(void)
36{
37}
38
39void __init device_tree_init(void)
40{
41	if (!initial_boot_params)
42		return;
43
44	unflatten_and_copy_device_tree();
45}
46
47static int __init plat_of_setup(void)
48{
49	if (!of_have_populated_dt())
50		panic("Device tree not present");
51
52	if (of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL))
53		panic("Failed to populate DT");
54
55	return 0;
56}
57arch_initcall(plat_of_setup);
58