]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
ARM: bcm2835: Set Serial number and Revision
authorNoralf Trønnes <noralf@tronnes.org>
Wed, 3 Jun 2015 10:26:13 +0000 (12:26 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 19 Sep 2017 10:07:40 +0000 (12:07 +0200)
The VideoCore bootloader passes in Serial number and
Revision number through Device Tree. Make these available to
userspace through /proc/cpuinfo.

Mainline status:

There is a commit in linux-next that standardize passing the serial
number through Device Tree (string: /serial-number):
ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo

There was an attempt to do the same with the revision number, but it
didn't get in:
[PATCH v2 1/2] arm: devtree: Set system_rev from DT revision

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
arch/arm/mach-bcm/board_bcm2835.c

index 0c1edfc98696da0e0bb7f4a18cdfbcdd27a9795d..8f152266ba9b470df2eaaed9ebcf158ed2079834 100644 (file)
 #include <linux/irqchip.h>
 #include <linux/of_address.h>
 #include <linux/clk/bcm2835.h>
+#include <asm/system_info.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
 static void __init bcm2835_init(void)
 {
+       struct device_node *np = of_find_node_by_path("/system");
+       u32 val;
+       u64 val64;
+
        bcm2835_init_clocks();
+
+       if (!of_property_read_u32(np, "linux,revision", &val))
+               system_rev = val;
+       if (!of_property_read_u64(np, "linux,serial", &val64))
+               system_serial_low = val64;
 }
 
 static const char * const bcm2835_compat[] = {