brcm2708: add linux 4.4 support
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.4 / 0013-ARM-bcm2835-Set-Serial-number-and-Revision.patch
1 From e04c4837cde13f4782fc5a274599f580d8a29715 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
3 Date: Wed, 3 Jun 2015 12:26:13 +0200
4 Subject: [PATCH 013/127] ARM: bcm2835: Set Serial number and Revision
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The VideoCore bootloader passes in Serial number and
10 Revision number through Device Tree. Make these available to
11 userspace through /proc/cpuinfo.
12
13 Mainline status:
14
15 There is a commit in linux-next that standardize passing the serial
16 number through Device Tree (string: /serial-number):
17 ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo
18
19 There was an attempt to do the same with the revision number, but it
20 didn't get in:
21 [PATCH v2 1/2] arm: devtree: Set system_rev from DT revision
22
23 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
24 ---
25 arch/arm/mach-bcm/board_bcm2835.c | 9 +++++++++
26 1 file changed, 9 insertions(+)
27
28 --- a/arch/arm/mach-bcm/board_bcm2835.c
29 +++ b/arch/arm/mach-bcm/board_bcm2835.c
30 @@ -17,12 +17,16 @@
31 #include <linux/of_address.h>
32 #include <linux/of_platform.h>
33 #include <linux/clk/bcm2835.h>
34 +#include <asm/system_info.h>
35
36 #include <asm/mach/arch.h>
37 #include <asm/mach/map.h>
38
39 static void __init bcm2835_init(void)
40 {
41 + struct device_node *np = of_find_node_by_path("/system");
42 + u32 val;
43 + u64 val64;
44 int ret;
45
46 bcm2835_init_clocks();
47 @@ -33,6 +37,11 @@ static void __init bcm2835_init(void)
48 pr_err("of_platform_populate failed: %d\n", ret);
49 BUG();
50 }
51 +
52 + if (!of_property_read_u32(np, "linux,revision", &val))
53 + system_rev = val;
54 + if (!of_property_read_u64(np, "linux,serial", &val64))
55 + system_serial_low = val64;
56 }
57
58 static const char * const bcm2835_compat[] = {