84d8a89659cb2b36d94ec865937c42c281037dfd
[openwrt/staging/linusw.git] /
1 From 9abde0ff52268580501b3120629f3c92f0e5d589 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 10 Jan 2019 18:48:54 +0000
4 Subject: [PATCH] firmware: raspberrypi: Report the fw git hash during
5 probe
6
7 The firmware can now report the git hash from which it was built
8 via the mailbox, so report it during probe.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
11 ---
12 drivers/firmware/raspberrypi.c | 17 +++++++++++++++++
13 include/soc/bcm2835/raspberrypi-firmware.h | 1 +
14 2 files changed, 18 insertions(+)
15
16 --- a/drivers/firmware/raspberrypi.c
17 +++ b/drivers/firmware/raspberrypi.c
18 @@ -263,6 +263,22 @@ rpi_firmware_print_firmware_revision(str
19 }
20
21 static void
22 +rpi_firmware_print_firmware_hash(struct rpi_firmware *fw)
23 +{
24 + u32 hash[5];
25 + int ret = rpi_firmware_property(fw,
26 + RPI_FIRMWARE_GET_FIRMWARE_HASH,
27 + hash, sizeof(hash));
28 +
29 + if (ret)
30 + return;
31 +
32 + dev_info(fw->cl.dev,
33 + "Firmware hash is %08x%08x%08x%08x%08x\n",
34 + hash[0], hash[1], hash[2], hash[3], hash[4]);
35 +}
36 +
37 +static void
38 rpi_register_hwmon_driver(struct device *dev, struct rpi_firmware *fw)
39 {
40 u32 packet;
41 @@ -308,6 +324,7 @@ static int rpi_firmware_probe(struct pla
42 g_pdev = pdev;
43
44 rpi_firmware_print_firmware_revision(fw);
45 + rpi_firmware_print_firmware_hash(fw);
46 rpi_register_hwmon_driver(dev, fw);
47
48 return 0;
49 --- a/include/soc/bcm2835/raspberrypi-firmware.h
50 +++ b/include/soc/bcm2835/raspberrypi-firmware.h
51 @@ -42,6 +42,7 @@ enum rpi_firmware_property_tag {
52 RPI_FIRMWARE_PROPERTY_END = 0,
53 RPI_FIRMWARE_GET_FIRMWARE_REVISION = 0x00000001,
54 RPI_FIRMWARE_GET_FIRMWARE_VARIANT = 0x00000002,
55 + RPI_FIRMWARE_GET_FIRMWARE_HASH = 0x00000003,
56
57 RPI_FIRMWARE_SET_CURSOR_INFO = 0x00008010,
58 RPI_FIRMWARE_SET_CURSOR_STATE = 0x00008011,