aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/prom.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/prom.c')
-rw-r--r--arch/mips/kernel/prom.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 028f6f837ef9..5712bb532245 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -23,6 +23,23 @@
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/prom.h> 24#include <asm/prom.h>
25 25
26static char mips_machine_name[64] = "Unknown";
27
28__init void mips_set_machine_name(const char *name)
29{
30 if (name == NULL)
31 return;
32
33 strncpy(mips_machine_name, name, sizeof(mips_machine_name));
34 pr_info("MIPS: machine is %s\n", mips_get_machine_name());
35}
36
37char *mips_get_machine_name(void)
38{
39 return mips_machine_name;
40}
41
42#ifdef CONFIG_OF
26int __init early_init_dt_scan_memory_arch(unsigned long node, 43int __init early_init_dt_scan_memory_arch(unsigned long node,
27 const char *uname, int depth, 44 const char *uname, int depth,
28 void *data) 45 void *data)
@@ -50,6 +67,18 @@ void __init early_init_dt_setup_initrd_arch(unsigned long start,
50} 67}
51#endif 68#endif
52 69
70int __init early_init_dt_scan_model(unsigned long node, const char *uname,
71 int depth, void *data)
72{
73 if (!depth) {
74 char *model = of_get_flat_dt_prop(node, "model", NULL);
75
76 if (model)
77 mips_set_machine_name(model);
78 }
79 return 0;
80}
81
53void __init early_init_devtree(void *params) 82void __init early_init_devtree(void *params)
54{ 83{
55 /* Setup flat device-tree pointer */ 84 /* Setup flat device-tree pointer */
@@ -65,6 +94,9 @@ void __init early_init_devtree(void *params)
65 /* Scan memory nodes */ 94 /* Scan memory nodes */
66 of_scan_flat_dt(early_init_dt_scan_root, NULL); 95 of_scan_flat_dt(early_init_dt_scan_root, NULL);
67 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL); 96 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
97
98 /* try to load the mips machine name */
99 of_scan_flat_dt(early_init_dt_scan_model, NULL);
68} 100}
69 101
70void __init __dt_setup_arch(struct boot_param_header *bph) 102void __init __dt_setup_arch(struct boot_param_header *bph)
@@ -79,3 +111,4 @@ void __init __dt_setup_arch(struct boot_param_header *bph)
79 111
80 early_init_devtree(initial_boot_params); 112 early_init_devtree(initial_boot_params);
81} 113}
114#endif