0013-ARM-bcm2835-Set-Serial-number-and-Revision.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 1c2be61a1a6e2eb7cc8b337d732563609f5d8299 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/381] 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. The VideoCore bootloader passes in Serial number and
  9. Revision number through Device Tree. Make these available to
  10. userspace through /proc/cpuinfo.
  11. Mainline status:
  12. There is a commit in linux-next that standardize passing the serial
  13. number through Device Tree (string: /serial-number):
  14. ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo
  15. There was an attempt to do the same with the revision number, but it
  16. didn't get in:
  17. [PATCH v2 1/2] arm: devtree: Set system_rev from DT revision
  18. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
  19. ---
  20. arch/arm/mach-bcm/board_bcm2835.c | 9 +++++++++
  21. 1 file changed, 9 insertions(+)
  22. --- a/arch/arm/mach-bcm/board_bcm2835.c
  23. +++ b/arch/arm/mach-bcm/board_bcm2835.c
  24. @@ -17,12 +17,16 @@
  25. #include <linux/of_address.h>
  26. #include <linux/of_platform.h>
  27. #include <linux/clk/bcm2835.h>
  28. +#include <asm/system_info.h>
  29. #include <asm/mach/arch.h>
  30. #include <asm/mach/map.h>
  31. static void __init bcm2835_init(void)
  32. {
  33. + struct device_node *np = of_find_node_by_path("/system");
  34. + u32 val;
  35. + u64 val64;
  36. int ret;
  37. bcm2835_init_clocks();
  38. @@ -33,6 +37,11 @@ static void __init bcm2835_init(void)
  39. pr_err("of_platform_populate failed: %d\n", ret);
  40. BUG();
  41. }
  42. +
  43. + if (!of_property_read_u32(np, "linux,revision", &val))
  44. + system_rev = val;
  45. + if (!of_property_read_u64(np, "linux,serial", &val64))
  46. + system_serial_low = val64;
  47. }
  48. static const char * const bcm2835_compat[] = {