kernel: bump 4.19 to 4.19.79
[oweals/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0777-arch-arm64-Add-Revision-Serial-Model-to-cpuinfo.patch
1 From aabfcb0abbc34ca5f3c4b4f872123166eca2e100 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Tue, 3 Sep 2019 18:17:25 +0100
4 Subject: [PATCH 777/806] arch/arm64: Add Revision, Serial, Model to cpuinfo
5
6 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
7 ---
8  arch/arm64/kernel/cpuinfo.c | 25 +++++++++++++++++++++++++
9  1 file changed, 25 insertions(+)
10
11 --- a/arch/arm64/kernel/cpuinfo.c
12 +++ b/arch/arm64/kernel/cpuinfo.c
13 @@ -27,6 +27,7 @@
14  #include <linux/elf.h>
15  #include <linux/init.h>
16  #include <linux/kernel.h>
17 +#include <linux/of_platform.h>
18  #include <linux/personality.h>
19  #include <linux/preempt.h>
20  #include <linux/printk.h>
21 @@ -126,6 +127,10 @@ static int c_show(struct seq_file *m, vo
22  {
23         int i, j;
24         bool compat = personality(current->personality) == PER_LINUX32;
25 +       struct device_node *np;
26 +       const char *model;
27 +       const char *serial;
28 +       u32 revision;
29  
30         for_each_online_cpu(i) {
31                 struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
32 @@ -177,6 +182,26 @@ static int c_show(struct seq_file *m, vo
33                 seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
34         }
35  
36 +       seq_printf(m, "Hardware\t: BCM2835\n");
37 +
38 +       np = of_find_node_by_path("/system");
39 +       if (np) {
40 +               if (!of_property_read_u32(np, "linux,revision", &revision))
41 +                       seq_printf(m, "Revision\t: %04x\n", revision);
42 +               of_node_put(np);
43 +       }
44 +
45 +       np = of_find_node_by_path("/");
46 +       if (np) {
47 +               if (!of_property_read_string(np, "serial-number",
48 +                                            &serial))
49 +                       seq_printf(m, "Serial\t\t: %s\n", serial);
50 +               if (!of_property_read_string(np, "model",
51 +                                            &model))
52 +                       seq_printf(m, "Model\t\t: %s\n", model);
53 +               of_node_put(np);
54 +       }
55 +
56         return 0;
57  }
58