1 From 0184f7b64c68fe9606559e86bdd288de01c87a85 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 17 Mar 2013 10:30:48 +0100
4 Subject: [PATCH 200/208] MIPS: read the mips_machine name from OF and output
7 This allows the userland to be compatible to the devive probing of mips_machine.
9 Signed-off-by: John Crispin <blogic@openwrt.org>
11 arch/mips/include/asm/prom.h | 3 +++
12 arch/mips/kernel/proc.c | 6 +++++-
13 arch/mips/kernel/prom.c | 24 ++++++++++++++++++++++++
14 3 files changed, 32 insertions(+), 1 deletion(-)
16 --- a/arch/mips/include/asm/prom.h
17 +++ b/arch/mips/include/asm/prom.h
18 @@ -44,8 +44,11 @@ extern void __dt_setup_arch(struct boot_
19 __dt_setup_arch(&__dtb_##sym##_begin); \
22 +extern char *of_mips_get_machine_name(void);
25 static inline void device_tree_init(void) { }
26 +static char *of_mips_get_machine_name(void) { return NULL; }
27 #endif /* CONFIG_OF */
29 #endif /* __ASM_PROM_H */
30 --- a/arch/mips/kernel/proc.c
31 +++ b/arch/mips/kernel/proc.c
33 #include <asm/cpu-features.h>
34 #include <asm/mipsregs.h>
35 #include <asm/processor.h>
36 +#include <asm/prom.h>
37 #include <asm/mips_machine.h>
39 unsigned int vced_count, vcei_count;
40 @@ -34,7 +35,10 @@ static int show_cpuinfo(struct seq_file
43 seq_printf(m, "system type\t\t: %s\n", get_system_type());
44 - if (mips_get_machine_name())
45 + if (of_mips_get_machine_name())
46 + seq_printf(m, "machine\t\t\t: %s\n",
47 + of_mips_get_machine_name());
48 + else if (mips_get_machine_name())
49 seq_printf(m, "machine\t\t\t: %s\n",
50 mips_get_machine_name());
52 --- a/arch/mips/kernel/prom.c
53 +++ b/arch/mips/kernel/prom.c
58 +static char of_mips_machine_name[64] = "Unknown";
60 +char *of_mips_get_machine_name(void)
62 + return of_mips_machine_name;
65 int __init early_init_dt_scan_memory_arch(unsigned long node,
66 const char *uname, int depth,
68 @@ -50,6 +57,20 @@ void __init early_init_dt_setup_initrd_a
72 +int __init early_init_dt_scan_model(unsigned long node,
73 + const char *uname, int depth,
77 + char *model = of_get_flat_dt_prop(node, "model", NULL);
79 + snprintf(of_mips_machine_name, sizeof(of_mips_machine_name), model);
80 + pr_info("MIPS: machine is %s\n", of_mips_machine_name);
86 void __init early_init_devtree(void *params)
88 /* Setup flat device-tree pointer */
89 @@ -65,6 +86,9 @@ void __init early_init_devtree(void *par
90 /* Scan memory nodes */
91 of_scan_flat_dt(early_init_dt_scan_root, NULL);
92 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
94 + /* try to load the mips machine name */
95 + of_scan_flat_dt(early_init_dt_scan_model, NULL);
98 void __init __dt_setup_arch(struct boot_param_header *bph)