0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/init.h>
0010 #include <linux/reboot.h>
0011 #include <linux/memblock.h>
0012 #include <linux/of.h>
0013 #include <linux/of_fdt.h>
0014 #include <asm/mach_desc.h>
0015
0016 #ifdef CONFIG_SERIAL_EARLYCON
0017
0018 static unsigned int __initdata arc_base_baud;
0019
0020 unsigned int __init arc_early_base_baud(void)
0021 {
0022 return arc_base_baud/16;
0023 }
0024
0025 static void __init arc_set_early_base_baud(unsigned long dt_root)
0026 {
0027 if (of_flat_dt_is_compatible(dt_root, "abilis,arc-tb10x"))
0028 arc_base_baud = 166666666;
0029 else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp") ||
0030 of_flat_dt_is_compatible(dt_root, "snps,hsdk"))
0031 arc_base_baud = 33333333;
0032 else
0033 arc_base_baud = 50000000;
0034 }
0035 #else
0036 #define arc_set_early_base_baud(dt_root)
0037 #endif
0038
0039 static const void * __init arch_get_next_mach(const char *const **match)
0040 {
0041 static const struct machine_desc *mdesc = __arch_info_begin;
0042 const struct machine_desc *m = mdesc;
0043
0044 if (m >= __arch_info_end)
0045 return NULL;
0046
0047 mdesc++;
0048 *match = m->dt_compat;
0049 return m;
0050 }
0051
0052
0053
0054
0055
0056
0057
0058
0059 const struct machine_desc * __init setup_machine_fdt(void *dt)
0060 {
0061 const struct machine_desc *mdesc;
0062 unsigned long dt_root;
0063
0064 if (!early_init_dt_scan(dt))
0065 return NULL;
0066
0067 mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
0068 if (!mdesc)
0069 machine_halt();
0070
0071 dt_root = of_get_flat_dt_root();
0072 arc_set_early_base_baud(dt_root);
0073
0074 return mdesc;
0075 }