aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/patches-3.8/0200-MIPS-read-the-mips_machine-name-from-OF-and-output-i.patch
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2013-04-03 09:59:10 +0000
committerJohn Crispin <john@openwrt.org>2013-04-03 09:59:10 +0000
commit46f141637c81ad0508cced2496678461d638cb39 (patch)
tree0339883c1042298f9df733f2ec4ffc61de8a5be1 /target/linux/ramips/patches-3.8/0200-MIPS-read-the-mips_machine-name-from-OF-and-output-i.patch
parent4f86ea43ca3ae3b670da308166f9a91f36e69f3a (diff)
downloadupstream-46f141637c81ad0508cced2496678461d638cb39.tar.gz
upstream-46f141637c81ad0508cced2496678461d638cb39.tar.bz2
upstream-46f141637c81ad0508cced2496678461d638cb39.zip
add patches for v3.8
Signed-off-by: John Crsipin <blogic@openwrt.org> SVN-Revision: 36163
Diffstat (limited to 'target/linux/ramips/patches-3.8/0200-MIPS-read-the-mips_machine-name-from-OF-and-output-i.patch')
-rw-r--r--target/linux/ramips/patches-3.8/0200-MIPS-read-the-mips_machine-name-from-OF-and-output-i.patch107
1 files changed, 107 insertions, 0 deletions
diff --git a/target/linux/ramips/patches-3.8/0200-MIPS-read-the-mips_machine-name-from-OF-and-output-i.patch b/target/linux/ramips/patches-3.8/0200-MIPS-read-the-mips_machine-name-from-OF-and-output-i.patch
new file mode 100644
index 0000000000..3bdd136f95
--- /dev/null
+++ b/target/linux/ramips/patches-3.8/0200-MIPS-read-the-mips_machine-name-from-OF-and-output-i.patch
@@ -0,0 +1,107 @@
+From 0184f7b64c68fe9606559e86bdd288de01c87a85 Mon Sep 17 00:00:00 2001
+From: John Crispin <blogic@openwrt.org>
+Date: Sun, 17 Mar 2013 10:30:48 +0100
+Subject: [PATCH 200/208] MIPS: read the mips_machine name from OF and output
+ it in /proc/cpuinfo
+
+This allows the userland to be compatible to the devive probing of mips_machine.
+
+Signed-off-by: John Crispin <blogic@openwrt.org>
+---
+ arch/mips/include/asm/prom.h | 3 +++
+ arch/mips/kernel/proc.c | 6 +++++-
+ arch/mips/kernel/prom.c | 24 ++++++++++++++++++++++++
+ 3 files changed, 32 insertions(+), 1 deletion(-)
+
+diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
+index 8808bf5..a4ad354 100644
+--- a/arch/mips/include/asm/prom.h
++++ b/arch/mips/include/asm/prom.h
+@@ -44,8 +44,11 @@ extern void __dt_setup_arch(struct boot_param_header *bph);
+ __dt_setup_arch(&__dtb_##sym##_begin); \
+ })
+
++extern char *of_mips_get_machine_name(void);
++
+ #else /* CONFIG_OF */
+ static inline void device_tree_init(void) { }
++static char *of_mips_get_machine_name(void) { return NULL; }
+ #endif /* CONFIG_OF */
+
+ #endif /* __ASM_PROM_H */
+diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
+index 135c4aa..9ab3d13 100644
+--- a/arch/mips/kernel/proc.c
++++ b/arch/mips/kernel/proc.c
+@@ -12,6 +12,7 @@
+ #include <asm/cpu-features.h>
+ #include <asm/mipsregs.h>
+ #include <asm/processor.h>
++#include <asm/prom.h>
+ #include <asm/mips_machine.h>
+
+ unsigned int vced_count, vcei_count;
+@@ -34,7 +35,10 @@ static int show_cpuinfo(struct seq_file *m, void *v)
+ */
+ if (n == 0) {
+ seq_printf(m, "system type\t\t: %s\n", get_system_type());
+- if (mips_get_machine_name())
++ if (of_mips_get_machine_name())
++ seq_printf(m, "machine\t\t\t: %s\n",
++ of_mips_get_machine_name());
++ else if (mips_get_machine_name())
+ seq_printf(m, "machine\t\t\t: %s\n",
+ mips_get_machine_name());
+ }
+diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
+index 028f6f8..1aa68a2 100644
+--- a/arch/mips/kernel/prom.c
++++ b/arch/mips/kernel/prom.c
+@@ -23,6 +23,13 @@
+ #include <asm/page.h>
+ #include <asm/prom.h>
+
++static char of_mips_machine_name[64] = "Unknown";
++
++char *of_mips_get_machine_name(void)
++{
++ return of_mips_machine_name;
++}
++
+ int __init early_init_dt_scan_memory_arch(unsigned long node,
+ const char *uname, int depth,
+ void *data)
+@@ -50,6 +57,20 @@ void __init early_init_dt_setup_initrd_arch(unsigned long start,
+ }
+ #endif
+
++int __init early_init_dt_scan_model(unsigned long node,
++ const char *uname, int depth,
++ void *data)
++{
++ if (!depth) {
++ char *model = of_get_flat_dt_prop(node, "model", NULL);
++ if (model) {
++ snprintf(of_mips_machine_name, sizeof(of_mips_machine_name), model);
++ pr_info("MIPS: machine is %s\n", of_mips_machine_name);
++ }
++ }
++ return 0;
++}
++
+ void __init early_init_devtree(void *params)
+ {
+ /* Setup flat device-tree pointer */
+@@ -65,6 +86,9 @@ void __init early_init_devtree(void *params)
+ /* Scan memory nodes */
+ of_scan_flat_dt(early_init_dt_scan_root, NULL);
+ of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
++
++ /* try to load the mips machine name */
++ of_scan_flat_dt(early_init_dt_scan_model, NULL);
+ }
+
+ void __init __dt_setup_arch(struct boot_param_header *bph)
+--
+1.7.10.4
+