7a4b26ebda1ea95a3f774c8ce29aa65e63953208
[openwrt/staging/neocturne.git] /
1 From 311b5d4d00862995b7cf916139384defdb6e2d85 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 1 file changed, 39 insertions(+), 1 deletion(-)
26
27 --- a/drivers/firmware/raspberrypi.c
28 +++ b/drivers/firmware/raspberrypi.c
29 @@ -233,6 +233,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 @@ -242,7 +251,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 @@ -339,6 +376,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