6cfca9d4f2e54f1b733304768e00f38c8b8bd877
[openwrt/staging/hauke.git] /
1 From ab759f3138e5ea798e93003e6ce0ffe66ac2970f Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 10 Jan 2019 17:58:06 +0000
4 Subject: [PATCH] firmware: raspberrypi: Report the fw variant during
5 probe
6
7 The driver already reported the firmware build date during probe.
8 The mailbox calls have been extended to also report the variant
9 1 = standard start.elf
10 2 = start_x.elf (includes camera stack)
11 3 = start_db.elf (includes assert logging)
12 4 = start_cd.elf (cutdown version for smallest memory footprint).
13 Log the variant during probe.
14
15 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
16
17 firmware: raspberrypi: Report the fw git hash during probe
18
19 The firmware can now report the git hash from which it was built
20 via the mailbox, so report it during probe.
21
22 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
23 ---
24 drivers/firmware/raspberrypi.c | 40 +++++++++++++++++++++-
25 include/soc/bcm2835/raspberrypi-firmware.h | 2 ++
26 2 files changed, 41 insertions(+), 1 deletion(-)
27
28 --- a/drivers/firmware/raspberrypi.c
29 +++ b/drivers/firmware/raspberrypi.c
30 @@ -234,6 +234,15 @@ rpi_firmware_print_firmware_revision(str
31 {
32 time64_t date_and_time;
33 u32 packet;
34 + static const char * const variant_strs[] = {
35 + "unknown",
36 + "start",
37 + "start_x",
38 + "start_db",
39 + "start_cd",
40 + };
41 + const char *variant_str = "cmd unsupported";
42 + u32 variant;
43 int ret = rpi_firmware_property(fw,
44 RPI_FIRMWARE_GET_FIRMWARE_REVISION,
45 &packet, sizeof(packet));
46 @@ -243,7 +252,35 @@ rpi_firmware_print_firmware_revision(str
47
48 /* This is not compatible with y2038 */
49 date_and_time = packet;
50 - dev_info(fw->cl.dev, "Attached to firmware from %ptT\n", &date_and_time);
51 +
52 + ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_FIRMWARE_VARIANT,
53 + &variant, sizeof(variant));
54 +
55 + if (!ret) {
56 + if (variant >= ARRAY_SIZE(variant_strs))
57 + variant = 0;
58 + variant_str = variant_strs[variant];
59 + }
60 +
61 + dev_info(fw->cl.dev,
62 + "Attached to firmware from %ptT, variant %s\n",
63 + &date_and_time, variant_str);
64 +}
65 +
66 +static void
67 +rpi_firmware_print_firmware_hash(struct rpi_firmware *fw)
68 +{
69 + u32 hash[5];
70 + int ret = rpi_firmware_property(fw,
71 + RPI_FIRMWARE_GET_FIRMWARE_HASH,
72 + hash, sizeof(hash));
73 +
74 + if (ret)
75 + return;
76 +
77 + dev_info(fw->cl.dev,
78 + "Firmware hash is %08x%08x%08x%08x%08x\n",
79 + hash[0], hash[1], hash[2], hash[3], hash[4]);
80 }
81
82 static void
83 @@ -332,6 +369,7 @@ static int rpi_firmware_probe(struct pla
84 g_pdev = pdev;
85
86 rpi_firmware_print_firmware_revision(fw);
87 + rpi_firmware_print_firmware_hash(fw);
88 rpi_register_hwmon_driver(dev, fw);
89 rpi_register_clk_driver(dev);
90
91 --- a/include/soc/bcm2835/raspberrypi-firmware.h
92 +++ b/include/soc/bcm2835/raspberrypi-firmware.h
93 @@ -38,6 +38,8 @@ struct rpi_firmware_property_tag_header
94 enum rpi_firmware_property_tag {
95 RPI_FIRMWARE_PROPERTY_END = 0,
96 RPI_FIRMWARE_GET_FIRMWARE_REVISION = 0x00000001,
97 + RPI_FIRMWARE_GET_FIRMWARE_VARIANT = 0x00000002,
98 + RPI_FIRMWARE_GET_FIRMWARE_HASH = 0x00000003,
99
100 RPI_FIRMWARE_SET_CURSOR_INFO = 0x00008010,
101 RPI_FIRMWARE_SET_CURSOR_STATE = 0x00008011,