2 * linux/arch/metag/kernel/devtree.c
4 * Copyright (C) 2012 Imagination Technologies Ltd.
6 * Based on ARM version:
7 * Copyright (C) 2009 Canonical Ltd. <jeremy.kerr@canonical.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include <linux/init.h>
15 #include <linux/export.h>
16 #include <linux/types.h>
17 #include <linux/bootmem.h>
18 #include <linux/memblock.h>
20 #include <linux/of_fdt.h>
22 #include <asm/setup.h>
24 #include <asm/mach/arch.h>
26 void __init
early_init_dt_add_memory_arch(u64 base
, u64 size
)
28 pr_err("%s(%llx, %llx)\n",
29 __func__
, base
, size
);
32 void * __init
early_init_dt_alloc_memory_arch(u64 size
, u64 align
)
34 return alloc_bootmem_align(size
, align
);
37 static const void * __init
arch_get_next_mach(const char *const **match
)
39 static const struct machine_desc
*mdesc
= __arch_info_begin
;
40 const struct machine_desc
*m
= mdesc
;
42 if (m
>= __arch_info_end
)
46 *match
= m
->dt_compat
;
51 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
52 * @dt: virtual address pointer to dt blob
54 * If a dtb was passed to the kernel, then use it to choose the correct
55 * machine_desc and to setup the system.
57 const struct machine_desc
* __init
setup_machine_fdt(void *dt
)
59 const struct machine_desc
*mdesc
;
61 /* check device tree validity */
62 if (!early_init_dt_scan(dt
))
65 mdesc
= of_flat_dt_match_machine(NULL
, arch_get_next_mach
);
67 dump_machine_table(); /* does not return */
68 pr_info("Machine name: %s\n", mdesc
->name
);