a41e46b1e80891ffd338fc6663569bd87d733f4f
[openwrt/staging/zorun.git] /
1 From dfd66230d2d538e7f290436d2952124d6eadeb3d 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 drivers/firmware/raspberrypi.c | 32 +++++++++++++++++-----
18 include/soc/bcm2835/raspberrypi-firmware.h | 1 +
19 2 files changed, 26 insertions(+), 7 deletions(-)
20
21 --- a/drivers/firmware/raspberrypi.c
22 +++ b/drivers/firmware/raspberrypi.c
23 @@ -227,21 +227,39 @@ static const struct attribute_group rpi_
24 static void
25 rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
26 {
27 + static const char * const variant_strs[] = {
28 + "unknown",
29 + "start",
30 + "start_x",
31 + "start_db",
32 + "start_cd",
33 + };
34 + const char *variant_str = "cmd unsupported";
35 u32 packet;
36 + u32 variant;
37 + struct tm tm;
38 int ret = rpi_firmware_property(fw,
39 RPI_FIRMWARE_GET_FIRMWARE_REVISION,
40 &packet, sizeof(packet));
41
42 - if (ret == 0) {
43 - struct tm tm;
44 + if (ret)
45 + return;
46
47 - time64_to_tm(packet, 0, &tm);
48 + ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_FIRMWARE_VARIANT,
49 + &variant, sizeof(variant));
50
51 - dev_info(fw->cl.dev,
52 - "Attached to firmware from %04ld-%02d-%02d %02d:%02d\n",
53 - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
54 - tm.tm_hour, tm.tm_min);
55 + if (!ret) {
56 + if (variant >= ARRAY_SIZE(variant_strs))
57 + variant = 0;
58 + variant_str = variant_strs[variant];
59 }
60 +
61 + time64_to_tm(packet, 0, &tm);
62 +
63 + dev_info(fw->cl.dev,
64 + "Attached to firmware from %04ld-%02d-%02d %02d:%02d, variant %s\n",
65 + tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour,
66 + tm.tm_min, variant_str);
67 }
68
69 static void
70 --- a/include/soc/bcm2835/raspberrypi-firmware.h
71 +++ b/include/soc/bcm2835/raspberrypi-firmware.h
72 @@ -41,6 +41,7 @@ struct rpi_firmware_property_tag_header
73 enum rpi_firmware_property_tag {
74 RPI_FIRMWARE_PROPERTY_END = 0,
75 RPI_FIRMWARE_GET_FIRMWARE_REVISION = 0x00000001,
76 + RPI_FIRMWARE_GET_FIRMWARE_VARIANT = 0x00000002,
77
78 RPI_FIRMWARE_SET_CURSOR_INFO = 0x00008010,
79 RPI_FIRMWARE_SET_CURSOR_STATE = 0x00008011,