]> git.ipfire.org Git - thirdparty/openwrt.git/blob
80a2ebeb6a33a8a2f5a06c763838a87ca7e88f4d
[thirdparty/openwrt.git] /
1 From 196e8003463bb10daf3b763b6c1ca877cd148c70 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 0132/1085] 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 1 file changed, 39 insertions(+), 1 deletion(-)
26
27 --- a/drivers/firmware/raspberrypi.c
28 +++ b/drivers/firmware/raspberrypi.c
29 @@ -235,6 +235,15 @@ rpi_firmware_print_firmware_revision(str
30 {
31 time64_t date_and_time;
32 u32 packet;
33 + static const char * const variant_strs[] = {
34 + "unknown",
35 + "start",
36 + "start_x",
37 + "start_db",
38 + "start_cd",
39 + };
40 + const char *variant_str = "cmd unsupported";
41 + u32 variant;
42 int ret = rpi_firmware_property(fw,
43 RPI_FIRMWARE_GET_FIRMWARE_REVISION,
44 &packet, sizeof(packet));
45 @@ -244,7 +253,35 @@ rpi_firmware_print_firmware_revision(str
46
47 /* This is not compatible with y2038 */
48 date_and_time = packet;
49 - dev_info(fw->cl.dev, "Attached to firmware from %ptT\n", &date_and_time);
50 +
51 + ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_FIRMWARE_VARIANT,
52 + &variant, sizeof(variant));
53 +
54 + if (!ret) {
55 + if (variant >= ARRAY_SIZE(variant_strs))
56 + variant = 0;
57 + variant_str = variant_strs[variant];
58 + }
59 +
60 + dev_info(fw->cl.dev,
61 + "Attached to firmware from %ptT, variant %s\n",
62 + &date_and_time, variant_str);
63 +}
64 +
65 +static void
66 +rpi_firmware_print_firmware_hash(struct rpi_firmware *fw)
67 +{
68 + u32 hash[5];
69 + int ret = rpi_firmware_property(fw,
70 + RPI_FIRMWARE_GET_FIRMWARE_HASH,
71 + hash, sizeof(hash));
72 +
73 + if (ret)
74 + return;
75 +
76 + dev_info(fw->cl.dev,
77 + "Firmware hash is %08x%08x%08x%08x%08x\n",
78 + hash[0], hash[1], hash[2], hash[3], hash[4]);
79 }
80
81 static void
82 @@ -359,6 +396,7 @@ static int rpi_firmware_probe(struct pla
83 g_pdev = pdev;
84
85 rpi_firmware_print_firmware_revision(fw);
86 + rpi_firmware_print_firmware_hash(fw);
87 rpi_register_hwmon_driver(dev, fw);
88 rpi_register_clk_driver(dev);
89