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 diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
17 index 8808bf5..a4ad354 100644
18 --- a/arch/mips/include/asm/prom.h
19 +++ b/arch/mips/include/asm/prom.h
20 @@ -44,8 +44,11 @@ extern void __dt_setup_arch(struct boot_param_header *bph);
21 __dt_setup_arch(&__dtb_##sym##_begin); \
24 +extern char *of_mips_get_machine_name(void);
27 static inline void device_tree_init(void) { }
28 +static char *of_mips_get_machine_name(void) { return NULL; }
29 #endif /* CONFIG_OF */
31 #endif /* __ASM_PROM_H */
32 diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
33 index 135c4aa..9ab3d13 100644
34 --- a/arch/mips/kernel/proc.c
35 +++ b/arch/mips/kernel/proc.c
37 #include <asm/cpu-features.h>
38 #include <asm/mipsregs.h>
39 #include <asm/processor.h>
40 +#include <asm/prom.h>
41 #include <asm/mips_machine.h>
43 unsigned int vced_count, vcei_count;
44 @@ -34,7 +35,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
47 seq_printf(m, "system type\t\t: %s\n", get_system_type());
48 - if (mips_get_machine_name())
49 + if (of_mips_get_machine_name())
50 + seq_printf(m, "machine\t\t\t: %s\n",
51 + of_mips_get_machine_name());
52 + else if (mips_get_machine_name())
53 seq_printf(m, "machine\t\t\t: %s\n",
54 mips_get_machine_name());
56 diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
57 index 028f6f8..1aa68a2 100644
58 --- a/arch/mips/kernel/prom.c
59 +++ b/arch/mips/kernel/prom.c
64 +static char of_mips_machine_name[64] = "Unknown";
66 +char *of_mips_get_machine_name(void)
68 + return of_mips_machine_name;
71 int __init early_init_dt_scan_memory_arch(unsigned long node,
72 const char *uname, int depth,
74 @@ -50,6 +57,20 @@ void __init early_init_dt_setup_initrd_arch(unsigned long start,
78 +int __init early_init_dt_scan_model(unsigned long node,
79 + const char *uname, int depth,
83 + char *model = of_get_flat_dt_prop(node, "model", NULL);
85 + snprintf(of_mips_machine_name, sizeof(of_mips_machine_name), model);
86 + pr_info("MIPS: machine is %s\n", of_mips_machine_name);
92 void __init early_init_devtree(void *params)
94 /* Setup flat device-tree pointer */
95 @@ -65,6 +86,9 @@ void __init early_init_devtree(void *params)
96 /* Scan memory nodes */
97 of_scan_flat_dt(early_init_dt_scan_root, NULL);
98 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
100 + /* try to load the mips machine name */
101 + of_scan_flat_dt(early_init_dt_scan_model, NULL);
104 void __init __dt_setup_arch(struct boot_param_header *bph)